[Libreoffice-bugs] [Bug 137468] Severe performance degradation on a macOS with 10-bit displays
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Fri Oct 23 13:09:10 UTC 2020
https://bugs.documentfoundation.org/show_bug.cgi?id=137468
--- Comment #37 from Leo Wang <ilford at gmail.com> ---
Corrected patch. :-(
---
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 8058b68378b6..165e704dbeb9 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -134,6 +134,7 @@ class AquaSalGraphics : public SalGraphics
{
CGLayerHolder maLayer; // Quartz graphics layer
CGContextHolder maContextHolder; // Quartz drawing context
+ CGContextHolder maCSContextHolder; // Quartz drawing context considering
the color space
XorEmulation* mpXorEmulation;
int mnXorMode; // 0: off 1: on 2:
invert only
diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index 426aea29dc78..3521dac35def 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -120,6 +120,7 @@ bool AquaSalGraphics::CheckContext()
CGContextRelease(maContextHolder.get());
}
maContextHolder.set(nullptr);
+ maCSContextHolder.set(nullptr);
maLayer.set(nullptr);
}
@@ -134,13 +135,18 @@ bool AquaSalGraphics::CheckContext()
const int nBytesPerRow = (nBitmapDepth * nScaledWidth) / 8;
void* pRawData = std::malloc(nBytesPerRow * nScaledHeight);
- const int nFlags = kCGImageAlphaNoneSkipFirst;
+ int nFlags = kCGImageAlphaNoneSkipFirst |
kCGBitmapByteOrder32Host;
CGContextHolder aContextHolder(CGBitmapContextCreate(
pRawData, nScaledWidth, nScaledHeight, 8, nBytesPerRow,
GetSalData()->mxRGBSpace, nFlags));
maLayer.set(CGLayerCreateWithContext(aContextHolder.get(),
aLayerSize, nullptr));
maLayer.setScale(fScale);
+ pRawData = std::malloc(nBytesPerRow * nScaledHeight);
+ nFlags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
+ maCSContextHolder.set(CGBitmapContextCreate(
+ pRawData, nScaledWidth, nScaledHeight, 8, nBytesPerRow,
GetSalData()->mxRGBSpace, nFlags));
+
CGContextRef xDrawContext = CGLayerGetContext(maLayer.get());
maContextHolder = xDrawContext;
@@ -217,8 +223,13 @@ void AquaSalGraphics::UpdateWindow( NSRect& )
const CGSize aSize = maLayer.getSizePoints();
const CGRect aRect = CGRectMake(0, 0, aSize.width, aSize.height);
-
- CGContextDrawLayerInRect(rCGContextHolder.get(), aRect,
maLayer.get());
+ const CGRect xRect = { CGPointZero, maLayer.getSizePixels() };
+ CGContextDrawLayerInRect(maCSContextHolder.get(), xRect,
maLayer.get());
+ CGImageRef img = CGBitmapContextCreateImage(maCSContextHolder.get());
+ CGImageRef displayColorSpaceImage =
CGImageCreateCopyWithColorSpace(img,
CGDisplayCopyColorSpace(CGMainDisplayID()));
+ CGContextDrawImage(rCGContextHolder.get(), aRect,
displayColorSpaceImage);
+ CGImageRelease(img);
+ CGImageRelease(displayColorSpaceImage);
rCGContextHolder.restoreState();
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20201023/bb2fee10/attachment.htm>
More information about the Libreoffice-bugs
mailing list