bump product version to 7.6.3.2-android
[LibreOffice.git] / external / skia / windows-raster-surface-no-copies.patch.1
blob0c5804d8558bc6cf0e0203c19cbeee579316b068
1 diff --git a/tools/sk_app/win/RasterWindowContext_win.cpp b/tools/sk_app/win/RasterWindowContext_win.cpp
2 index 9548220ce6..49f1f9ed17 100644
3 --- a/tools/sk_app/win/RasterWindowContext_win.cpp
4 +++ b/tools/sk_app/win/RasterWindowContext_win.cpp
5 @@ -55,7 +55,7 @@ void RasterWindowContext_win::resize(int w, int h) {
6      fWidth = w;
7      fHeight = h;
8      fBackbufferSurface.reset();
9 -    const size_t bmpSize = sizeof(BITMAPINFOHEADER) + w * h * sizeof(uint32_t);
10 +    const size_t bmpSize = sizeof(BITMAPINFO);
11      fSurfaceMemory.reset(bmpSize);
12      BITMAPINFO* bmpInfo = reinterpret_cast<BITMAPINFO*>(fSurfaceMemory.get());
13      ZeroMemory(bmpInfo, sizeof(BITMAPINFO));
14 @@ -65,11 +65,12 @@ void RasterWindowContext_win::resize(int w, int h) {
15      bmpInfo->bmiHeader.biPlanes = 1;
16      bmpInfo->bmiHeader.biBitCount = 32;
17      bmpInfo->bmiHeader.biCompression = BI_RGB;
18 -    void* pixels = bmpInfo->bmiColors;
19 +    // Do not use a packed DIB bitmap, SkSurface_Raster::onNewImageSnapshot() does
20 +    // a deep copy if it does not own the pixels.
22      SkImageInfo info = SkImageInfo::Make(w, h, fDisplayParams.fColorType, kPremul_SkAlphaType,
23                                           fDisplayParams.fColorSpace);
24 -    fBackbufferSurface = SkSurface::MakeRasterDirect(info, pixels, sizeof(uint32_t) * w);
25 +    fBackbufferSurface = SkSurface::MakeRaster(info);
26  }
28  sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() { return fBackbufferSurface; }
29 @@ -77,7 +78,9 @@ sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() { return fBackb
30  void RasterWindowContext_win::swapBuffers() {
31      BITMAPINFO* bmpInfo = reinterpret_cast<BITMAPINFO*>(fSurfaceMemory.get());
32      HDC dc = GetDC(fWnd);
33 -    StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, bmpInfo->bmiColors, bmpInfo,
34 +    SkPixmap pixmap;
35 +    fBackbufferSurface->peekPixels(&pixmap);
36 +    StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, pixmap.addr(), bmpInfo,
37                    DIB_RGB_COLORS, SRCCOPY);
38      ReleaseDC(fWnd, dc);
39  }