mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Use cairo_set_device_offset().
2005-02-24 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.c: Use cairo_set_device_offset(). * gdk/win32/gdkdrawable-win32.[ch] gdk/win32/gdkwindow-win32.c gdk/win32/gdkpixmap-win32.c: Add_gdk_win32_drawable_acquire/release_dc() to get a DC for the drawable. Add _gdk_drawable_win32_finish() to clean up resources when a drawable is destroyed. * gdk/win32/gdkgc-win32.c gdk/win32/gdkdrawable-win32.c (blit_from_pixmap) gdk/win32/gdkprivate-win32.h : Use acquire/release_dc when getting a DC to use with a GC or for blitting from a pixmap. * gdk/win32/gdkdrawable-win32.[ch]: Implement ref_cairo_surface() * gdk/win32/gdkpango-win32.c gdk/win32/gdkdrawable-win32.c Makefile.am: Remove gdk_screen_get_pango_context(), draw_glyph[_transformed] implementations. * gdk/win32/gdkdrawable-win32.c: Remove gdk_draw_rectangle_alpha_libgtk_only()
This commit is contained in:
parent
d1bc66a20c
commit
368f15ca59
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
||||
2005-02-24 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.c: Use cairo_set_device_offset().
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.[ch] gdk/win32/gdkwindow-win32.c
|
||||
gdk/win32/gdkpixmap-win32.c:
|
||||
Add_gdk_win32_drawable_acquire/release_dc() to get a DC for the
|
||||
drawable. Add _gdk_drawable_win32_finish() to clean up resources
|
||||
when a drawable is destroyed.
|
||||
|
||||
* gdk/win32/gdkgc-win32.c gdk/win32/gdkdrawable-win32.c
|
||||
(blit_from_pixmap) gdk/win32/gdkprivate-win32.h : Use
|
||||
acquire/release_dc when getting a DC to use with a GC or for
|
||||
blitting from a pixmap.
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.[ch]: Implement ref_cairo_surface()
|
||||
|
||||
* gdk/win32/gdkpango-win32.c gdk/win32/gdkdrawable-win32.c Makefile.am:
|
||||
Remove gdk_screen_get_pango_context(), draw_glyph[_transformed]
|
||||
implementations.
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.c: Remove
|
||||
gdk_draw_rectangle_alpha_libgtk_only()
|
||||
|
||||
2005-03-17 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c: Fix get_stipple_surface to actually work, set
|
||||
|
@ -1,3 +1,27 @@
|
||||
2005-02-24 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.c: Use cairo_set_device_offset().
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.[ch] gdk/win32/gdkwindow-win32.c
|
||||
gdk/win32/gdkpixmap-win32.c:
|
||||
Add_gdk_win32_drawable_acquire/release_dc() to get a DC for the
|
||||
drawable. Add _gdk_drawable_win32_finish() to clean up resources
|
||||
when a drawable is destroyed.
|
||||
|
||||
* gdk/win32/gdkgc-win32.c gdk/win32/gdkdrawable-win32.c
|
||||
(blit_from_pixmap) gdk/win32/gdkprivate-win32.h : Use
|
||||
acquire/release_dc when getting a DC to use with a GC or for
|
||||
blitting from a pixmap.
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.[ch]: Implement ref_cairo_surface()
|
||||
|
||||
* gdk/win32/gdkpango-win32.c gdk/win32/gdkdrawable-win32.c Makefile.am:
|
||||
Remove gdk_screen_get_pango_context(), draw_glyph[_transformed]
|
||||
implementations.
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.c: Remove
|
||||
gdk_draw_rectangle_alpha_libgtk_only()
|
||||
|
||||
2005-03-17 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c: Fix get_stipple_surface to actually work, set
|
||||
|
@ -1,3 +1,27 @@
|
||||
2005-02-24 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkwindow.c: Use cairo_set_device_offset().
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.[ch] gdk/win32/gdkwindow-win32.c
|
||||
gdk/win32/gdkpixmap-win32.c:
|
||||
Add_gdk_win32_drawable_acquire/release_dc() to get a DC for the
|
||||
drawable. Add _gdk_drawable_win32_finish() to clean up resources
|
||||
when a drawable is destroyed.
|
||||
|
||||
* gdk/win32/gdkgc-win32.c gdk/win32/gdkdrawable-win32.c
|
||||
(blit_from_pixmap) gdk/win32/gdkprivate-win32.h : Use
|
||||
acquire/release_dc when getting a DC to use with a GC or for
|
||||
blitting from a pixmap.
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.[ch]: Implement ref_cairo_surface()
|
||||
|
||||
* gdk/win32/gdkpango-win32.c gdk/win32/gdkdrawable-win32.c Makefile.am:
|
||||
Remove gdk_screen_get_pango_context(), draw_glyph[_transformed]
|
||||
implementations.
|
||||
|
||||
* gdk/win32/gdkdrawable-win32.c: Remove
|
||||
gdk_draw_rectangle_alpha_libgtk_only()
|
||||
|
||||
2005-03-17 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c: Fix get_stipple_surface to actually work, set
|
||||
|
@ -974,8 +974,8 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
MAX (clip_box.width, 1), MAX (clip_box.height, 1), -1);
|
||||
|
||||
paint->surface = _gdk_drawable_ref_cairo_surface (paint->pixmap);
|
||||
_gdk_windowing_set_surface_device_offset (paint->surface,
|
||||
- paint->x_offset, - paint->y_offset);
|
||||
cairo_surface_set_device_offset (paint->surface,
|
||||
- paint->x_offset, - paint->y_offset);
|
||||
|
||||
for (list = private->paint_stack; list != NULL; list = list->next)
|
||||
{
|
||||
|
@ -61,7 +61,6 @@ libgdk_win32_la_SOURCES = \
|
||||
gdkinput-win32.h \
|
||||
gdkkeys-win32.c \
|
||||
gdkmain-win32.c \
|
||||
gdkpango-win32.c \
|
||||
gdkpixmap-win32.c \
|
||||
gdkpixmap-win32.h \
|
||||
gdkprivate-win32.h \
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include <pango/pangowin32.h>
|
||||
#include <cairo-win32.h>
|
||||
|
||||
#include "gdkscreen.h" /* gdk_screen_get_default() */
|
||||
#include "gdkregion-generic.h"
|
||||
@ -100,19 +101,6 @@ static void gdk_win32_draw_lines (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPoint *points,
|
||||
gint npoints);
|
||||
static void gdk_win32_draw_glyphs (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
PangoFont *font,
|
||||
gint x,
|
||||
gint y,
|
||||
PangoGlyphString *glyphs);
|
||||
static void gdk_win32_draw_glyphs_transformed (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
PangoMatrix *matrix,
|
||||
PangoFont *font,
|
||||
gint x,
|
||||
gint y,
|
||||
PangoGlyphString *glyphs);
|
||||
static void gdk_win32_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
@ -123,6 +111,8 @@ static void gdk_win32_draw_image (GdkDrawable *drawable,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
|
||||
|
||||
static void gdk_win32_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *colormap);
|
||||
|
||||
@ -139,6 +129,7 @@ static void gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass
|
||||
static void gdk_drawable_impl_win32_finalize (GObject *object);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
static const cairo_user_data_key_t gdk_win32_cairo_key;
|
||||
|
||||
GType
|
||||
gdk_drawable_impl_win32_get_type (void)
|
||||
@ -188,10 +179,10 @@ gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
|
||||
drawable_class->draw_points = gdk_win32_draw_points;
|
||||
drawable_class->draw_segments = gdk_win32_draw_segments;
|
||||
drawable_class->draw_lines = gdk_win32_draw_lines;
|
||||
drawable_class->draw_glyphs = gdk_win32_draw_glyphs;
|
||||
drawable_class->draw_glyphs_transformed = gdk_win32_draw_glyphs_transformed;
|
||||
drawable_class->draw_image = gdk_win32_draw_image;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
|
||||
|
||||
drawable_class->set_colormap = gdk_win32_set_colormap;
|
||||
drawable_class->get_colormap = gdk_win32_get_colormap;
|
||||
|
||||
@ -1488,121 +1479,6 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
|
||||
g_free (pts);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_glyphs (GdkGCWin32 *gcwin32,
|
||||
HDC hdc,
|
||||
gint x_offset,
|
||||
gint y_offset,
|
||||
va_list args)
|
||||
{
|
||||
PangoFont *font;
|
||||
gint x;
|
||||
gint y;
|
||||
PangoGlyphString *glyphs;
|
||||
|
||||
font = va_arg (args, PangoFont *);
|
||||
x = va_arg (args, gint);
|
||||
y = va_arg (args, gint);
|
||||
glyphs = va_arg (args, PangoGlyphString *);
|
||||
|
||||
x -= x_offset;
|
||||
y -= y_offset;
|
||||
|
||||
pango_win32_render (hdc, font, glyphs, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_glyphs_transformed (GdkGCWin32 *gcwin32,
|
||||
HDC hdc,
|
||||
gint x_offset,
|
||||
gint y_offset,
|
||||
va_list args)
|
||||
{
|
||||
PangoFont *font;
|
||||
gint x;
|
||||
gint y;
|
||||
PangoGlyphString *glyphs;
|
||||
PangoMatrix *matrix;
|
||||
|
||||
matrix = va_arg(args, PangoMatrix *);
|
||||
font = va_arg (args, PangoFont *);
|
||||
x = va_arg (args, gint);
|
||||
y = va_arg (args, gint);
|
||||
glyphs = va_arg (args, PangoGlyphString *);
|
||||
|
||||
x -= x_offset;
|
||||
y -= y_offset;
|
||||
|
||||
pango_win32_render_transformed (hdc, matrix, font, glyphs, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_draw_glyphs (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
PangoFont *font,
|
||||
gint x,
|
||||
gint y,
|
||||
PangoGlyphString *glyphs)
|
||||
{
|
||||
GdkRectangle bounds;
|
||||
GdkRegion *region;
|
||||
PangoRectangle ink_rect;
|
||||
|
||||
pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
|
||||
|
||||
bounds.x = x + PANGO_PIXELS (ink_rect.x) - 1;
|
||||
bounds.y = y + PANGO_PIXELS (ink_rect.y) - 1;
|
||||
bounds.width = PANGO_PIXELS (ink_rect.width) + 2;
|
||||
bounds.height = PANGO_PIXELS (ink_rect.height) + 2;
|
||||
region = gdk_region_rectangle (&bounds);
|
||||
|
||||
generic_draw (drawable, gc, GDK_GC_FOREGROUND|GDK_GC_FONT,
|
||||
draw_glyphs, region, font, x, y, glyphs);
|
||||
|
||||
gdk_region_destroy (region);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_draw_glyphs_transformed (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
PangoMatrix *matrix,
|
||||
PangoFont *font,
|
||||
gint x,
|
||||
gint y,
|
||||
PangoGlyphString *glyphs)
|
||||
{
|
||||
GdkRectangle bounds;
|
||||
GdkRegion *region;
|
||||
PangoRectangle ink_rect;
|
||||
|
||||
pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
|
||||
|
||||
bounds.x = x + PANGO_PIXELS (ink_rect.x) - 1;
|
||||
bounds.y = y + PANGO_PIXELS (ink_rect.y) - 1;
|
||||
bounds.width = PANGO_PIXELS (ink_rect.width) + 2;
|
||||
bounds.height = PANGO_PIXELS (ink_rect.height) + 2;
|
||||
region = gdk_region_rectangle (&bounds);
|
||||
|
||||
if (matrix)
|
||||
{
|
||||
/* transform region */
|
||||
bounds.x = bounds.x * matrix->xx + bounds.y * matrix->xy + matrix->x0;
|
||||
bounds.y = bounds.x * matrix->yx + bounds.y * matrix->yy + matrix->x0;
|
||||
bounds.width = bounds.width * matrix->xx + bounds.height * matrix->xy;
|
||||
bounds.height = bounds.height * matrix->yx + bounds.width * matrix->xy;
|
||||
|
||||
generic_draw (drawable, gc, GDK_GC_FOREGROUND|GDK_GC_FONT,
|
||||
draw_glyphs_transformed, region, matrix, font, x, y, glyphs);
|
||||
}
|
||||
else
|
||||
{
|
||||
generic_draw (drawable, gc, GDK_GC_FOREGROUND|GDK_GC_FONT,
|
||||
draw_glyphs, region, font, x/PANGO_SCALE, y/PANGO_SCALE, glyphs);
|
||||
}
|
||||
|
||||
gdk_region_destroy (region);
|
||||
}
|
||||
|
||||
static void
|
||||
blit_from_pixmap (gboolean use_fg_bg,
|
||||
GdkDrawableImplWin32 *dest,
|
||||
@ -1626,12 +1502,10 @@ blit_from_pixmap (gboolean use_fg_bg,
|
||||
|
||||
GDK_NOTE (MISC, g_print ("blit_from_pixmap\n"));
|
||||
|
||||
if (!(srcdc = CreateCompatibleDC (NULL)))
|
||||
{
|
||||
WIN32_GDI_FAILED ("CreateCompatibleDC");
|
||||
return;
|
||||
}
|
||||
|
||||
srcdc = _gdk_win32_drawable_acquire_dc (GDK_DRAWABLE (src));
|
||||
if (!srcdc)
|
||||
return;
|
||||
|
||||
if (!(holdbitmap = SelectObject (srcdc, ((GdkDrawableImplWin32 *) src)->handle)))
|
||||
WIN32_GDI_FAILED ("SelectObject");
|
||||
else
|
||||
@ -1736,7 +1610,8 @@ blit_from_pixmap (gboolean use_fg_bg,
|
||||
|
||||
GDI_CALL (SelectObject, (srcdc, holdbitmap));
|
||||
}
|
||||
GDI_CALL (DeleteDC, (srcdc));
|
||||
|
||||
_gdk_win32_drawable_release_dc (GDK_DRAWABLE (src));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1935,6 +1810,130 @@ gdk_win32_draw_image (GdkDrawable *drawable,
|
||||
xsrc, ysrc, xdest, ydest, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_win32_drawable_acquire_dc
|
||||
* @drawable: a Win32 #GdkDrawable implementation
|
||||
*
|
||||
* Gets a DC with the given drawable selected into
|
||||
* it.
|
||||
*
|
||||
* Return value: The DC, on success. Otherwise
|
||||
* %NULL. If this function succeeded
|
||||
* _gdk_win32_drawable_release_dc() must be called
|
||||
* release the DC when you are done using it.
|
||||
**/
|
||||
HDC
|
||||
_gdk_win32_drawable_acquire_dc (GdkDrawable *drawable)
|
||||
{
|
||||
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
||||
|
||||
if (GDK_IS_WINDOW_IMPL_WIN32 (drawable) &&
|
||||
GDK_WINDOW_DESTROYED (impl->wrapper))
|
||||
return NULL;
|
||||
|
||||
if (!impl->hdc)
|
||||
{
|
||||
if (GDK_IS_PIXMAP_IMPL_WIN32 (impl))
|
||||
{
|
||||
impl->hdc = CreateCompatibleDC (NULL);
|
||||
if (!impl->hdc)
|
||||
WIN32_GDI_FAILED ("CreateCompatibleDC");
|
||||
|
||||
if (impl->hdc)
|
||||
{
|
||||
impl->saved_dc_bitmap = SelectObject (impl->hdc,
|
||||
impl->handle);
|
||||
if (!impl->saved_dc_bitmap)
|
||||
{
|
||||
WIN32_GDI_FAILED ("CreateCompatibleDC");
|
||||
DeleteDC (impl->hdc);
|
||||
impl->hdc = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
impl->hdc = GetDC (impl->handle);
|
||||
if (!impl->hdc)
|
||||
WIN32_GDI_FAILED ("GetDC");
|
||||
}
|
||||
}
|
||||
|
||||
if (impl->hdc)
|
||||
{
|
||||
impl->hdc_count++;
|
||||
return impl->hdc;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_win32_drawable_release_dc
|
||||
* @drawable: a Win32 #GdkDrawable implementation
|
||||
*
|
||||
* Releases the reference count for the DC
|
||||
* from _gdk_win32_drawable_acquire_dc()
|
||||
**/
|
||||
void
|
||||
_gdk_win32_drawable_release_dc (GdkDrawable *drawable)
|
||||
{
|
||||
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
||||
|
||||
g_return_if_fail (impl->hdc_count > 0);
|
||||
|
||||
impl->hdc_count--;
|
||||
if (impl->hdc_count == 0)
|
||||
{
|
||||
if (impl->saved_dc_bitmap)
|
||||
{
|
||||
GDI_CALL (SelectObject, (impl->hdc, impl->saved_dc_bitmap));
|
||||
impl->saved_dc_bitmap = NULL;
|
||||
}
|
||||
|
||||
if (impl->hdc)
|
||||
{
|
||||
GDI_CALL (DeleteDC, (impl->hdc));
|
||||
impl->hdc = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_cairo_surface_destroy (void *data)
|
||||
{
|
||||
GdkDrawableImplWin32 *impl = data;
|
||||
|
||||
_gdk_win32_drawable_release_dc (GDK_DRAWABLE (impl));
|
||||
impl->cairo_surface = NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_win32_ref_cairo_surface (GdkDrawable *drawable)
|
||||
{
|
||||
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
||||
|
||||
if (GDK_IS_WINDOW_IMPL_WIN32 (drawable) &&
|
||||
GDK_WINDOW_DESTROYED (impl->wrapper))
|
||||
return NULL;
|
||||
|
||||
if (!impl->cairo_surface)
|
||||
{
|
||||
HDC hdc = _gdk_win32_drawable_acquire_dc (drawable);
|
||||
if (!hdc)
|
||||
return NULL;
|
||||
|
||||
impl->cairo_surface = cairo_win32_surface_create (hdc);
|
||||
|
||||
cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
|
||||
drawable, gdk_win32_cairo_surface_destroy);
|
||||
}
|
||||
else
|
||||
cairo_surface_reference (impl->cairo_surface);
|
||||
|
||||
return impl->cairo_surface;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_win32_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
@ -1961,14 +1960,27 @@ gdk_win32_drawable_get_handle (GdkDrawable *drawable)
|
||||
return GDK_DRAWABLE_HANDLE (drawable);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkColor *color,
|
||||
guint16 alpha)
|
||||
/**
|
||||
* _gdk_win32_drawable_finish
|
||||
* @drawable: a Win32 #GdkDrawable implementation
|
||||
*
|
||||
* Releases any resources allocated internally for the drawable.
|
||||
* This is called when the drawable becomes unusable
|
||||
* (gdk_window_destroy() for a window, or the refcount going to
|
||||
* zero for a pixmap.)
|
||||
**/
|
||||
void
|
||||
_gdk_win32_drawable_finish (GdkDrawable *drawable)
|
||||
{
|
||||
return FALSE;
|
||||
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
||||
|
||||
if (impl->cairo_surface)
|
||||
{
|
||||
cairo_surface_finish (impl->cairo_surface);
|
||||
cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
g_assert (impl->hdc_count == 0);
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,11 @@ struct _GdkDrawableImplWin32
|
||||
GdkDrawable *wrapper;
|
||||
GdkColormap *colormap;
|
||||
HANDLE handle;
|
||||
|
||||
guint hdc_count;
|
||||
HDC hdc;
|
||||
HBITMAP saved_dc_bitmap; /* Original bitmap for dc */
|
||||
cairo_surface_t *cairo_surface;
|
||||
};
|
||||
|
||||
struct _GdkDrawableImplWin32Class
|
||||
@ -63,6 +68,10 @@ struct _GdkDrawableImplWin32Class
|
||||
|
||||
GType gdk_drawable_impl_win32_get_type (void);
|
||||
|
||||
HDC _gdk_win32_drawable_acquire_dc (GdkDrawable *drawable);
|
||||
void _gdk_win32_drawable_release_dc (GdkDrawable *drawable);
|
||||
void _gdk_win32_drawable_finish (GdkDrawable *drawable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -475,7 +475,6 @@ _gdk_win32_gc_new (GdkDrawable *drawable,
|
||||
GDK_NOTE (GC, g_print ("\n"));
|
||||
|
||||
win32_gc->hdc = NULL;
|
||||
win32_gc->hwnd = NULL;
|
||||
|
||||
return gc;
|
||||
}
|
||||
@ -764,7 +763,6 @@ gdk_gc_copy (GdkGC *dst_gc,
|
||||
|
||||
dst_win32_gc->hdc = NULL;
|
||||
dst_win32_gc->saved_dc = FALSE;
|
||||
dst_win32_gc->hwnd = NULL;
|
||||
dst_win32_gc->holdpal = NULL;
|
||||
dst_win32_gc->pen_hbrbg = NULL;
|
||||
}
|
||||
@ -846,6 +844,21 @@ predraw (GdkGC *gc,
|
||||
return ok;
|
||||
}
|
||||
|
||||
static GdkDrawableImplWin32 *
|
||||
get_impl_drawable (GdkDrawable *drawable)
|
||||
{
|
||||
if (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable))
|
||||
return GDK_DRAWABLE_IMPL_WIN32(drawable);
|
||||
else if (GDK_IS_WINDOW (drawable))
|
||||
return GDK_DRAWABLE_IMPL_WIN32 ((GDK_WINDOW_OBJECT (drawable))->impl);
|
||||
else if (GDK_IS_PIXMAP (drawable))
|
||||
return GDK_DRAWABLE_IMPL_WIN32 ((GDK_PIXMAP_OBJECT (drawable))->impl);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_win32_hdc_get:
|
||||
* @drawable: destination #GdkDrawable
|
||||
@ -911,37 +924,14 @@ gdk_win32_hdc_get (GdkDrawable *drawable,
|
||||
|
||||
g_assert (win32_gc->hdc == NULL);
|
||||
|
||||
if (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable))
|
||||
impl = GDK_DRAWABLE_IMPL_WIN32(drawable);
|
||||
else if (GDK_IS_WINDOW (drawable))
|
||||
impl = GDK_DRAWABLE_IMPL_WIN32 ((GDK_WINDOW_OBJECT (drawable))->impl);
|
||||
else if (GDK_IS_PIXMAP (drawable))
|
||||
impl = GDK_DRAWABLE_IMPL_WIN32 ((GDK_PIXMAP_OBJECT (drawable))->impl);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
impl = get_impl_drawable (drawable);
|
||||
|
||||
win32_gc->hdc = _gdk_win32_drawable_acquire_dc (GDK_DRAWABLE (impl));
|
||||
ok = win32_gc->hdc != NULL;
|
||||
|
||||
win32_gc->hwnd = impl->handle;
|
||||
|
||||
if (GDK_IS_PIXMAP_IMPL_WIN32 (impl))
|
||||
{
|
||||
if ((win32_gc->hdc = CreateCompatibleDC (NULL)) == NULL)
|
||||
WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE;
|
||||
|
||||
if (ok && (win32_gc->saved_dc = SaveDC (win32_gc->hdc)) == 0)
|
||||
WIN32_GDI_FAILED ("SaveDC"), ok = FALSE;
|
||||
if (ok && (win32_gc->saved_dc = SaveDC (win32_gc->hdc)) == 0)
|
||||
WIN32_GDI_FAILED ("SaveDC"), ok = FALSE;
|
||||
|
||||
if (ok && SelectObject (win32_gc->hdc, win32_gc->hwnd) == NULL)
|
||||
WIN32_GDI_FAILED ("SelectObject"), ok = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((win32_gc->hdc = GetDC (win32_gc->hwnd)) == NULL)
|
||||
WIN32_GDI_FAILED ("GetDC");
|
||||
|
||||
if (ok && (win32_gc->saved_dc = SaveDC (win32_gc->hdc)) == 0)
|
||||
WIN32_GDI_FAILED ("SaveDC");
|
||||
}
|
||||
|
||||
if (ok && (usage & (GDK_GC_FOREGROUND | GDK_GC_BACKGROUND)))
|
||||
ok = predraw (gc, impl->colormap);
|
||||
|
||||
@ -1061,14 +1051,7 @@ gdk_win32_hdc_release (GdkDrawable *drawable,
|
||||
win32_gc, win32_gc->hdc,
|
||||
_gdk_win32_gcvalues_mask_to_string (usage)));
|
||||
|
||||
if (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable))
|
||||
impl = GDK_DRAWABLE_IMPL_WIN32(drawable);
|
||||
else if (GDK_IS_WINDOW (drawable))
|
||||
impl = GDK_DRAWABLE_IMPL_WIN32 ((GDK_WINDOW_OBJECT (drawable))->impl);
|
||||
else if (GDK_IS_PIXMAP (drawable))
|
||||
impl = GDK_DRAWABLE_IMPL_WIN32 ((GDK_PIXMAP_OBJECT (drawable))->impl);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
impl = get_impl_drawable (drawable);
|
||||
|
||||
if (win32_gc->holdpal != NULL)
|
||||
{
|
||||
@ -1094,10 +1077,7 @@ gdk_win32_hdc_release (GdkDrawable *drawable,
|
||||
|
||||
GDI_CALL (RestoreDC, (win32_gc->hdc, win32_gc->saved_dc));
|
||||
|
||||
if (GDK_IS_PIXMAP_IMPL_WIN32 (impl))
|
||||
GDI_CALL (DeleteDC, (win32_gc->hdc));
|
||||
else
|
||||
GDI_CALL (ReleaseDC, (win32_gc->hwnd, win32_gc->hdc));
|
||||
_gdk_win32_drawable_release_dc (GDK_DRAWABLE (impl));
|
||||
|
||||
if (hpen != NULL)
|
||||
GDI_CALL (DeleteObject, (hpen));
|
||||
|
@ -1,32 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkpango.h"
|
||||
#include <pango/pangowin32.h>
|
||||
|
||||
PangoContext *
|
||||
gdk_pango_context_get_for_screen (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (screen == gdk_screen_get_default (), NULL);
|
||||
|
||||
return pango_win32_get_context ();
|
||||
}
|
@ -108,6 +108,8 @@ gdk_pixmap_impl_win32_finalize (GObject *object)
|
||||
GDK_NOTE (PIXMAP, g_print ("gdk_pixmap_impl_win32_finalize: %p\n",
|
||||
GDK_PIXMAP_HBITMAP (wrapper)));
|
||||
|
||||
_gdk_win32_drawable_finish (GDK_DRAWABLE (object));
|
||||
|
||||
GDI_CALL (DeleteObject, (GDK_PIXMAP_HBITMAP (wrapper)));
|
||||
|
||||
gdk_win32_handle_table_remove (GDK_PIXMAP_HBITMAP (wrapper));
|
||||
|
@ -290,9 +290,6 @@ struct _GdkGCWin32
|
||||
HDC hdc;
|
||||
int saved_dc;
|
||||
|
||||
HANDLE hwnd; /* For which window, or what bitmap is
|
||||
* selected into it
|
||||
*/
|
||||
HPALETTE holdpal;
|
||||
};
|
||||
|
||||
|
@ -857,6 +857,8 @@ _gdk_windowing_window_destroy (GdkWindow *window,
|
||||
|
||||
if (!recursing && !foreign_destroy)
|
||||
{
|
||||
_gdk_win32_drawable_finish (private->impl);
|
||||
|
||||
private->destroyed = TRUE;
|
||||
DestroyWindow (GDK_WINDOW_HWND (window));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user