Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit

Permalink
8252949: Shape clip should use identity transform for drawing clip spans
Browse files Browse the repository at this point in the history
  • Loading branch information
aghaisas committed Sep 9, 2020
1 parent 2c50c0f commit 6cecbed
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
{{-1.0, 1.0}, {0.0, 0.0}}
};

MTLTransform* tempTransform = nil;

@implementation MTLCommandBufferWrapper {
id<MTLCommandBuffer> _commandBuffer;
NSMutableArray * _pooledTextures;
Expand Down Expand Up @@ -137,6 +139,8 @@ - (id)initWithDevice:(id<MTLDevice>)d shadersLib:(NSString*)shadersLib {
commandQueue = [device newCommandQueue];
blitCommandQueue = [device newCommandQueue];

tempTransform = [[MTLTransform alloc] init];

initSamplers(device);
}
return self;
Expand All @@ -155,6 +159,8 @@ - (void)dealloc {
[_composite release];
[_paint release];
[_transform release];
[tempTransform release];
tempTransform = nil;
[_clip release];
[super dealloc];
}
Expand Down Expand Up @@ -238,11 +244,19 @@ - (void)setClipRectX1:(jint)x1 Y1:(jint)y1 X2:(jint)x2 Y2:(jint)y2 {
- (void)beginShapeClip:(BMTLSDOps *)dstOps {
J2dTraceLn(J2D_TRACE_INFO, "MTLContext.beginShapeClip");
[_clip beginShapeClip:dstOps context:self];

// Store the current transform as we need to use identity transform
// for clip spans rendering
[tempTransform copyFrom:_transform];
[self resetTransform];
}

- (void)endShapeClip:(BMTLSDOps *)dstOps {
J2dTraceLn(J2D_TRACE_INFO, "MTLContext.endShapeClip");
[_clip endShapeClip:dstOps context:self];

// Reset transform for further rendering
[_transform copyFrom:tempTransform];
}

- (void)resetComposite {
Expand Down

0 comments on commit 6cecbed

Please sign in to comment.