gdk: Remove _gdk_windowing_get_shape_for_mask()

It's unused. And there's a replacement available with
gdk_cairo_region_create_from_surface()
This commit is contained in:
Benjamin Otte 2010-08-14 06:51:53 +02:00
parent a7fec8cf46
commit bfa6ad6e7c
4 changed files with 0 additions and 171 deletions

View 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);

View 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)
{

View 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)
{

View 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)
{