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

Unified Diff: src/animator/SkDrawGradient.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 | « samplecode/SampleXfermodesBlur.cpp ('k') | src/animator/SkDrawShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/animator/SkDrawGradient.cpp
diff --git a/src/animator/SkDrawGradient.cpp b/src/animator/SkDrawGradient.cpp
index 4aecbc3936d862de09b4a9e52d9343b4f58baa91..2fa4502f6bc9e8e762a061031241cf67cf2eb160 100644
--- a/src/animator/SkDrawGradient.cpp
+++ b/src/animator/SkDrawGradient.cpp
@@ -126,14 +126,12 @@ void SkDrawLinearGradient::dump(SkAnimateMaker* maker) {
#endif
SkShader* SkDrawLinearGradient::getShader() {
- if (addPrelude() == 0 || points.count() != 4)
+ if (addPrelude() == 0 || points.count() != 4) {
return nullptr;
- SkShader* shader = SkGradientShader::CreateLinear((SkPoint*)points.begin(),
+ }
+ return SkGradientShader::MakeLinear((SkPoint*)points.begin(),
fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode,
- 0, getMatrix());
- SkAutoTDelete<SkShader> autoDel(shader);
- (void)autoDel.detach();
- return shader;
+ 0, getMatrix()).release();
}
@@ -161,12 +159,10 @@ void SkDrawRadialGradient::dump(SkAnimateMaker* maker) {
#endif
SkShader* SkDrawRadialGradient::getShader() {
- if (addPrelude() == 0)
+ if (addPrelude() == 0) {
return nullptr;
- SkShader* shader = SkGradientShader::CreateRadial(center,
+ }
+ return SkGradientShader::MakeRadial(center,
radius, fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode,
- 0, getMatrix());
- SkAutoTDelete<SkShader> autoDel(shader);
- (void)autoDel.detach();
- return shader;
+ 0, getMatrix()).release();
}
« no previous file with comments | « samplecode/SampleXfermodesBlur.cpp ('k') | src/animator/SkDrawShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698