JBR-6696: fix drawableId usage + revert PrinterJob changes (non-appkit thread)

(cherry picked from commit 5229c513e3)
This commit is contained in:
Vitaly Provodin
2024-06-17 06:59:52 +04:00
committed by jbrbot
parent d6c4e36c5a
commit 73f87f722b
2 changed files with 8 additions and 10 deletions

View File

@@ -678,14 +678,8 @@ JNI_COCOA_ENTER(env);
jobject pageFormatArea = (*env)->CallObjectMethod(env, jthis, jm_getPageFormatArea, page); // AWT_THREADING Safe (!appKit)
CHECK_EXCEPTION();
NSRect rect = JavaToNSRect(env, pageFormatArea);
__block PrinterView *printerView = nil;
[ThreadUtilities performOnMainThreadWaiting:YES block:^() {
printerView = [[PrinterView alloc] initWithFrame:rect withEnv:env withPrinterJob:jthis];
[printerView setFirstPage:firstPage lastPage:lastPage];
}];
PrinterView* printerView = [[PrinterView alloc] initWithFrame:JavaToNSRect(env, pageFormatArea) withEnv:env withPrinterJob:jthis];
[printerView setFirstPage:firstPage lastPage:lastPage];
GET_NSPRINTINFO_METHOD_RETURN(NO)
NSPrintInfo* printInfo = (NSPrintInfo*)jlong_to_ptr((*env)->CallLongMethod(env, jthis, sjm_getNSPrintInfo)); // AWT_THREADING Safe (known object)

View File

@@ -254,9 +254,13 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
[blitEncoder endEncoding];
BOOL usePresentHandler = NO;
NSUInteger drawableId = -1;
if (@available(macOS 10.15.4, *)) {
usePresentHandler = YES;
if (TRACE_DISPLAY) {
drawableId = mtlDrawable.drawableID;
}
[self retain];
[mtlDrawable addPresentedHandler:^(id <MTLDrawable> drawable) {
// note: called anyway even if drawable.present() not called!
@@ -301,7 +305,7 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
if (TRACE_DISPLAY) {
J2dRlsTraceLn(J2D_TRACE_INFO,
"[%.6lf] MTLLayer.blitTexture: layer[%p] present drawable(%d)",
CACurrentMediaTime(), self, mtlDrawable.drawableID);
CACurrentMediaTime(), self, drawableId);
}
if (isDisplaySyncEnabled()) {
[commandBuf presentDrawable:mtlDrawable];
@@ -334,7 +338,7 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
if (TRACE_DISPLAY) {
J2dRlsTraceLn(J2D_TRACE_INFO,
"[%.6lf] MTLLayer.blitTexture: layer[%p] commit with drawable(%d)",
CACurrentMediaTime(), self, mtlDrawable.drawableID);
CACurrentMediaTime(), self, drawableId);
}
} @finally {
// try-finally block to ensure releasing the CPU fence: