[gtk+] gdk: Remove _gdk_windowing_get_shape_for_mask()



commit bfa6ad6e7c7d8f472b457c32d1fd40d14c296aa2
Author: Benjamin Otte <otte redhat com>
Date:   Sat Aug 14 06:51:53 2010 +0200

    gdk: Remove _gdk_windowing_get_shape_for_mask()
    
    It's unused. And there's a replacement available with
    gdk_cairo_region_create_from_surface()

 gdk/gdkinternals.h            |    1 -
 gdk/quartz/gdkwindow-quartz.c |    7 --
 gdk/win32/gdkwindow-win32.c   |  135 -----------------------------------------
 gdk/x11/gdkwindow-x11.c       |   28 ---------
 4 files changed, 0 insertions(+), 171 deletions(-)
---
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index eda1e55..daa009a 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -376,7 +376,6 @@ void     _gdk_windowing_window_get_offsets      (GdkWindow  *window,
 						 gint       *y_offset);
 cairo_region_t *_gdk_windowing_window_get_shape      (GdkWindow  *window);
 cairo_region_t *_gdk_windowing_window_get_input_shape(GdkWindow  *window);
-cairo_region_t *_gdk_windowing_get_shape_for_mask    (GdkBitmap *mask);
 void     _gdk_windowing_window_beep             (GdkWindow *window);
 
 
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 117c424..3ec5432 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -3001,13 +3001,6 @@ _gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
 }
 
 cairo_region_t *
-_gdk_windowing_get_shape_for_mask (GdkBitmap *mask)
-{
-  /* FIXME: implement */
-  return NULL;
-}
-
-cairo_region_t *
 _gdk_windowing_window_get_shape (GdkWindow *window)
 {
   /* FIXME: implement */
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 7ec3c98..d600fc7 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -3236,141 +3236,6 @@ gdk_window_set_opacity (GdkWindow *window,
     }
 }
 
-/* This function originally from Jean-Edouard Lachand-Robert, and
- * available at www.codeguru.com. Simplified for our needs, not sure
- * how much of the original code left any longer. Now handles just
- * one-bit deep bitmaps (in Window parlance, ie those that GDK calls
- * bitmaps (and not pixmaps), with zero pixels being transparent.
- */
-
-/* bitmap_to_hrgn : Create a region from the
- * "non-transparent" pixels of a bitmap.
- */
-
-static HRGN
-bitmap_to_hrgn (GdkPixmap *pixmap)
-{
-  HRGN hRgn = NULL;
-  HRGN h;
-  DWORD maxRects;
-  RGNDATA *pData;
-  guchar *bits;
-  gint width, height, bpl;
-  guchar *p;
-  gint x, y;
-
-  g_assert (GDK_PIXMAP_OBJECT(pixmap)->depth == 1);
-
-  bits = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->bits;
-  width = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->width;
-  height = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->height;
-  bpl = ((width - 1)/32 + 1)*4;
-
-  /* For better performances, we will use the ExtCreateRegion()
-   * function to create the region. This function take a RGNDATA
-   * structure on entry. We will add rectangles by amount of
-   * ALLOC_UNIT number in this structure.
-   */
-  #define ALLOC_UNIT  100
-  maxRects = ALLOC_UNIT;
-
-  pData = g_malloc (sizeof (RGNDATAHEADER) + (sizeof (RECT) * maxRects));
-  pData->rdh.dwSize = sizeof (RGNDATAHEADER);
-  pData->rdh.iType = RDH_RECTANGLES;
-  pData->rdh.nCount = pData->rdh.nRgnSize = 0;
-  SetRect (&pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0);
-
-  for (y = 0; y < height; y++)
-    {
-      /* Scan each bitmap row from left to right*/
-      p = (guchar *) bits + y * bpl;
-      for (x = 0; x < width; x++)
-	{
-	  /* Search for a continuous range of "non transparent pixels"*/
-	  gint x0 = x;
-	  while (x < width)
-	    {
-	      if ((((p[x/8])>>(7-(x%8)))&1) == 0)
-		/* This pixel is "transparent"*/
-		break;
-	      x++;
-	    }
-	  
-	  if (x > x0)
-	    {
-	      RECT *pr;
-	      /* Add the pixels (x0, y) to (x, y+1) as a new rectangle
-	       * in the region
-	       */
-	      if (pData->rdh.nCount >= maxRects)
-		{
-		  maxRects += ALLOC_UNIT;
-		  pData = g_realloc (pData, sizeof(RGNDATAHEADER)
-				     + (sizeof(RECT) * maxRects));
-		}
-	      pr = (RECT *) &pData->Buffer;
-	      SetRect (&pr[pData->rdh.nCount], x0, y, x, y+1);
-	      if (x0 < pData->rdh.rcBound.left)
-		pData->rdh.rcBound.left = x0;
-	      if (y < pData->rdh.rcBound.top)
-		pData->rdh.rcBound.top = y;
-	      if (x > pData->rdh.rcBound.right)
-		pData->rdh.rcBound.right = x;
-	      if (y+1 > pData->rdh.rcBound.bottom)
-		pData->rdh.rcBound.bottom = y+1;
-	      pData->rdh.nCount++;
-	      
-	      /* On Windows98, ExtCreateRegion() may fail if the
-	       * number of rectangles is too large (ie: >
-	       * 4000). Therefore, we have to create the region by
-	       * multiple steps.
-	       */
-	      if (pData->rdh.nCount == 2000)
-		{
-		  HRGN h = ExtCreateRegion (NULL, sizeof(RGNDATAHEADER) + (sizeof(RECT) * maxRects), pData);
-		  if (hRgn)
-		    {
-		      CombineRgn(hRgn, hRgn, h, RGN_OR);
-		      DeleteObject(h);
-		    }
-		  else
-		    hRgn = h;
-		  pData->rdh.nCount = 0;
-		  SetRect (&pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0);
-		}
-	    }
-	}
-    }
-  
-  /* Create or extend the region with the remaining rectangles*/
-  h = ExtCreateRegion (NULL, sizeof (RGNDATAHEADER)
-		       + (sizeof (RECT) * maxRects), pData);
-  if (hRgn)
-    {
-      CombineRgn (hRgn, hRgn, h, RGN_OR);
-      DeleteObject (h);
-    }
-  else
-    hRgn = h;
-
-  /* Clean up*/
-  g_free (pData);
-
-  return hRgn;
-}
-
-cairo_region_t *
-_gdk_windowing_get_shape_for_mask (GdkBitmap *mask)
-{
-  cairo_region_t *region;
-  HRGN hrgn = bitmap_to_hrgn (mask);
-
-  region = _gdk_win32_hrgn_to_region (hrgn);
-  DeleteObject (hrgn);
-
-  return region;
-}
-
 void
 _gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
 {
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index be8e115..9aa9e8e 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -4550,34 +4550,6 @@ _xwindow_get_shape (Display *xdisplay,
 
 
 cairo_region_t *
-_gdk_windowing_get_shape_for_mask (GdkBitmap *mask)
-{
-  GdkDisplay *display;
-  Window window;
-  cairo_region_t *region;
-
-  display = gdk_drawable_get_display (GDK_DRAWABLE (mask));
-
-  window = XCreateSimpleWindow (GDK_DISPLAY_XDISPLAY (display),
-                                GDK_SCREEN_XROOTWIN (gdk_drawable_get_screen (mask)),
-                                -1, -1, 1, 1, 0,
-                                0, 0);
-  XShapeCombineMask (GDK_DISPLAY_XDISPLAY (display),
-                     window,
-                     ShapeBounding,
-                     0, 0,
-                     GDK_PIXMAP_XID (mask),
-                     ShapeSet);
-
-  region = _xwindow_get_shape (GDK_DISPLAY_XDISPLAY (display),
-                               window, ShapeBounding);
-
-  XDestroyWindow (GDK_DISPLAY_XDISPLAY (display), window);
-
-  return region;
-}
-
-cairo_region_t *
 _gdk_windowing_window_get_shape (GdkWindow *window)
 {
   if (!GDK_WINDOW_DESTROYED (window) &&



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]