summaryrefslogtreecommitdiffstats
path: root/external/skia/windows-raster-surface-no-copies.patch.1
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/skia/windows-raster-surface-no-copies.patch.1
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/skia/windows-raster-surface-no-copies.patch.1')
-rw-r--r--external/skia/windows-raster-surface-no-copies.patch.139
1 files changed, 39 insertions, 0 deletions
diff --git a/external/skia/windows-raster-surface-no-copies.patch.1 b/external/skia/windows-raster-surface-no-copies.patch.1
new file mode 100644
index 000000000..0c5804d85
--- /dev/null
+++ b/external/skia/windows-raster-surface-no-copies.patch.1
@@ -0,0 +1,39 @@
+diff --git a/tools/sk_app/win/RasterWindowContext_win.cpp b/tools/sk_app/win/RasterWindowContext_win.cpp
+index 9548220ce6..49f1f9ed17 100644
+--- a/tools/sk_app/win/RasterWindowContext_win.cpp
++++ b/tools/sk_app/win/RasterWindowContext_win.cpp
+@@ -55,7 +55,7 @@ void RasterWindowContext_win::resize(int w, int h) {
+ fWidth = w;
+ fHeight = h;
+ fBackbufferSurface.reset();
+- const size_t bmpSize = sizeof(BITMAPINFOHEADER) + w * h * sizeof(uint32_t);
++ const size_t bmpSize = sizeof(BITMAPINFO);
+ fSurfaceMemory.reset(bmpSize);
+ BITMAPINFO* bmpInfo = reinterpret_cast<BITMAPINFO*>(fSurfaceMemory.get());
+ ZeroMemory(bmpInfo, sizeof(BITMAPINFO));
+@@ -65,11 +65,12 @@ void RasterWindowContext_win::resize(int w, int h) {
+ bmpInfo->bmiHeader.biPlanes = 1;
+ bmpInfo->bmiHeader.biBitCount = 32;
+ bmpInfo->bmiHeader.biCompression = BI_RGB;
+- void* pixels = bmpInfo->bmiColors;
++ // Do not use a packed DIB bitmap, SkSurface_Raster::onNewImageSnapshot() does
++ // a deep copy if it does not own the pixels.
+
+ SkImageInfo info = SkImageInfo::Make(w, h, fDisplayParams.fColorType, kPremul_SkAlphaType,
+ fDisplayParams.fColorSpace);
+- fBackbufferSurface = SkSurface::MakeRasterDirect(info, pixels, sizeof(uint32_t) * w);
++ fBackbufferSurface = SkSurface::MakeRaster(info);
+ }
+
+ sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() { return fBackbufferSurface; }
+@@ -77,7 +78,9 @@ sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() { return fBackb
+ void RasterWindowContext_win::swapBuffers() {
+ BITMAPINFO* bmpInfo = reinterpret_cast<BITMAPINFO*>(fSurfaceMemory.get());
+ HDC dc = GetDC(fWnd);
+- StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, bmpInfo->bmiColors, bmpInfo,
++ SkPixmap pixmap;
++ fBackbufferSurface->peekPixels(&pixmap);
++ StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, pixmap.addr(), bmpInfo,
+ DIB_RGB_COLORS, SRCCOPY);
+ ReleaseDC(fWnd, dc);
+ }