office-gobmx/external/skia/windows-raster-surface-no-copies.patch.1
Noel Grandin f8c15850db update skia to m116
(from m111)

SK_SUPPORT_GPU is now SK_GANESH

GR_OP_ALLOCATE_USE_NEW was removed in skia m111
    commit dd8f8ed3848cbe2032edc7ec08ef648a23e28ad9
    Author: Mike Klein <mtklein@google.com>
    Date:   Thu Apr 22 12:17:33 2021 -0500
    clean up defines that do nothing

the fast-png-write patch was removed. The underlying helper
function we need was removed in
    commit 0ec4c84abd0b578a5c792b04b56653cbc325530e
    Author: Kevin Lubick <kjlubick@google.com>
    Date:   Thu Apr 20 14:46:28 2023 -0400
    Remove SkImageEncoder and SkImage::encodeToData
So I updated our dump() function in SkiaHelper.cxx to
use the new Skia API.

The constexpr-template patch seems to be superceded by skia
changes.

SkOpts: :hash_fn has been replaced with SkChecksum::Hash32
    commit 657ed9cf2379a950b925cb2aba7c85d6e1dd36ed
    Author: Brian Osman <brianosman@google.com>
    Date:   Tue May 23 12:40:12 2023 +0000
    Reland "Replace SkOpts::hash/hash_fn with SkChecksum::Hash32"

The SkDebugf function needs to be exported from the library since
it leaks out to calling code via some of the headers.

Change-Id: I80ace8f25e660fa7889d22ef90676f47264d866c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154223
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-10 12:44:38 +02:00

41 lines
1.9 KiB
Groff

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);
}