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

Side by Side Diff: gm/giantbitmap.cpp

Issue 1776973003: partial switch over to sp usage of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move into lua container 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
« no previous file with comments | « gm/gammatext.cpp ('k') | gm/glyph_pos_align.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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 SkMatrix m; 98 SkMatrix m;
99 if (fDoRotate) { 99 if (fDoRotate) {
100 // m.setRotate(SkIntToScalar(30), 0, 0); 100 // m.setRotate(SkIntToScalar(30), 0, 0);
101 m.setSkew(SK_Scalar1, 0, 0, 0); 101 m.setSkew(SK_Scalar1, 0, 0, 0);
102 // m.postScale(2*SK_Scalar1/3, 2*SK_Scalar1/3); 102 // m.postScale(2*SK_Scalar1/3, 2*SK_Scalar1/3);
103 } else { 103 } else {
104 SkScalar scale = 11*SK_Scalar1/12; 104 SkScalar scale = 11*SK_Scalar1/12;
105 m.setScale(scale, scale); 105 m.setScale(scale, scale);
106 } 106 }
107 SkShader* s = SkShader::CreateBitmapShader(getBitmap(), fMode, fMode, &m ); 107 paint.setShader(SkShader::MakeBitmapShader(getBitmap(), fMode, fMode, &m ));
108
109 paint.setShader(s)->unref();
110 paint.setFilterQuality(fDoFilter ? kLow_SkFilterQuality : kNone_SkFilter Quality); 108 paint.setFilterQuality(fDoFilter ? kLow_SkFilterQuality : kNone_SkFilter Quality);
111 109
112 canvas->translate(SkIntToScalar(50), SkIntToScalar(50)); 110 canvas->translate(SkIntToScalar(50), SkIntToScalar(50));
113 111
114 // SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16); 112 // SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16);
115 // canvas->drawRect(r, paint); return; 113 // canvas->drawRect(r, paint); return;
116 canvas->drawPaint(paint); 114 canvas->drawPaint(paint);
117 } 115 }
118 116
119 private: 117 private:
120 typedef GM INHERITED; 118 typedef GM INHERITED;
121 }; 119 };
122 120
123 /////////////////////////////////////////////////////////////////////////////// 121 ///////////////////////////////////////////////////////////////////////////////
124 122
125 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, false, false); ) 123 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, false, false); )
126 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, false, false); ) 124 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, false, false); )
127 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, false, false); ) 125 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, false, false); )
128 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, true, false); ) 126 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, true, false); )
129 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, true, false); ) 127 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, true, false); )
130 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, true, false); ) 128 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, true, false); )
131 129
132 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, false, true); ) 130 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, false, true); )
133 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, false, true); ) 131 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, false, true); )
134 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, false, true); ) 132 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, false, true); )
135 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, true, true); ) 133 DEF_GM( return new GiantBitmapGM(SkShader::kClamp_TileMode, true, true); )
136 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, true, true); ) 134 DEF_GM( return new GiantBitmapGM(SkShader::kRepeat_TileMode, true, true); )
137 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, true, true); ) 135 DEF_GM( return new GiantBitmapGM(SkShader::kMirror_TileMode, true, true); )
OLDNEW
« no previous file with comments | « gm/gammatext.cpp ('k') | gm/glyph_pos_align.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698