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

Unified Diff: src/core/SkCanvas.cpp

Issue 14474002: path ops : make it real (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « include/core/SkCanvas.h ('k') | src/pathops/SkOpEdgeBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
===================================================================
--- src/core/SkCanvas.cpp (revision 8821)
+++ src/core/SkCanvas.cpp (working copy)
@@ -15,6 +15,7 @@
#include "SkDrawFilter.h"
#include "SkDrawLooper.h"
#include "SkMetaData.h"
+#include "SkPathOps.h"
#include "SkPicture.h"
#include "SkRasterClip.h"
#include "SkRRect.h"
@@ -508,6 +509,7 @@
fLocalBoundsCompareType.setEmpty();
fLocalBoundsCompareTypeDirty = true;
fAllowSoftClip = true;
+ fAllowSimplifyClip = false;
fDeviceCMDirty = false;
fSaveLayerCount = 0;
fMetaData = NULL;
@@ -1241,6 +1243,35 @@
// if we called path.swap() we could avoid a deep copy of this path
fClipStack.clipDevPath(devPath, op, doAA);
+ if (fAllowSimplifyClip) {
+ devPath.reset();
+ devPath.setFillType(SkPath::kInverseEvenOdd_FillType);
+ const SkClipStack* clipStack = getClipStack();
+ SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart);
+ const SkClipStack::Element* element;
+ while ((element = iter.next())) {
+ SkClipStack::Element::Type type = element->getType();
+ if (type == SkClipStack::Element::kEmpty_Type) {
+ continue;
+ }
+ SkPath operand;
+ if (type == SkClipStack::Element::kRect_Type) {
+ operand.addRect(element->getRect());
+ } else if (type == SkClipStack::Element::kPath_Type) {
+ operand = element->getPath();
+ } else {
+ SkDEBUGFAIL("Unexpected type.");
+ }
+ SkRegion::Op elementOp = element->getOp();
+ if (elementOp == SkRegion::kReplace_Op) {
+ devPath = operand;
+ } else {
+ Op(devPath, operand, (SkPathOp) elementOp, &devPath);
+ }
+ }
+ op = SkRegion::kReplace_Op;
+ }
+
return clipPathHelper(this, fMCRec->fRasterClip, devPath, op, doAA);
}
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/pathops/SkOpEdgeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698