fixed AV's getting pixel under gtk1, issue #2097

git-svn-id: trunk@9342 -
This commit is contained in:
jesus 2006-05-23 21:32:34 +00:00
parent 58e1fe7109
commit a39c2c3633
3 changed files with 11 additions and 8 deletions

View File

@ -6005,10 +6005,19 @@ begin
Image := gdk_drawable_get_image(aDC.Drawable,X,Y,1,1);
if Image = nil then exit;
{$ifdef Gtk1}
// previously gdk_image_get_colormap(image) was used, implementation
// was casting GdkImage to GdkWindow which is not valid and cause AVs
if gdk_window_get_type(PGdkWindow(aDC.Drawable))= GDK_WINDOW_PIXMAP then
colormap := nil // pixmaps are created with null colormap, get system one instead
else
colormap := gdk_window_get_colormap(PGdkWindow(aDC.Drawable));
{$else}
colormap := gdk_image_get_colormap(image);
if colormap = nil then
colormap := gdk_drawable_get_colormap(aDC.Drawable);
{$endif}
if colormap = nil then
colormap := gdk_colormap_get_system;
@ -7247,4 +7256,4 @@ end;
{$IFDEF ASSERT_IS_ON}
{$UNDEF ASSERT_IS_ON}
{$C-}
{$ENDIF}
{$ENDIF}

View File

@ -266,11 +266,6 @@ begin
gdk_window_unref(PGdkWindow(Image));
end;
Function gdk_image_get_colormap(Image : PGDKImage) : PGdkColormap;
begin
result := gdk_window_get_colormap(PGdkWindow(Image));
end;
Procedure gdk_colormap_query_color(colormap : PGDKColormap; Pixel : gulong; Result : PGDKColor);
var
GdkColorContext: PGdkColorContext;

View File

@ -836,7 +836,6 @@ function gtk_widget_get_ythickness(Style: PGTKWidget): gint; overload;
//routines to mimic similar GDK2 routines/behaviour-->
procedure gdk_image_unref(Image: PGdkImage);
Function gdk_image_get_colormap(Image: PGDKImage): PGdkColormap;
Procedure gdk_colormap_query_color(colormap: PGDKColormap; Pixel: gulong;
Result: PGDKColor);