MS Windows engine: draw elements in the right place.
Work in progress, still remains to be solved the problem of clipping.
This commit is contained in:
committed by
Fridrich Štrba
parent
3b63ef0ac6
commit
e6da33a302
@ -900,66 +900,54 @@ get_window_dc (GtkStyle *style,
|
|||||||
gint x, gint y, gint width, gint height,
|
gint x, gint y, gint width, gint height,
|
||||||
RECT *rect_out)
|
RECT *rect_out)
|
||||||
{
|
{
|
||||||
#if 0
|
cairo_t *cr;
|
||||||
GdkDrawable *drawable = NULL;
|
cairo_surface_t *surface;
|
||||||
GdkGC *gc = style->dark_gc[state_type];
|
HDC dc;
|
||||||
gint x_offset, y_offset;
|
gint x_offset = 0, y_offset = 0;
|
||||||
|
double x_off, y_off;
|
||||||
|
|
||||||
|
dc_info_out->cr = NULL;
|
||||||
|
dc_info_out->dc = NULL;
|
||||||
|
|
||||||
dc_info_out->data = NULL;
|
cr = gdk_cairo_create (window);
|
||||||
|
if (!cr)
|
||||||
drawable = gdk_win32_begin_direct_draw_libgtk_only (window,
|
|
||||||
gc, &dc_info_out->data,
|
|
||||||
&x_offset, &y_offset);
|
|
||||||
if (!drawable)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
rect_out->left = x - x_offset;
|
surface = cairo_get_target (cr);
|
||||||
rect_out->top = y - y_offset;
|
cairo_surface_get_device_offset (surface, &x_off, &y_off);
|
||||||
rect_out->right = rect_out->left + width;
|
cairo_surface_flush (surface);
|
||||||
rect_out->bottom = rect_out->top + height;
|
|
||||||
|
|
||||||
dc_info_out->drawable = drawable;
|
dc = cairo_win32_surface_get_dc (surface);
|
||||||
dc_info_out->gc = gc;
|
if (!dc)
|
||||||
dc_info_out->x_offset = x_offset;
|
return NULL;
|
||||||
dc_info_out->y_offset = y_offset;
|
|
||||||
|
|
||||||
return gdk_win32_hdc_get (drawable, gc, 0);
|
x_offset = -x_off;
|
||||||
#else
|
y_offset = -y_off;
|
||||||
cairo_t *cr;
|
|
||||||
cairo_surface_t *crs;
|
|
||||||
gint x_offset, y_offset;
|
|
||||||
|
|
||||||
cr = gdk_cairo_create (window);
|
|
||||||
crs = cairo_get_target (cr);
|
|
||||||
x_offset = 0;
|
|
||||||
y_offset = 0;
|
|
||||||
|
|
||||||
|
|
||||||
dc_info_out->data = NULL;
|
|
||||||
|
|
||||||
rect_out->left = x - x_offset;
|
rect_out->left = x - x_offset;
|
||||||
rect_out->top = y - y_offset;
|
rect_out->top = y - y_offset;
|
||||||
rect_out->right = rect_out->left + width;
|
rect_out->right = rect_out->left + width;
|
||||||
rect_out->bottom = rect_out->top + height;
|
rect_out->bottom = rect_out->top + height;
|
||||||
|
|
||||||
dc_info_out->cr = cr;
|
dc_info_out->cr = cr;
|
||||||
|
dc_info_out->dc = dc;
|
||||||
dc_info_out->x_offset = x_offset;
|
dc_info_out->x_offset = x_offset;
|
||||||
dc_info_out->y_offset = y_offset;
|
dc_info_out->y_offset = y_offset;
|
||||||
|
|
||||||
return cairo_win32_surface_get_dc (crs);
|
return dc;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
release_window_dc (XpDCInfo *dc_info)
|
release_window_dc (XpDCInfo *dc_info)
|
||||||
{
|
{
|
||||||
#if 0
|
if (!dc_info->cr || !dc_info->dc)
|
||||||
gdk_win32_hdc_release (dc_info->drawable, dc_info->gc, 0);
|
return;
|
||||||
|
|
||||||
gdk_win32_end_direct_draw_libgtk_only (dc_info->data);
|
ReleaseDC (NULL, dc_info->dc);
|
||||||
#else
|
|
||||||
cairo_destroy (dc_info->cr);
|
cairo_destroy (dc_info->cr);
|
||||||
#endif
|
|
||||||
|
dc_info->cr = NULL;
|
||||||
|
dc_info->dc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -1014,7 +1002,7 @@ xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style,
|
|||||||
part_state, &rect, pClip);
|
part_state, &rect, pClip);
|
||||||
|
|
||||||
release_window_dc (&dc_info);
|
release_window_dc (&dc_info);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,19 +115,10 @@ typedef enum
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
GdkDrawable *drawable;
|
|
||||||
GdkGC *gc;
|
|
||||||
#else
|
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
cairo_surface_t *crs;
|
HDC dc;
|
||||||
#endif
|
|
||||||
|
|
||||||
gint x_offset;
|
gint x_offset;
|
||||||
gint y_offset;
|
gint y_offset;
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
gpointer data;
|
|
||||||
} XpDCInfo;
|
} XpDCInfo;
|
||||||
|
|
||||||
HDC get_window_dc (GtkStyle *style,
|
HDC get_window_dc (GtkStyle *style,
|
||||||
|
|||||||
Reference in New Issue
Block a user