Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: src/core/SkRasterClip.cpp

Issue 546113002: move rasterclip_ helper into rasterclip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRasterClip.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRasterClip.cpp
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index d1615a3445f6348fef5e3cf7cdd3d3a916fa8aa0..dab91d8f4ce31434af80839208961509e5746761 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -86,6 +86,39 @@ bool SkRasterClip::setPath(const SkPath& path, const SkRegion& clip, bool doAA)
return this->updateCacheAndReturnNonEmpty();
}
+bool SkRasterClip::op(const SkPath& path, const SkISize& size, SkRegion::Op op, bool doAA) {
+ // base is used to limit the size (and therefore memory allocation) of the
+ // region that results from scan converting devPath.
+ SkRegion base;
+
+ if (SkRegion::kIntersect_Op == op) {
+ // since we are intersect, we can do better (tighter) with currRgn's
+ // bounds, than just using the device. However, if currRgn is complex,
+ // our region blitter may hork, so we do that case in two steps.
+ if (this->isRect()) {
+ // FIXME: we should also be able to do this when this->isBW(),
+ // but relaxing the test above triggers GM asserts in
+ // SkRgnBuilder::blitH(). We need to investigate what's going on.
+ return this->setPath(path, this->bwRgn(), doAA);
+ } else {
+ base.setRect(this->getBounds());
+ SkRasterClip clip;
+ clip.setPath(path, base, doAA);
+ return this->op(clip, op);
+ }
+ } else {
+ base.setRect(0, 0, size.width(), size.height());
+
+ if (SkRegion::kReplace_Op == op) {
+ return this->setPath(path, base, doAA);
+ } else {
+ SkRasterClip clip;
+ clip.setPath(path, base, doAA);
+ return this->op(clip, op);
+ }
+ }
+}
+
bool SkRasterClip::setPath(const SkPath& path, const SkIRect& clip, bool doAA) {
SkRegion tmp;
tmp.setRect(clip);
« no previous file with comments | « src/core/SkRasterClip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698