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

Unified Diff: gm/gradient_matrix.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/giantbitmap.cpp ('k') | gm/gradients.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gradient_matrix.cpp
diff --git a/gm/gradient_matrix.cpp b/gm/gradient_matrix.cpp
index d1d0e42d6ea163619a3be64a2cb6ba861e938859..b2bc5d1cd8e709fc5e62ef7e2f2c402d2f85391a 100644
--- a/gm/gradient_matrix.cpp
+++ b/gm/gradient_matrix.cpp
@@ -61,21 +61,22 @@ static const SkScalar TESTGRID_Y = SkIntToScalar(200);
static const int IMAGES_X = 4; // number of images per row
-static SkShader* make_linear_gradient(const SkPoint pts[2]) {
+static SkShader* make_linear_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) {
return SkGradientShader::CreateLinear(pts, gColors, NULL, SK_ARRAY_COUNT(gColors),
- SkShader::kClamp_TileMode, NULL);
+ SkShader::kClamp_TileMode, NULL, 0, &localMatrix);
}
-static SkShader* make_radial_gradient(const SkPoint pts[2]) {
+static SkShader* make_radial_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) {
SkPoint center;
center.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
float radius = (center - pts[0]).length();
return SkGradientShader::CreateRadial(center, radius, gColors, NULL, SK_ARRAY_COUNT(gColors),
- SkShader::kClamp_TileMode, NULL);
+ SkShader::kClamp_TileMode, NULL, 0, &localMatrix);
}
-static void draw_gradients(SkCanvas* canvas, SkShader* (*makeShader)(const SkPoint[2]),
+static void draw_gradients(SkCanvas* canvas,
+ SkShader* (*makeShader)(const SkPoint[2], const SkMatrix&),
const SkPoint ptsArray[][2], int numImages) {
// Use some nice prime numbers for the rectangle and matrix with
// different scaling along the x and y axes (which is the bug this
@@ -97,8 +98,7 @@ static void draw_gradients(SkCanvas* canvas, SkShader* (*makeShader)(const SkPoi
}
// Setup shader and draw.
- SkAutoTUnref<SkShader> shader(makeShader(*ptsArray));
- shader->setLocalMatrix(shaderMat);
+ SkAutoTUnref<SkShader> shader(makeShader(*ptsArray, shaderMat));
SkPaint paint;
paint.setShader(shader);
« no previous file with comments | « gm/giantbitmap.cpp ('k') | gm/gradients.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698