From b24f96de7b6f8aae1e9005f49d3ce5fc8e1c70c6 Mon Sep 17 00:00:00 2001 From: jesusr Date: Fri, 23 Nov 2007 07:43:29 +0000 Subject: [PATCH] fixes compilation and prepares gtkroutines for gtk post 0.9.24 git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@287 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rgbgraphics/rgbgtkroutines.pas | 22 +++++++++++++++++++--- components/rgbgraphics/rgbtypes.pas | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/components/rgbgraphics/rgbgtkroutines.pas b/components/rgbgraphics/rgbgtkroutines.pas index 966c55371..28ecb612e 100644 --- a/components/rgbgraphics/rgbgtkroutines.pas +++ b/components/rgbgraphics/rgbgtkroutines.pas @@ -54,13 +54,21 @@ procedure WidgetSetDrawRGB32Bitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY, S var P: TPoint; begin - P := GetDCOffset(TDeviceContext(Dest)); + {$IFDEF GTK_POST_0924} + P := TGtkDeviceContext(Dest).Offset; + Inc(DstX, P.X); + Inc(DstY, P.Y); + gdk_draw_rgb_32_image(TGtkDeviceContext(Dest).Drawable, TGtkDeviceContext(Dest).GC, + DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE, + Pguchar(Bitmap.GetPixelPtrUnsafe(SrcX, SrcY)), Bitmap.RowPixelStride shl 2); + {$ELSE} + P := GetDCOffset(TGtkDeviceContext(Dest)); Inc(DstX, P.X); Inc(DstY, P.Y); - gdk_draw_rgb_32_image(TDeviceContext(Dest).Drawable, TDeviceContext(Dest).GC, DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE, Pguchar(Bitmap.GetPixelPtrUnsafe(SrcX, SrcY)), Bitmap.RowPixelStride shl 2); + {$ENDIF} end; procedure WidgetSetDrawRGB8Bitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY, @@ -68,13 +76,21 @@ procedure WidgetSetDrawRGB8Bitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY, var P: TPoint; begin + {$IFDEF GTK_POST_0924} + P := TGtkDeviceContext(Dest).Offset; + Inc(DstX, P.X); + Inc(DstY, P.Y); + gdk_draw_gray_image(TGtkDeviceContext(Dest).Drawable, TGtkDeviceContext(Dest).GC, + DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE, + Pguchar(Bitmap.Get8PixelPtrUnsafe(SrcX, SrcY)), Bitmap.RowPixelStride); + {$ELSE} P := GetDCOffset(TDeviceContext(Dest)); Inc(DstX, P.X); Inc(DstY, P.Y); - gdk_draw_gray_image(TDeviceContext(Dest).Drawable, TDeviceContext(Dest).GC, DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE, Pguchar(Bitmap.Get8PixelPtrUnsafe(SrcX, SrcY)), Bitmap.RowPixelStride); + {$ENDIF} end; initialization diff --git a/components/rgbgraphics/rgbtypes.pas b/components/rgbgraphics/rgbtypes.pas index f004e6736..23fcfac54 100644 --- a/components/rgbgraphics/rgbtypes.pas +++ b/components/rgbgraphics/rgbtypes.pas @@ -558,7 +558,7 @@ begin SwapInt(FWidth, ABitmap.FWidth); SwapInt(FHeight, ABitmap.FHeight); SwapInt(FRowPixelStride, ABitmap.FRowPixelStride); - SwapInt(FSizeOfPixel, ABitmap.SizeOfPixel); + SwapInt(FSizeOfPixel, ABitmap.FSizeOfPixel); end; function TRGBBitmapCore.GetPixelPtrUnsafe(X, Y: Integer): PRGBPixel;