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

Unified Diff: src/core/SkLiteDL.cpp

Issue 2255283002: Fast path translate() in SkCanvas and SkLiteDL. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: plumb translate() through to SkRecord too Created 4 years, 4 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 | « src/core/SkLiteDL.h ('k') | src/core/SkLiteRecorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLiteDL.cpp
diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp
index c634d4825a33a724fa230444fbe7e2466351eeaf..c3bf976a888d61e6abaac0293ccfc06fa26282d1 100644
--- a/src/core/SkLiteDL.cpp
+++ b/src/core/SkLiteDL.cpp
@@ -52,7 +52,7 @@ static void make_threadsafe(SkPath* path, SkMatrix* matrix) {
namespace {
#define TYPES(M) \
M(Save) M(Restore) M(SaveLayer) \
- M(Concat) M(SetMatrix) M(TranslateZ) \
+ M(Concat) M(SetMatrix) M(Translate) M(TranslateZ) \
M(ClipPath) M(ClipRect) M(ClipRRect) M(ClipRegion) \
M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawOval) M(DrawRRect) M(DrawDRRect) \
M(DrawAnnotation) M(DrawDrawable) M(DrawPicture) M(DrawShadowedPicture) \
@@ -115,6 +115,14 @@ namespace {
}
void makeThreadsafe() { make_threadsafe(nullptr, &matrix); }
};
+ struct Translate final : Op {
+ static const auto kType = Type::Translate;
+ Translate(SkScalar dx, SkScalar dy) : dx(dx), dy(dy) {}
+ SkScalar dx,dy;
+ void draw(SkCanvas* c, const SkMatrix&) {
+ c->translate(dx, dy);
+ }
+ };
struct TranslateZ final : Op {
static const auto kType = Type::TranslateZ;
TranslateZ(SkScalar dz) : dz(dz) {}
@@ -539,8 +547,9 @@ void SkLiteDL::saveLayer(const SkRect* bounds, const SkPaint* paint,
this->push<SaveLayer>(0, bounds, paint, backdrop, flags);
}
-void SkLiteDL:: concat(const SkMatrix& matrix) { this->push <Concat>(0, matrix); }
-void SkLiteDL::setMatrix(const SkMatrix& matrix) { this->push<SetMatrix>(0, matrix); }
+void SkLiteDL:: concat(const SkMatrix& matrix) { this->push <Concat>(0, matrix); }
+void SkLiteDL::setMatrix(const SkMatrix& matrix) { this->push<SetMatrix>(0, matrix); }
+void SkLiteDL::translate(SkScalar dx, SkScalar dy) { this->push<Translate>(0, dx, dy); }
void SkLiteDL::translateZ(SkScalar dz) { this->push<TranslateZ>(0, dz); }
void SkLiteDL::clipPath(const SkPath& path, SkRegion::Op op, bool aa) {
« no previous file with comments | « src/core/SkLiteDL.h ('k') | src/core/SkLiteRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698