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

Unified Diff: gm/gradient_matrix.cpp

Issue 1790353002: Revert of more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/gradientDirtyLaundry.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 816891847ddf4a521898028a27b89c9349bc74a3..8f665a1b945eb0db671f44840a92d6b27734a0b7 100644
--- a/gm/gradient_matrix.cpp
+++ b/gm/gradient_matrix.cpp
@@ -61,22 +61,22 @@
static const int IMAGES_X = 4; // number of images per row
-static sk_sp<SkShader> make_linear_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) {
- return SkGradientShader::MakeLinear(pts, gColors, nullptr, SK_ARRAY_COUNT(gColors),
- SkShader::kClamp_TileMode, 0, &localMatrix);
+static SkShader* make_linear_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) {
+ return SkGradientShader::CreateLinear(pts, gColors, nullptr, SK_ARRAY_COUNT(gColors),
+ SkShader::kClamp_TileMode, 0, &localMatrix);
}
-static sk_sp<SkShader> make_radial_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) {
+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::MakeRadial(center, radius, gColors, nullptr, SK_ARRAY_COUNT(gColors),
- SkShader::kClamp_TileMode, 0, &localMatrix);
+ return SkGradientShader::CreateRadial(center, radius, gColors, nullptr, SK_ARRAY_COUNT(gColors),
+ SkShader::kClamp_TileMode, 0, &localMatrix);
}
static void draw_gradients(SkCanvas* canvas,
- sk_sp<SkShader> (*makeShader)(const SkPoint[2], const SkMatrix&),
+ 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 +97,11 @@
canvas->save();
}
+ // Setup shader and draw.
+ SkAutoTUnref<SkShader> shader(makeShader(*ptsArray, shaderMat));
+
SkPaint paint;
- paint.setShader(makeShader(*ptsArray, shaderMat));
+ paint.setShader(shader);
canvas->drawRect(rectGrad, paint);
// Advance to next position.
« no previous file with comments | « gm/gradientDirtyLaundry.cpp ('k') | gm/gradients.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698