diff options
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/gelimage.pas | 22 | ||||
-rw-r--r-- | gfx/gfxbase.pas | 2 | ||||
-rw-r--r-- | gfx/x11/gfx_x11.pas | 23 |
3 files changed, 27 insertions, 20 deletions
diff --git a/gfx/gelimage.pas b/gfx/gelimage.pas index 2a578e4e..d1318266 100644 --- a/gfx/gelimage.pas +++ b/gfx/gelimage.pas @@ -343,23 +343,13 @@ begin ftRGB24: begin ConvertToInternal := @ConvertRGB24ToInternal; - ParamsS2I.RedShiftR := 8 - - GetBitShiftAndCount(ASourceFormat.RedMask, ParamsS2I.RedShiftL); - ParamsS2I.GreenShiftR := 16 - - GetBitShiftAndCount(ASourceFormat.GreenMask, ParamsS2I.GreenShiftL); - ParamsS2I.BlueShiftR := 24 - - GetBitShiftAndCount(ASourceFormat.BlueMask, ParamsS2I.BlueShiftL); + SetupShifts(ASourceFormat, ParamsS2I); + end; + ftRGB32: + begin + ConvertToInternal := @ConvertRGB32ToInternal; + SetupShifts(ASourceFormat, ParamsS2I); end; - ftRGB32: - begin - ConvertToInternal := @ConvertRGB32ToInternal; - ParamsS2I.RedShiftR := 8 - - GetBitShiftAndCount(ASourceFormat.RedMask, ParamsS2I.RedShiftL); - ParamsS2I.GreenShiftR := 16 - - GetBitShiftAndCount(ASourceFormat.GreenMask, ParamsS2I.GreenShiftL); - ParamsS2I.BlueShiftR := 24 - - GetBitShiftAndCount(ASourceFormat.BlueMask, ParamsS2I.BlueShiftL); - end; else raise EGfxUnsupportedPixelFormat.Create(ASourceFormat); end; diff --git a/gfx/gfxbase.pas b/gfx/gfxbase.pas index be5a31fd..e474087d 100644 --- a/gfx/gfxbase.pas +++ b/gfx/gfxbase.pas @@ -206,7 +206,7 @@ const PixelFormatRGBA32: TGfxPixelFormat = ( FormatType: ftRGB32; - RedMask: $00ff00ff; + RedMask: $00ff0000; GreenMask: $0000ff00; BlueMask: $000000ff; AlphaMask: $ff000000); diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas index 862ea1e5..029be44e 100644 --- a/gfx/x11/gfx_x11.pas +++ b/gfx/x11/gfx_x11.pas @@ -727,9 +727,13 @@ var Image: XLib.PXImage; ConvertFormat: TGfxPixelFormat; begin + {$IFDEF VerboseFPGUI} + WriteLn('>: DoDrawImageRect'); + {$ENDIF} + + {$IFDEF VerboseFPGUI} ASSERT(AImage.InheritsFrom(TX11Bitmap)); - {$IFDEF Debug} - ASSERT(not TXImage(AImage).IsLocked); + ASSERT(not TX11Bitmap(AImage).IsLocked); {$ENDIF} // !!!: Add support for XF86 4 and XShm etc. to speed this up! @@ -738,7 +742,9 @@ begin ASourceRect.Right - ASourceRect.Left, ASourceRect.Bottom - ASourceRect.Top, 8, 0); -// WriteLn('Size allocated: ', Image^.bytes_per_line * (ASourceRect.Bottom - ASourceRect.Top) + 1); + {$IFDEF VerboseFPGUIp} + WriteLn('Size allocat for imageaed: ', Image^.bytes_per_line * (ASourceRect.Bottom - ASourceRect.Top) + 1); + {$ENDIF} { Here its necessary to alloc an extra byte, otherwise it will fail on 32-bits machines, but still work on 64-bits machines. The cause of this is unknown. } @@ -752,6 +758,13 @@ begin else begin ConvertFormat := PixelFormat; + + { !!!: The following is a workaround: At least the XFree86 X server for + ATI graphics adapters uses 32 bit padding per pixel for 24 bpp + images...?!? To be checked: Is this always the case or only for ATI? } +// if ConvertFormat.FormatType = ftRGB24 then +// ConvertFormat.FormatType := ftRGB32; + ConvertImage(ASourceRect, AImage.PixelFormat, AImage.Palette, TX11Bitmap(AImage).Data, TX11Bitmap(AImage).Stride, 0, 0, ConvertFormat, Image^.data, Image^.bytes_per_line); @@ -762,6 +775,10 @@ begin FreeMem(Image^.data); Image^.data := nil; XDestroyImage(Image); + + {$IFDEF VerboseFPGUI} + WriteLn('<: DoDrawImageRect'); + {$ENDIF} end; |