41 GetClientRect(wnd, &
rect);
48 GetClientRect(fWnd, &
rect);
52void RasterWindowContext_win::resize(
int w,
int h) {
55 fBackbufferSurface.reset();
56 const size_t bmpSize =
sizeof(BITMAPINFOHEADER) +
w *
h *
sizeof(uint32_t);
57 fSurfaceMemory.reset(bmpSize);
58 BITMAPINFO* bmpInfo =
reinterpret_cast<BITMAPINFO*
>(fSurfaceMemory.get());
59 ZeroMemory(bmpInfo,
sizeof(BITMAPINFO));
60 bmpInfo->bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
61 bmpInfo->bmiHeader.biWidth =
w;
62 bmpInfo->bmiHeader.biHeight = -
h;
63 bmpInfo->bmiHeader.biPlanes = 1;
64 bmpInfo->bmiHeader.biBitCount = 32;
65 bmpInfo->bmiHeader.biCompression = BI_RGB;
66 void* pixels = bmpInfo->bmiColors;
69 fDisplayParams.fColorSpace);
73sk_sp<SkSurface> RasterWindowContext_win::getBackbufferSurface() {
return fBackbufferSurface; }
75void RasterWindowContext_win::onSwapBuffers() {
76 BITMAPINFO* bmpInfo =
reinterpret_cast<BITMAPINFO*
>(fSurfaceMemory.get());
78 StretchDIBits(dc, 0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight, bmpInfo->bmiColors, bmpInfo,
79 DIB_RGB_COLORS, SRCCOPY);
88 std::unique_ptr<WindowContext> ctx(
new RasterWindowContext_win(wnd,
params));
89 if (!ctx->isValid()) {
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
static constexpr bool SkToBool(const T &x)
virtual sk_sp< SkSurface > getBackbufferSurface()=0
virtual void setDisplayParams(const DisplayParams ¶ms)=0
virtual void resize(int w, int h)=0
virtual void onSwapBuffers()=0
const EmbeddedViewParams * params
sk_sp< SkBlender > blender SkRect rect
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
std::unique_ptr< WindowContext > MakeRasterForWin(HWND wnd, const DisplayParams ¶ms)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)