aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-11-12 07:25:02 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-12 07:25:02 -0800
commit74576eba1440c092025d6557e08da50678599d4e (patch)
tree300956c00016dab541dfaee6cb0722db3c707c25 /src
parent4e8e3421aa919a82eb1dd287fecbd079f5a320b4 (diff)
Clean up CollectLayers code
Now that CollectLayers directly uses FillBounds we can: skip the explicit intersection with the clipBounds after an adjustAndMap call skip the storage and use of the clipBounds in SaveLayerInfo Review URL: https://codereview.chromium.org/719793002
Diffstat (limited to 'src')
-rw-r--r--src/core/SkRecordDraw.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 2a839a9576..9075e508f7 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -186,7 +186,6 @@ public:
unsigned currentOp() const { return fCurrentOp; }
const SkMatrix& ctm() const { return *fCTM; }
- const Bounds& currentClipBounds() const { return fCurrentClipBounds; }
const Bounds& getBounds(unsigned index) const { return fBounds[index]; }
// Adjust rect for all paints that may affect its geometry, then map it to identity space.
@@ -602,20 +601,17 @@ public:
private:
struct SaveLayerInfo {
SaveLayerInfo() { }
- SaveLayerInfo(int opIndex, bool isSaveLayer, const SkPaint* paint,
- const FillBounds::Bounds& clipBound)
+ SaveLayerInfo(int opIndex, bool isSaveLayer, const SkPaint* paint)
: fStartIndex(opIndex)
, fIsSaveLayer(isSaveLayer)
, fHasNestedSaveLayer(false)
- , fPaint(paint)
- , fClipBound(clipBound) {
+ , fPaint(paint) {
}
int fStartIndex;
bool fIsSaveLayer;
bool fHasNestedSaveLayer;
const SkPaint* fPaint;
- FillBounds::Bounds fClipBound;
};
template <typename T> void trackSaveLayers(const T& op) {
@@ -645,9 +641,8 @@ private:
for (int i = 0; i < childData->numSaveLayers(); ++i) {
const GrAccelData::SaveLayerInfo& src = childData->saveLayerInfo(i);
- FillBounds::Bounds newClip(fFillBounds.currentClipBounds());
-
- if (!newClip.intersect(fFillBounds.adjustAndMap(src.fBounds, dp.paint))) {
+ FillBounds::Bounds newBound = fFillBounds.adjustAndMap(src.fBounds, dp.paint);
+ if (newBound.isEmpty()) {
continue;
}
@@ -659,7 +654,7 @@ private:
// it belongs to a sub-picture.
dst.fPicture = src.fPicture ? src.fPicture : static_cast<const SkPicture*>(dp.picture);
dst.fPicture->ref();
- dst.fBounds = newClip;
+ dst.fBounds = newBound;
dst.fLocalMat = src.fLocalMat;
dst.fPreMat = src.fPreMat;
dst.fPreMat.postConcat(fFillBounds.ctm());
@@ -693,8 +688,7 @@ private:
++fSaveLayersInStack;
}
- fSaveLayerStack.push(SaveLayerInfo(fFillBounds.currentOp(), isSaveLayer, paint,
- fFillBounds.currentClipBounds()));
+ fSaveLayerStack.push(SaveLayerInfo(fFillBounds.currentOp(), isSaveLayer, paint));
}
void popSaveLayerInfo() {
@@ -717,7 +711,6 @@ private:
SkASSERT(NULL == slInfo.fPicture); // This layer is in the top-most picture
slInfo.fBounds = fFillBounds.getBounds(sli.fStartIndex);
- slInfo.fBounds.intersect(sli.fClipBound);
slInfo.fLocalMat = fFillBounds.ctm();
slInfo.fPreMat = SkMatrix::I();
if (sli.fPaint) {