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

Commit c723f09

Browse files
Alexey UshakovArtem Bochkarev
Alexey Ushakov
and
Artem Bochkarev
committedJun 2, 2020
8242952: fixed MTLBlitLoops::replaceTextureRegion (add correct offset…
Co-authored-by: Artem Bochkarev <abochkarev@openjdk.org> Co-authored-by: add Artem Bochkarev <abochkarev@openjdk.org>
1 parent a403550 commit c723f09

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed
 

‎src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m

+7-5
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ void drawTex2Tex(MTLContext *mtlc,
175175
const int dh = dy2 - dy1;
176176

177177
const void * raster = srcInfo->rasBase;
178+
raster += srcInfo->bounds.y1*srcInfo->scanStride + srcInfo->bounds.x1*srcInfo->pixelStride;
179+
178180
id<MTLTexture> result = nil;
179181
if (rfi->permuteMap != NULL) {
180182
#if defined(__MAC_10_15) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_15
@@ -221,7 +223,7 @@ void drawTex2Tex(MTLContext *mtlc,
221223
srcBuf.height = dh;
222224
srcBuf.width = dw;
223225
srcBuf.rowBytes = srcInfo->scanStride;
224-
srcBuf.data = srcInfo->rasBase;
226+
srcBuf.data = raster;
225227

226228
vImage_Buffer destBuf;
227229
destBuf.height = dh;
@@ -354,22 +356,22 @@ jboolean clipDestCoords(
354356
return JNI_FALSE;
355357
}
356358
if (*dx1 < dcx1) {
357-
J2dTraceLn2(J2D_TRACE_VERBOSE, "\t\tdx1=%1.2f, will be clipped to %1.2f", *dx1, dcx1);
359+
J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdx1=%1.2f, will be clipped to %1.2f | sx1+=%d", *dx1, dcx1, (jint)((dcx1 - *dx1) * (sw/dw)));
358360
*sx1 += (jint)((dcx1 - *dx1) * (sw/dw));
359361
*dx1 = dcx1;
360362
}
361363
if (*dx2 > dcx2) {
362-
J2dTraceLn2(J2D_TRACE_VERBOSE, "\t\tdx2=%1.2f, will be clipped to %1.2f", *dx2, dcx2);
364+
J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdx2=%1.2f, will be clipped to %1.2f | sx2-=%d", *dx2, dcx2, (jint)((*dx2 - dcx2) * (sw/dw)));
363365
*sx2 -= (jint)((*dx2 - dcx2) * (sw/dw));
364366
*dx2 = dcx2;
365367
}
366368
if (*dy1 < dcy1) {
367-
J2dTraceLn2(J2D_TRACE_VERBOSE, "\t\tdy1=%1.2f, will be clipped to %1.2f", *dy1, dcy1);
369+
J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdy1=%1.2f, will be clipped to %1.2f | sy1+=%d", *dy1, dcy1, (jint)((dcy1 - *dy1) * (sh/dh)));
368370
*sy1 += (jint)((dcy1 - *dy1) * (sh/dh));
369371
*dy1 = dcy1;
370372
}
371373
if (*dy2 > dcy2) {
372-
J2dTraceLn2(J2D_TRACE_VERBOSE, "\t\tdy2=%1.2f, will be clipped to %1.2f", *dy2, dcy2);
374+
J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdy2=%1.2f, will be clipped to %1.2f | sy2-=%d", *dy2, dcy2, (jint)((*dy2 - dcy2) * (sh/dh)));
373375
*sy2 -= (jint)((*dy2 - dcy2) * (sh/dh));
374376
*dy2 = dcy2;
375377
}

‎src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLUtils.m

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include <jni.h>
44
#include <simd/simd.h>
5+
#import <ThreadUtilities.h>
6+
#import <PropertiesUtilities.h>
57
#include "common.h"
68
#include "Trace.h"
79

@@ -45,3 +47,13 @@ void tracePoints(jint nPoints, jint *xPoints, jint *yPoints) {
4547
for (int i = 0; i < nPoints; i++)
4648
J2dTraceImpl(J2D_TRACE_INFO, JNI_TRUE, "\t(%d, %d)", *(xPoints++), *(yPoints++));
4749
}
50+
51+
52+
jboolean isOptionEnabled(const char * option) {
53+
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
54+
55+
NSString * optionProp = [PropertiesUtilities
56+
javaSystemPropertyForKey:[NSString stringWithUTF8String:option] withEnv:env];
57+
NSString * lowerCaseProp = [optionProp localizedLowercaseString];
58+
return [@"true" isEqual:lowerCaseProp];
59+
}

0 commit comments

Comments
 (0)