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

Side by Side Diff: samplecode/SampleAARects.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 return this->INHERITED::onQuery(evt); 56 return this->INHERITED::onQuery(evt);
57 } 57 }
58 58
59 virtual void onDrawContent(SkCanvas* canvas) { 59 virtual void onDrawContent(SkCanvas* canvas) {
60 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); 60 canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
61 61
62 SkPaint bluePaint; 62 SkPaint bluePaint;
63 bluePaint.setARGB(0xff, 0x0, 0x0, 0xff); 63 bluePaint.setARGB(0xff, 0x0, 0x0, 0xff);
64 SkPaint bmpPaint; 64 SkPaint bmpPaint;
65 SkShader* bmpShader = SkShader::CreateBitmapShader(fBitmap, SkShader::kR epeat_TileMode, SkShader::kRepeat_TileMode); 65 bmpPaint.setShader(SkShader::MakeBitmapShader(fBitmap, SkShader::kRepeat _TileMode,
66 bmpPaint.setShader(bmpShader); 66 SkShader::kRepeat_TileMode ));
67 bmpShader->unref();
68
69 bluePaint.setStrokeWidth(3); 67 bluePaint.setStrokeWidth(3);
70 bmpPaint.setStrokeWidth(3); 68 bmpPaint.setStrokeWidth(3);
71 69
72 SkPaint paints[] = { bluePaint, bmpPaint }; 70 SkPaint paints[] = { bluePaint, bmpPaint };
73 71
74 SkRect rect; 72 SkRect rect;
75 73
76 SkScalar dx = SkIntToScalar(80); 74 SkScalar dx = SkIntToScalar(80);
77 SkScalar dy = SkIntToScalar(100); 75 SkScalar dy = SkIntToScalar(100);
78 SkMatrix matrix; 76 SkMatrix matrix;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 private: 185 private:
188 int fWidth; 186 int fWidth;
189 187
190 typedef SampleView INHERITED; 188 typedef SampleView INHERITED;
191 }; 189 };
192 190
193 ////////////////////////////////////////////////////////////////////////////// 191 //////////////////////////////////////////////////////////////////////////////
194 192
195 static SkView* MyFactory() { return new AARectView; } 193 static SkView* MyFactory() { return new AARectView; }
196 static SkViewRegister reg(MyFactory); 194 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698