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

Unified Diff: samplecode/SampleTinyBitmap.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/SampleTiling.cpp ('k') | samplecode/SampleVertices.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleTinyBitmap.cpp
diff --git a/samplecode/SampleTinyBitmap.cpp b/samplecode/SampleTinyBitmap.cpp
index 8b1bdf0d1824ae944b153d4a5f2a4656eec4b428..4fb508b898413d4dded756b4e4b873aa73959d51 100644
--- a/samplecode/SampleTinyBitmap.cpp
+++ b/samplecode/SampleTinyBitmap.cpp
@@ -1,10 +1,10 @@
-
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "SampleCode.h"
#include "SkColorPriv.h"
#include "SkShader.h"
@@ -47,8 +47,7 @@ public:
}
protected:
- // overrides from SkEventSink
- virtual bool onQuery(SkEvent* evt) {
+ bool onQuery(SkEvent* evt) override {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "TinyBitmap");
return true;
@@ -61,11 +60,10 @@ protected:
bm->setAlphaType(isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
}
- virtual void onDrawContent(SkCanvas* canvas) {
- SkShader* s = SkShader::CreateBitmapShader(fBM, SkShader::kRepeat_TileMode,
- SkShader::kMirror_TileMode);
+ void onDrawContent(SkCanvas* canvas) override {
SkPaint paint;
- paint.setShader(s)->unref();
+ paint.setShader(SkShader::MakeBitmapShader(fBM, SkShader::kRepeat_TileMode,
+ SkShader::kMirror_TileMode));
canvas->drawPaint(paint);
}
« no previous file with comments | « samplecode/SampleTiling.cpp ('k') | samplecode/SampleVertices.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698