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

Side by Side Diff: samplecode/SampleHairModes.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 | « samplecode/SampleFatBits.cpp ('k') | samplecode/SampleLayers.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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 return H; 60 return H;
61 } 61 }
62 62
63 static SkShader* make_bg_shader() { 63 static SkShader* make_bg_shader() {
64 SkBitmap bm; 64 SkBitmap bm;
65 bm.allocN32Pixels(2, 2); 65 bm.allocN32Pixels(2, 2);
66 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; 66 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF;
67 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 0xCC, 0 xCC); 67 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 0xCC, 0 xCC);
68 68
69 SkShader* s = SkShader::CreateBitmapShader(bm,
70 SkShader::kRepeat_TileMode,
71 SkShader::kRepeat_TileMode);
72
73 SkMatrix m; 69 SkMatrix m;
74 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); 70 m.setScale(SkIntToScalar(6), SkIntToScalar(6));
75 s->setLocalMatrix(m); 71
76 return s; 72 return SkShader::CreateBitmapShader(bm,
73 SkShader::kRepeat_TileMode,
74 SkShader::kRepeat_TileMode,
75 &m);
77 } 76 }
78 77
79 class HairModesView : public SampleView { 78 class HairModesView : public SampleView {
80 SkPaint fBGPaint; 79 SkPaint fBGPaint;
81 public: 80 public:
82 HairModesView() { 81 HairModesView() {
83 fBGPaint.setShader(make_bg_shader())->unref(); 82 fBGPaint.setShader(make_bg_shader())->unref();
84 } 83 }
85 84
86 protected: 85 protected:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 126 }
128 127
129 private: 128 private:
130 typedef SampleView INHERITED; 129 typedef SampleView INHERITED;
131 }; 130 };
132 131
133 /////////////////////////////////////////////////////////////////////////////// 132 ///////////////////////////////////////////////////////////////////////////////
134 133
135 static SkView* MyFactory() { return new HairModesView; } 134 static SkView* MyFactory() { return new HairModesView; }
136 static SkViewRegister reg(MyFactory); 135 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFatBits.cpp ('k') | samplecode/SampleLayers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698