]> Pileus Git - ~andy/gtk/commitdiff
gdk: Remove _gdk_windowing_get_shape_for_mask()
authorBenjamin Otte <otte@redhat.com>
Sat, 14 Aug 2010 04:51:53 +0000 (06:51 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 26 Sep 2010 13:02:59 +0000 (15:02 +0200)
It's unused. And there's a replacement available with
gdk_cairo_region_create_from_surface()

gdk/gdkinternals.h
gdk/quartz/gdkwindow-quartz.c
gdk/win32/gdkwindow-win32.c
gdk/x11/gdkwindow-x11.c

index eda1e55b57c8c6a593de734f456c322c9932b2f8..daa009a7ad4f257306871da0c30c4dc2ef7e5536 100644 (file)
@@ -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);
 
 
index 117c42411398b314c5eaf8dc3880acdae78e91fd..3ec54324d76082ee45527a7a8d96841d64f789c5 100644 (file)
@@ -3000,13 +3000,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)
 {
index 7ec3c98fbc8bb16a40464d71d7033f69d31fcc2e..d600fc775edf4c3508c4e6eb03bce7f55d49cd8e 100644 (file)
@@ -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)
 {
index be8e1157b253e3b48af4add551b5fd64d9b9f7c7..9aa9e8ed7e8a78657630c5455b41da27889cf55a 100644 (file)
@@ -4549,34 +4549,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)
 {