Implement SkCanvasGlue::clipRegion() using clipPath().
(Canvas clipRegion() public API is scheduled for deprecation) The SkCanvas clip stack does not support clipRegion() ops. Implementing these in terms of clipPath() makes persisting clips for SaveFlags emulation purposes a whole lot simpler. Change-Id: I41d1eb9e292ce370fba224338f9071d5e4068621
This commit is contained in:
@@ -298,7 +298,16 @@ public:
|
||||
jlong deviceRgnHandle, jint op) {
|
||||
SkCanvas* canvas = getNativeCanvas(canvasHandle);
|
||||
SkRegion* deviceRgn = reinterpret_cast<SkRegion*>(deviceRgnHandle);
|
||||
canvas->clipRegion(*deviceRgn, static_cast<SkRegion::Op>(op));
|
||||
SkPath rgnPath;
|
||||
if (deviceRgn->getBoundaryPath(&rgnPath)) {
|
||||
// The region is specified in device space.
|
||||
SkMatrix savedMatrix = canvas->getTotalMatrix();
|
||||
canvas->resetMatrix();
|
||||
canvas->clipPath(rgnPath, static_cast<SkRegion::Op>(op));
|
||||
canvas->setMatrix(savedMatrix);
|
||||
} else {
|
||||
canvas->clipRect(SkRect::MakeEmpty(), static_cast<SkRegion::Op>(op));
|
||||
}
|
||||
return hasNonEmptyClip(*canvas);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user