carbon: fix improper pattern allocation, patch by Jonas Maebe

git-svn-id: trunk@25083 -
This commit is contained in:
dmitry 2010-04-30 20:25:00 +00:00
parent 93136076b1
commit 008ae9167f

View File

@ -1607,6 +1607,7 @@ var
RGBA: array[0..3] of Single; RGBA: array[0..3] of Single;
AROP2: Integer; AROP2: Integer;
APatternSpace: CGColorSpaceRef; APatternSpace: CGColorSpaceRef;
BaseSpace : CGColorSpaceRef;
begin begin
if ADC = nil then Exit; if ADC = nil then Exit;
if ADC.CGContext = nil then Exit; if ADC.CGContext = nil then Exit;
@ -1625,11 +1626,17 @@ begin
if FCGPattern <> nil then if FCGPattern <> nil then
begin begin
APatternSpace := CGColorSpaceCreatePattern(nil); if not FColored then
BaseSpace:=CGColorSpaceCreateDeviceRGB
else
begin
BaseSpace:=nil;
RGBA[0] := 1.0;
end;
APatternSpace := CGColorSpaceCreatePattern(BaseSpace);
CGContextSetFillColorSpace(ADC.CGContext, APatternSpace); CGContextSetFillColorSpace(ADC.CGContext, APatternSpace);
CGColorSpaceRelease(APatternSpace); CGColorSpaceRelease(APatternSpace);
if FColored then if Assigned(BaseSpace) then CGColorSpaceRelease(BaseSpace);
RGBA[0] := 1.0;
CGContextSetFillPattern(ADC.CGcontext, FCGPattern, @RGBA[0]); CGContextSetFillPattern(ADC.CGcontext, FCGPattern, @RGBA[0]);
end end
else else