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

Side by Side Diff: samplecode/SampleAARectModes.cpp

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 6 years, 7 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
« no previous file with comments | « include/effects/SkGradientShader.h ('k') | samplecode/SampleCamera.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return H; 61 return H;
62 } 62 }
63 63
64 static SkShader* make_bg_shader() { 64 static SkShader* make_bg_shader() {
65 SkBitmap bm; 65 SkBitmap bm;
66 bm.allocN32Pixels(2, 2); 66 bm.allocN32Pixels(2, 2);
67 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; 67 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF;
68 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 68 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC,
69 0xCC, 0xCC); 69 0xCC, 0xCC);
70 70
71 SkShader* s = SkShader::CreateBitmapShader(bm,
72 SkShader::kRepeat_TileMode,
73 SkShader::kRepeat_TileMode);
74
75 SkMatrix m; 71 SkMatrix m;
76 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); 72 m.setScale(SkIntToScalar(6), SkIntToScalar(6));
77 s->setLocalMatrix(m); 73
78 return s; 74 return SkShader::CreateBitmapShader(bm,
75 SkShader::kRepeat_TileMode,
76 SkShader::kRepeat_TileMode,
77 &m);
79 } 78 }
80 79
81 class AARectsModesView : public SampleView { 80 class AARectsModesView : public SampleView {
82 SkPaint fBGPaint; 81 SkPaint fBGPaint;
83 public: 82 public:
84 AARectsModesView () { 83 AARectsModesView () {
85 fBGPaint.setShader(make_bg_shader())->unref(); 84 fBGPaint.setShader(make_bg_shader())->unref();
86 } 85 }
87 86
88 protected: 87 protected:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 128 }
130 129
131 private: 130 private:
132 typedef SampleView INHERITED; 131 typedef SampleView INHERITED;
133 }; 132 };
134 133
135 /////////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////////
136 135
137 static SkView* MyFactory() { return new AARectsModesView; } 136 static SkView* MyFactory() { return new AARectsModesView; }
138 static SkViewRegister reg(MyFactory); 137 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkGradientShader.h ('k') | samplecode/SampleCamera.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698