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

Unified Diff: gm/shaderbounds.cpp

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 6 years, 8 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 | « gm/mixedxfermodes.cpp ('k') | gm/shadertext2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/shaderbounds.cpp
diff --git a/gm/shaderbounds.cpp b/gm/shaderbounds.cpp
index ef9a7e9015e3b042c5804a93c10261136db0832e..2a52ead04ba4ba2ac530beb4539f99800c25c1c1 100644
--- a/gm/shaderbounds.cpp
+++ b/gm/shaderbounds.cpp
@@ -9,7 +9,8 @@
namespace skiagm {
-static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate) {
+static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate,
+ const SkMatrix& localMatrix) {
SkPoint pts[2] = { {0, 0}, {width, height}};
SkColor colors[2] = {SK_ColorRED, SK_ColorGREEN};
if (alternate) {
@@ -18,7 +19,7 @@ static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate) {
colors[1] = SK_ColorYELLOW;
}
return SkGradientShader::CreateLinear(pts, colors, NULL, 2,
- SkShader::kClamp_TileMode, NULL);
+ SkShader::kClamp_TileMode, NULL, 0, &localMatrix);
}
///////////////////////////////////////////////////////////////////////////////
@@ -26,7 +27,7 @@ static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate) {
class ShaderBoundsGM : public GM {
public:
typedef SkShader* (*ShaderGenFunc)(SkScalar width, SkScalar height,
- bool alternate);
+ bool alternate, const SkMatrix& localMatrix);
ShaderBoundsGM(ShaderGenFunc maker, const SkString& name)
: fShaderMaker(maker),
fName(name) {
@@ -80,10 +81,9 @@ protected:
}
SkScalar shaderWidth = SkScalarDiv(SkIntToScalar(width), scale);
SkScalar shaderHeight = SkScalarDiv(SkIntToScalar(height), scale);
- SkShader* shader = fShaderMaker(shaderWidth, shaderHeight, background);
SkMatrix shaderScale;
shaderScale.setScale(scale, scale);
- shader->setLocalMatrix(shaderScale);
+ SkShader* shader = fShaderMaker(shaderWidth, shaderHeight, background, shaderScale);
return shader;
}
« no previous file with comments | « gm/mixedxfermodes.cpp ('k') | gm/shadertext2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698