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
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));
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 = SkSurfaces::WrapPixels(info, pixels, sizeof(uint32_t) * w);
25 + fBackbufferSurface = SkSurfaces::Raster(info);
28 sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() { return fBackbufferSurface; }
30 void RasterWindowContext_win::onSwapBuffers() {
31 BITMAPINFO* bmpInfo = reinterpret_cast<BITMAPINFO*>(fSurfaceMemory.get());
33 - StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, bmpInfo->bmiColors, bmpInfo,
34 - DIB_RGB_COLORS, SRCCOPY);
36 + fBackbufferSurface->peekPixels(&pixmap);
37 + StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, pixmap.addr(), bmpInfo,
38 + DIB_RGB_COLORS, SRCCOPY);