impl clipping for GDI raster-handle

BUG=skia:

Change-Id: I66bbcd80853662d982b80e7e504f2b5ccedc055c
Reviewed-on: https://skia-review.googlesource.com/6967
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-01-12 14:18:39 -05:00 committed by Skia Commit-Bot
parent b621a35b43
commit 9e937af9bd

View File

@ -152,6 +152,10 @@ public:
#elif defined(WIN32)
static RECT toRECT(const SkIRect& r) {
return { r.left(), r.top(), r.right(), r.bottom() };
}
class GDIGraphicsPort : public GraphicsPort {
public:
GDIGraphicsPort(SkCanvas* canvas) : GraphicsPort(canvas) {}
@ -160,9 +164,7 @@ public:
HDC hdc = (HDC)fCanvas->accessTopRasterHandle();
COLORREF cr = RGB(SkColorGetR(c), SkColorGetG(c), SkColorGetB(c));// SkEndian_Swap32(c) >> 8;
SkIRect ir = r.round();
RECT rect = { ir.left(), ir.top(), ir.right(), ir.bottom() };
FillRect(hdc, &rect, CreateSolidBrush(cr));
FillRect(hdc, &toRECT(r.round()), CreateSolidBrush(cr));
// Assuming GDI wrote zeros for alpha, this will or-in 0xFF for alpha
SkPaint paint;
@ -242,13 +244,11 @@ public:
xf.eDy = ctm[SkMatrix::kMTransY];
SetWorldTransform(hdc, &xf);
#if 0
HRGN hrgn = CreateRectRgnIndirect(&skia::SkIRectToRECT(clip_bounds));
HRGN hrgn = CreateRectRgnIndirect(&toRECT(clip_bounds));
int result = SelectClipRgn(hdc, hrgn);
SkASSERT(result != ERROR);
result = DeleteObject(hrgn);
SkASSERT(result != 0);
#endif
}
};