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

Unified Diff: gm/bitmapshader.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 | « gm/badpaint.cpp ('k') | gm/gm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/bitmapshader.cpp
diff --git a/gm/bitmapshader.cpp b/gm/bitmapshader.cpp
index 5d7b35c2cd46dc10061afe5c7ff69faaad00464e..491905afb31346c1b7b095510e5bbd2076b6e177 100644
--- a/gm/bitmapshader.cpp
+++ b/gm/bitmapshader.cpp
@@ -35,11 +35,6 @@ static void draw_mask(SkBitmap* bm) {
canvas.drawCircle(10, 10, 10, circlePaint);
}
-static void adopt_shader(SkPaint* paint, SkShader* shader) {
- paint->setShader(shader);
- SkSafeUnref(shader);
-}
-
class BitmapShaderGM : public GM {
protected:
@@ -69,8 +64,8 @@ protected:
}
canvas->save();
- adopt_shader(&paint, SkShader::CreateBitmapShader(fBitmap, SkShader::kClamp_TileMode,
- SkShader::kClamp_TileMode, &s));
+ paint.setShader(SkShader::MakeBitmapShader(fBitmap, SkShader::kClamp_TileMode,
+ SkShader::kClamp_TileMode, &s));
// draw the shader with a bitmap mask
canvas->drawBitmap(fMask, 0, 0, &paint);
@@ -91,8 +86,8 @@ protected:
canvas->translate(0, 25);
- adopt_shader(&paint, SkShader::CreateBitmapShader(fMask, SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode, &s));
+ paint.setShader(SkShader::MakeBitmapShader(fMask, SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode, &s));
paint.setColor(SK_ColorRED);
// draw the mask using the shader and a color
« no previous file with comments | « gm/badpaint.cpp ('k') | gm/gm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698