diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /external/skia/windows-raster-surface-no-copies.patch.1 | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
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.1 | 41 |
1 files changed, 41 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 0000000000..3765f70971 --- /dev/null +++ b/external/skia/windows-raster-surface-no-copies.patch.1 @@ -0,0 +1,41 @@ +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 +@@ -53,7 +53,7 @@ + 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)); +@@ -63,11 +63,12 @@ + 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 = SkSurfaces::WrapPixels(info, pixels, sizeof(uint32_t) * w); ++ fBackbufferSurface = SkSurfaces::Raster(info); + } + + sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() { return fBackbufferSurface; } +@@ -75,8 +76,10 @@ + void RasterWindowContext_win::onSwapBuffers() { + BITMAPINFO* bmpInfo = reinterpret_cast<BITMAPINFO*>(fSurfaceMemory.get()); + HDC dc = GetDC(fWnd); +- StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, bmpInfo->bmiColors, bmpInfo, +- DIB_RGB_COLORS, SRCCOPY); ++ 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); + } + |