mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 10:09:32 +02:00
* gtk pixbuf from drawable: don't pass system colormap as default
git-svn-id: trunk@12910 -
This commit is contained in:
parent
8f6cfd5bea
commit
d8e27704a6
lcl/interfaces/gtk
@ -5769,7 +5769,7 @@ end;
|
||||
{-------------------------------------------------------------------------------
|
||||
method CreatePixbufFromDrawable
|
||||
Params: ASource: The source drawable
|
||||
AColorMap: The colormap to use
|
||||
AColorMap: The colormap to use, when nil a matching colormap is passed
|
||||
AIncludeAplha: If set, the resulting pixmap has an alpha channel
|
||||
ASrcX, ASrcY: Offset within the source
|
||||
ADstX, ADstY: Offset within destination
|
||||
@ -5798,18 +5798,23 @@ begin
|
||||
then Pixbuf := gdk_pixbuf_new(GDK_COLORSPACE_RGB, True, 8, AWidth, AHeight)
|
||||
else Pixbuf := nil;
|
||||
|
||||
{$ifdef gtk1}
|
||||
// gtk1 requires always a colormap and fails when none passed
|
||||
// gtk2 fails when the depth of a colormap depth is different than the drawable
|
||||
// depth. It wil use the correct system map when none passed
|
||||
if AColorMap = nil
|
||||
// gtk2 fails when the colormap depth is different than the drawable depth.
|
||||
// It wil use the correct system map when none passed.
|
||||
// Bitmaps (depth = 1) don't need a colormap
|
||||
{$ifdef gtk1}
|
||||
if AColormap = nil
|
||||
then AColorMap := gdk_colormap_get_system;
|
||||
{$else}
|
||||
if (AColorMap = nil)
|
||||
and (gdk_drawable_get_depth(ASource) > 1)
|
||||
and (gdk_drawable_get_colormap(ASource) = nil)
|
||||
then AColorMap := gdk_colormap_get_system;
|
||||
{$endif}
|
||||
Result := gdk_pixbuf_get_from_drawable(Pixbuf, ASource, AColorMap, ASrcX, ASrcY, ADstX, ADstY, AWidth, AHeight);
|
||||
|
||||
if CanRequestAlpha then Exit; // we're done
|
||||
if not AIncludeAplha then Exit;
|
||||
|
||||
|
||||
pixbuf := gdk_pixbuf_add_alpha(Result, false, guchar(0),guchar(0),guchar(0));
|
||||
gdk_pixbuf_unref(Result);
|
||||
|
@ -1990,7 +1990,7 @@ var
|
||||
pixels: pguchar;
|
||||
begin
|
||||
// create pixbuf with alpha channel first
|
||||
Pixbuf := CreatePixbufFromDrawable(ADrawable, gdk_colormap_get_system, True, ARect.Left, ARect.Top, 0, 0, ADesc.Width, ADesc.Height);
|
||||
Pixbuf := CreatePixbufFromDrawable(ADrawable, nil, True, ARect.Left, ARect.Top, 0, 0, ADesc.Width, ADesc.Height);
|
||||
try
|
||||
pixels := gdk_pixbuf_get_pixels(Pixbuf);
|
||||
|
||||
@ -2519,7 +2519,7 @@ var
|
||||
|
||||
Result := ScalePixmapAndMask(GC, ScaleMethod,
|
||||
SrcPixmap, XSrc, YSrc, SrcWidth, SrcHeight,
|
||||
gdk_colormap_get_system, SrcMaskBitmap,
|
||||
nil, SrcMaskBitmap,
|
||||
Width, Height, TempPixmap, TempMaskBitmap);
|
||||
if not Result
|
||||
then DebugLn('WARNING: ScaleAndROP ScalePixmap for pixmap failed');
|
||||
|
Loading…
Reference in New Issue
Block a user