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

Side by Side Diff: gm/gm.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: partial update of skia call-sites 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkShader.h" 9 #include "SkShader.h"
10 using namespace skiagm; 10 using namespace skiagm;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 SkPaint paint; 78 SkPaint paint;
79 paint.setAntiAlias(true); 79 paint.setAntiAlias(true);
80 paint.setTextSize(20); 80 paint.setTextSize(20);
81 paint.setColor(SK_ColorRED); 81 paint.setColor(SK_ColorRED);
82 sk_tool_utils::set_portable_typeface(&paint); 82 sk_tool_utils::set_portable_typeface(&paint);
83 static const char kTxt[] = "GPU Only"; 83 static const char kTxt[] = "GPU Only";
84 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint); 84 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint);
85 SkMatrix localM; 85 SkMatrix localM;
86 localM.setRotate(35.f); 86 localM.setRotate(35.f);
87 localM.postTranslate(10.f, 0.f); 87 localM.postTranslate(10.f, 0.f);
88 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(bmp, SkShader::kM irror_TileMode, 88 paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kMirror_TileMode,
89 SkShader::kMirror _TileMode, 89 SkShader::kMirror_TileMode,
90 &localM)); 90 &localM));
91 paint.setShader(shader);
92 paint.setFilterQuality(kMedium_SkFilterQuality); 91 paint.setFilterQuality(kMedium_SkFilterQuality);
93 canvas->drawPaint(paint); 92 canvas->drawPaint(paint);
94 return; 93 return;
95 } 94 }
96 95
97 // need to explicitly declare this, or we get some weird infinite loop llist 96 // need to explicitly declare this, or we get some weird infinite loop llist
98 template GMRegistry* GMRegistry::gHead; 97 template GMRegistry* GMRegistry::gHead;
99 98
100 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { 99 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) {
101 fDrawProc(canvas); 100 fDrawProc(canvas);
102 } 101 }
103 102
104 SkISize skiagm::SimpleGM::onISize() { 103 SkISize skiagm::SimpleGM::onISize() {
105 return fSize; 104 return fSize;
106 } 105 }
107 106
108 SkString skiagm::SimpleGM::onShortName() { 107 SkString skiagm::SimpleGM::onShortName() {
109 return fName; 108 return fName;
110 } 109 }
111 110
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698