[Spice-devel] [video-qxl 5/6] Implement copy with fbFill.

Jeremy White jwhite at codeweavers.com
Thu Jan 10 07:44:54 PST 2013


This fixes issues with 1 bit images; some pixman implementations
did not support 1 bit images - the general fbFill implementation
takes care of it for us.

Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 src/dfps.c |   27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/dfps.c b/src/dfps.c
index fca51ff..3e74d65 100644
--- a/src/dfps.c
+++ b/src/dfps.c
@@ -50,6 +50,7 @@ struct dfps_info_t
 
     PixmapPtr   copy_src;
     Pixel       solid_pixel;
+    GCPtr       pgc;
 };
 
 void dfps_ticker(void *opaque)
@@ -84,16 +85,22 @@ static Bool dfps_prepare_solid (PixmapPtr pixmap, int alu, Pixel planemask, Pixe
         return FALSE;
 
     info->solid_pixel = fg;
+    info->pgc = GetScratchGC(pixmap->drawable.depth, pixmap->drawable.pScreen);
+    if (! info->pgc)
+        return FALSE;
+
+    info->pgc->alu = alu;
+    info->pgc->planemask = planemask;
+    info->pgc->fgPixel = fg;
+    info->pgc->fillStyle = FillSolid;
+
+    fbValidateGC(info->pgc, GCForeground | GCPlaneMask, &pixmap->drawable);
 
     return TRUE;
 }
 
 static void dfps_solid (PixmapPtr pixmap, int x_1, int y_1, int x_2, int y_2)
 {
-    FbBits *bits;
-    int stride;
-    int bpp;
-    int xoff, yoff;
     struct pixman_box16 box;
     RegionPtr region;
     Bool throwaway_bool;
@@ -103,10 +110,7 @@ static void dfps_solid (PixmapPtr pixmap, int x_1, int y_1, int x_2, int y_2)
         return;
 
     /* Draw to the frame buffer */
-    fbGetDrawable((DrawablePtr)pixmap, bits, stride, bpp, xoff, yoff);
-    pixman_fill((uint32_t *) bits, stride, bpp, x_1 + xoff, y_1 + yoff, x_2 - x_1, y_2 - y_1, info->solid_pixel);
-    fbValidateDrawable(pixmap);
-    fbFinishAccess(pixmap);
+    fbFill(&pixmap->drawable, info->pgc, x_1, y_1, x_2 - x_1, y_2 - y_1);
 
     /* Track the updated region */
     box.x1 = x_1; box.x2 = x_2; box.y1 = y_1; box.y2 = y_2;
@@ -119,6 +123,13 @@ static void dfps_solid (PixmapPtr pixmap, int x_1, int y_1, int x_2, int y_2)
 
 static void dfps_done_solid (PixmapPtr pixmap)
 {
+    dfps_info_t *info;
+
+    if ((info = dfps_get_info (pixmap)))
+    {
+        FreeScratchGC(info->pgc);
+        info->pgc = NULL;
+    }
 }
 
 static Bool dfps_prepare_copy (PixmapPtr source, PixmapPtr dest,
-- 
1.7.10.4





More information about the Spice-devel mailing list