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

Unified Diff: src/c/sk_surface.cpp

Issue 1772463002: use Make instead of Create to return a shared shader (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 | « src/animator/SkDrawShader.cpp ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/c/sk_surface.cpp
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index 6618881bc1e862bc98209b8fa9b26ab421039d28..f7fa30f28a48c4027e86379dc668c97d617ef2fa 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -551,10 +551,10 @@ sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t pts[2],
} else {
matrix.setIdentity();
}
- SkShader* s = SkGradientShader::CreateLinear(reinterpret_cast<const SkPoint*>(pts),
- reinterpret_cast<const SkColor*>(colors),
- colorPos, colorCount, mode, 0, &matrix);
- return (sk_shader_t*)s;
+ return (sk_shader_t*)SkGradientShader::MakeLinear(reinterpret_cast<const SkPoint*>(pts),
+ reinterpret_cast<const SkColor*>(colors),
+ colorPos, colorCount,
+ mode, 0, &matrix).release();
}
static const SkPoint& to_skpoint(const sk_point_t& p) {
@@ -579,12 +579,10 @@ sk_shader_t* sk_shader_new_radial_gradient(const sk_point_t* ccenter,
matrix.setIdentity();
}
SkPoint center = to_skpoint(*ccenter);
- SkShader* s = SkGradientShader::CreateRadial(
- center, (SkScalar)radius,
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, mode, 0, &matrix);
- return (sk_shader_t*)s;
+ return (sk_shader_t*)SkGradientShader::MakeRadial(center, (SkScalar)radius,
+ reinterpret_cast<const SkColor*>(colors),
+ reinterpret_cast<const SkScalar*>(colorPos),
+ colorCount, mode, 0, &matrix).release();
}
sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* ccenter,
@@ -598,13 +596,11 @@ sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* ccenter,
} else {
matrix.setIdentity();
}
- SkShader* s = SkGradientShader::CreateSweep(
- (SkScalar)(ccenter->x),
- (SkScalar)(ccenter->y),
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, 0, &matrix);
- return (sk_shader_t*)s;
+ return (sk_shader_t*)SkGradientShader::MakeSweep((SkScalar)(ccenter->x),
+ (SkScalar)(ccenter->y),
+ reinterpret_cast<const SkColor*>(colors),
+ reinterpret_cast<const SkScalar*>(colorPos),
+ colorCount, 0, &matrix).release();
}
sk_shader_t* sk_shader_new_two_point_conical_gradient(const sk_point_t* start,
@@ -628,13 +624,11 @@ sk_shader_t* sk_shader_new_two_point_conical_gradient(const sk_point_t* start,
}
SkPoint skstart = to_skpoint(*start);
SkPoint skend = to_skpoint(*end);
- SkShader* s = SkGradientShader::CreateTwoPointConical(
- skstart, (SkScalar)startRadius,
- skend, (SkScalar)endRadius,
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, mode, 0, &matrix);
- return (sk_shader_t*)s;
+ return (sk_shader_t*)SkGradientShader::MakeTwoPointConical(skstart, (SkScalar)startRadius,
+ skend, (SkScalar)endRadius,
+ reinterpret_cast<const SkColor*>(colors),
+ reinterpret_cast<const SkScalar*>(colorPos),
+ colorCount, mode, 0, &matrix).release();
}
///////////////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/animator/SkDrawShader.cpp ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698