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

Side by Side Diff: gm/giantbitmap.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 | « gm/drawbitmaprect.cpp ('k') | gm/gradient_matrix.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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 str.append(fDoFilter ? "_bilerp" : "_point"); 89 str.append(fDoFilter ? "_bilerp" : "_point");
90 str.append(fDoRotate ? "_rotate" : "_scale"); 90 str.append(fDoRotate ? "_rotate" : "_scale");
91 return str; 91 return str;
92 } 92 }
93 93
94 virtual SkISize onISize() { return SkISize::Make(640, 480); } 94 virtual SkISize onISize() { return SkISize::Make(640, 480); }
95 95
96 virtual void onDraw(SkCanvas* canvas) { 96 virtual void onDraw(SkCanvas* canvas) {
97 SkPaint paint; 97 SkPaint paint;
98 SkShader* s = SkShader::CreateBitmapShader(getBitmap(), fMode, fMode);
99 98
100 SkMatrix m; 99 SkMatrix m;
101 if (fDoRotate) { 100 if (fDoRotate) {
102 // m.setRotate(SkIntToScalar(30), 0, 0); 101 // m.setRotate(SkIntToScalar(30), 0, 0);
103 m.setSkew(SK_Scalar1, 0, 0, 0); 102 m.setSkew(SK_Scalar1, 0, 0, 0);
104 // m.postScale(2*SK_Scalar1/3, 2*SK_Scalar1/3); 103 // m.postScale(2*SK_Scalar1/3, 2*SK_Scalar1/3);
105 } else { 104 } else {
106 SkScalar scale = 11*SK_Scalar1/12; 105 SkScalar scale = 11*SK_Scalar1/12;
107 m.setScale(scale, scale); 106 m.setScale(scale, scale);
108 } 107 }
109 s->setLocalMatrix(m); 108 SkShader* s = SkShader::CreateBitmapShader(getBitmap(), fMode, fMode, &m );
110 109
111 paint.setShader(s)->unref(); 110 paint.setShader(s)->unref();
112 paint.setFilterLevel(fDoFilter ? SkPaint::kLow_FilterLevel : SkPaint::kN one_FilterLevel); 111 paint.setFilterLevel(fDoFilter ? SkPaint::kLow_FilterLevel : SkPaint::kN one_FilterLevel);
113 112
114 canvas->translate(SkIntToScalar(50), SkIntToScalar(50)); 113 canvas->translate(SkIntToScalar(50), SkIntToScalar(50));
115 114
116 // SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16); 115 // SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16);
117 // canvas->drawRect(r, paint); return; 116 // canvas->drawRect(r, paint); return;
118 canvas->drawPaint(paint); 117 canvas->drawPaint(paint);
119 } 118 }
(...skipping 24 matching lines...) Expand all
144 static skiagm::GMRegistry reg010(G010); 143 static skiagm::GMRegistry reg010(G010);
145 static skiagm::GMRegistry reg110(G110); 144 static skiagm::GMRegistry reg110(G110);
146 static skiagm::GMRegistry reg210(G210); 145 static skiagm::GMRegistry reg210(G210);
147 146
148 static skiagm::GMRegistry reg001(G001); 147 static skiagm::GMRegistry reg001(G001);
149 static skiagm::GMRegistry reg101(G101); 148 static skiagm::GMRegistry reg101(G101);
150 static skiagm::GMRegistry reg201(G201); 149 static skiagm::GMRegistry reg201(G201);
151 static skiagm::GMRegistry reg011(G011); 150 static skiagm::GMRegistry reg011(G011);
152 static skiagm::GMRegistry reg111(G111); 151 static skiagm::GMRegistry reg111(G111);
153 static skiagm::GMRegistry reg211(G211); 152 static skiagm::GMRegistry reg211(G211);
OLDNEW
« no previous file with comments | « gm/drawbitmaprect.cpp ('k') | gm/gradient_matrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698