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

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 1576083002: restore lost optimization when the shader can report const_in_y (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index e5b577a20c9bb15b6ce63b926ffadf09c922ada7..804c688320788eecb347ff1be37586ca57423def 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -99,6 +99,11 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo
SkBitmapProvider(fRawBitmap), rec, storage);
}
+static bool only_scale_and_translate(const SkMatrix& matrix) {
+ unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
+ return (matrix.getType() & ~mask) == 0;
+}
+
SkBitmapProcShader::BitmapProcShaderContext::BitmapProcShaderContext(const SkShader& shader,
const ContextRec& rec,
SkBitmapProcState* state)
@@ -109,6 +114,10 @@ SkBitmapProcShader::BitmapProcShaderContext::BitmapProcShaderContext(const SkSha
if (fState->fPixmap.isOpaque() && (255 == this->getPaintAlpha())) {
fFlags |= kOpaqueAlpha_Flag;
}
+
+ if (1 == fState->fPixmap.height() && only_scale_and_translate(this->getTotalInverse())) {
+ fFlags |= kConstInY32_Flag;
+ }
}
SkBitmapProcShader::BitmapProcShaderContext::~BitmapProcShaderContext() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698