Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8252949: Shape clip should use identity transform for drawing clip spans
  • Loading branch information
aghaisas committed Sep 9, 2020
1 parent 2c50c0f commit 6cecbedbaeb84162f5cfd03d069c27e000409043
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLContext.m
@@ -45,6 +45,8 @@
{{-1.0, 1.0}, {0.0, 0.0}}
};

MTLTransform* tempTransform = nil;

@implementation MTLCommandBufferWrapper {
id<MTLCommandBuffer> _commandBuffer;
NSMutableArray * _pooledTextures;
@@ -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;
@@ -155,6 +159,8 @@ - (void)dealloc {
[_composite release];
[_paint release];
[_transform release];
[tempTransform release];
tempTransform = nil;
[_clip release];
[super dealloc];
}
@@ -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 {

0 comments on commit 6cecbed

Please sign in to comment.