aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/debugger
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-25 17:32:26 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-25 17:32:26 +0000
commitd9ea09e1f29b303e6fa36079e99729d2951925b9 (patch)
tree15377de5dde5b8f19ac67f7dafce9250bcaac30b /src/utils/debugger
parent7111d463cee893a479280c7af41757e709e33ef5 (diff)
Consolidate SkCanvas matrix virtuals.
Remove didTranslate, didScale, didRotate & didSkew, and rely on didConcat instead. Subclasses can sniff the matrix type if they want to differentiate. (work in progress) R=reed@google.com, robertphillips@google.com Author: fmalita@chromium.org Review URL: https://codereview.chromium.org/203203004 git-svn-id: http://skia.googlecode.com/svn/trunk@13940 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils/debugger')
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp35
-rw-r--r--src/utils/debugger/SkDebugCanvas.h4
2 files changed, 14 insertions, 25 deletions
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 88bee505d8..b4813e4103 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -410,7 +410,20 @@ void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) {
}
void SkDebugCanvas::didConcat(const SkMatrix& matrix) {
- addDrawCommand(new SkConcatCommand(matrix));
+ switch (matrix.getType()) {
+ case SkMatrix::kTranslate_Mask:
+ this->addDrawCommand(new SkTranslateCommand(matrix.getTranslateX(),
+ matrix.getTranslateY()));
+ break;
+ case SkMatrix::kScale_Mask:
+ this->addDrawCommand(new SkScaleCommand(matrix.getScaleX(),
+ matrix.getScaleY()));
+ break;
+ default:
+ this->addDrawCommand(new SkConcatCommand(matrix));
+ break;
+ }
+
this->INHERITED::didConcat(matrix);
}
@@ -535,11 +548,6 @@ void SkDebugCanvas::willRestore() {
this->INHERITED::willRestore();
}
-void SkDebugCanvas::didRotate(SkScalar degrees) {
- addDrawCommand(new SkRotateCommand(degrees));
- this->INHERITED::didRotate(degrees);
-}
-
void SkDebugCanvas::willSave(SaveFlags flags) {
this->addDrawCommand(new SkSaveCommand(flags));
this->INHERITED::willSave(flags);
@@ -553,26 +561,11 @@ SkCanvas::SaveLayerStrategy SkDebugCanvas::willSaveLayer(const SkRect* bounds, c
return kNoLayer_SaveLayerStrategy;
}
-void SkDebugCanvas::didScale(SkScalar sx, SkScalar sy) {
- addDrawCommand(new SkScaleCommand(sx, sy));
- this->INHERITED::didScale(sx, sy);
-}
-
void SkDebugCanvas::didSetMatrix(const SkMatrix& matrix) {
addDrawCommand(new SkSetMatrixCommand(matrix));
this->INHERITED::didSetMatrix(matrix);
}
-void SkDebugCanvas::didSkew(SkScalar sx, SkScalar sy) {
- addDrawCommand(new SkSkewCommand(sx, sy));
- this->INHERITED::didSkew(sx, sy);
-}
-
-void SkDebugCanvas::didTranslate(SkScalar dx, SkScalar dy) {
- addDrawCommand(new SkTranslateCommand(dx, dy));
- this->INHERITED::didTranslate(dx, dy);
-}
-
void SkDebugCanvas::toggleCommand(int index, bool toggle) {
SkASSERT(index < fCommandVector.count());
fCommandVector[index]->setVisible(toggle);
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 1191a76110..ac3083e49b 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -234,10 +234,6 @@ protected:
virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
virtual void willRestore() SK_OVERRIDE;
- virtual void didTranslate(SkScalar, SkScalar) SK_OVERRIDE;
- virtual void didScale(SkScalar, SkScalar) SK_OVERRIDE;
- virtual void didRotate(SkScalar) SK_OVERRIDE;
- virtual void didSkew(SkScalar, SkScalar) SK_OVERRIDE;
virtual void didConcat(const SkMatrix&) SK_OVERRIDE;
virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;