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

Unified Diff: src/core/SkCanvas.cpp

Issue 2296703003: test dont-clip-layer (Closed)
Patch Set: update gm bounds Created 4 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 | « gm/aaclip.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ce18c0b65d9b40ed067e4c62930e6f16d5e8c758..a543a5cc5b667ada6e2241e58d49dead7b97ca51 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -314,6 +314,11 @@ public:
}
};
+static SkIRect compute_device_bounds(SkBaseDevice* device) {
+ return SkIRect::MakeXYWH(device->getOrigin().x(), device->getOrigin().y(),
+ device->width(), device->height());
+}
+
class SkDrawIter : public SkDraw {
public:
SkDrawIter(SkCanvas* canvas) {
@@ -322,9 +327,27 @@ public:
fClipStack = canvas->fClipStack;
fCurrLayer = canvas->fMCRec->fTopLayer;
+
+ fMultiDeviceCS = nullptr;
+ if (fCurrLayer->fNext) {
+ fMultiDeviceCS = canvas->fClipStack;
+ fMultiDeviceCS->save();
+ }
+ }
+
+ ~SkDrawIter() {
+ if (fMultiDeviceCS) {
+ fMultiDeviceCS->restore();
+ }
}
bool next() {
+ if (fMultiDeviceCS && fDevice) {
+ // remove the previous device's bounds
+ fMultiDeviceCS->clipDevRect(compute_device_bounds(fDevice),
+ SkRegion::kDifference_Op);
+ }
+
// skip over recs with empty clips
while (fCurrLayer && fCurrLayer->fClip.isEmpty()) {
fCurrLayer = fCurrLayer->fNext;
@@ -360,6 +383,7 @@ public:
private:
const DeviceCM* fCurrLayer;
const SkPaint* fPaint; // May be null.
+ SkClipStack* fMultiDeviceCS;
typedef SkDraw INHERITED;
};
@@ -1047,11 +1071,7 @@ void SkCanvas::internalSave() {
}
bool SkCanvas::BoundsAffectsClip(SaveLayerFlags saveLayerFlags) {
-#ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
return !(saveLayerFlags & SkCanvas::kDontClipToLayer_PrivateSaveLayerFlag);
-#else
- return true;
-#endif
}
bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlags,
@@ -1168,10 +1188,6 @@ void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra
const SkPaint* paint = rec.fPaint;
SaveLayerFlags saveLayerFlags = rec.fSaveLayerFlags;
-#ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
- saveLayerFlags &= ~kDontClipToLayer_PrivateSaveLayerFlag;
-#endif
-
SkLazyPaint lazyP;
SkImageFilter* imageFilter = paint ? paint->getImageFilter() : NULL;
SkMatrix stashedMatrix = fMCRec->fMatrix;
« no previous file with comments | « gm/aaclip.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698