diff options
author | mtklein <mtklein@chromium.org> | 2016-08-19 09:05:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-19 09:05:27 -0700 |
commit | cbdf007bc2eb85056a1a5c75c088202becba2d16 (patch) | |
tree | e5ad582ba81b2c6b113195f64ab584c8376567a1 /src/core/SkRecordDraw.cpp | |
parent | 68d952cf4061dc455d6a6040ce1e4625e4f2ab29 (diff) |
Fast path translate() in SkCanvas and SkLiteDL.
This adds didTranslate() so that SkLiteDL (and other canvas recorders)
can record the translate rather than the full concat.
It also adds a case to SkMatrix::preTranslate() to fast path
translate x translate -> translate (i.e. +=).
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255283002
Committed: https://skia.googlesource.com/skia/+/5fa47f4fd13b3158de4599414c86d17649c2dd1c
Misc bots failing in pictureimagefilter replay modes.
https://luci-milo.appspot.com/swarming/task/30b8e53f3a1f4f10/steps/dm/0/stdout
Problem is FMA vs. not.
CQ_INCLUDE_TRYBOTS=master.client.skia:
Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Fast-Trybot
Review-Url: https://codereview.chromium.org/2255283002
Diffstat (limited to 'src/core/SkRecordDraw.cpp')
-rw-r--r-- | src/core/SkRecordDraw.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp index dcfc0fbf90..4d27fb6968 100644 --- a/src/core/SkRecordDraw.cpp +++ b/src/core/SkRecordDraw.cpp @@ -83,6 +83,7 @@ DRAW(SaveLayer, saveLayer(SkCanvas::SaveLayerRec(r.bounds, r.saveLayerFlags))); DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); DRAW(Concat, concat(r.matrix)); +DRAW(Translate, translate(r.dx, r.dy)); DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa)); DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); @@ -241,11 +242,12 @@ private: SkMatrix ctm; }; - // Only Restore, SetMatrix, and Concat change the CTM. + // Only Restore, SetMatrix, Concat, and Translate change the CTM. template <typename T> void updateCTM(const T&) {} void updateCTM(const Restore& op) { fCTM = op.matrix; } void updateCTM(const SetMatrix& op) { fCTM = op.matrix; } void updateCTM(const Concat& op) { fCTM.preConcat(op.matrix); } + void updateCTM(const Translate& op) { fCTM.preTranslate(op.dx, op.dy); } // Most ops don't change the clip. template <typename T> void updateClipBounds(const T&) {} @@ -299,12 +301,13 @@ private: void trackBounds(const SetMatrix&) { this->pushControl(); } void trackBounds(const Concat&) { this->pushControl(); } + void trackBounds(const Translate&) { this->pushControl(); } + void trackBounds(const TranslateZ&) { this->pushControl(); } void trackBounds(const ClipRect&) { this->pushControl(); } void trackBounds(const ClipRRect&) { this->pushControl(); } void trackBounds(const ClipPath&) { this->pushControl(); } void trackBounds(const ClipRegion&) { this->pushControl(); } - void trackBounds(const TranslateZ&) { this->pushControl(); } // For all other ops, we can calculate and store the bounds directly now. template <typename T> void trackBounds(const T& op) { |