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

Side by Side Diff: gm/clippedbitmapshaders.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/bitmapshader.cpp ('k') | gm/colortype.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 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 return descriptor; 72 return descriptor;
73 } 73 }
74 74
75 virtual SkISize onISize() { 75 virtual SkISize onISize() {
76 return SkISize::Make(300, 300); 76 return SkISize::Make(300, 300);
77 } 77 }
78 78
79 virtual void onDraw(SkCanvas* canvas) { 79 virtual void onDraw(SkCanvas* canvas) {
80 SkBitmap bmp = create_bitmap(); 80 SkBitmap bmp = create_bitmap();
81 SkShader* shader = SkShader::CreateBitmapShader(
82 bmp, fMode, fMode);
83
84 SkPaint paint;
85 SkMatrix s; 81 SkMatrix s;
86 s.reset(); 82 s.reset();
87 s.setScale(8, 8); 83 s.setScale(8, 8);
88 s.postTranslate(SLIDE_SIZE / 2, SLIDE_SIZE / 2); 84 s.postTranslate(SLIDE_SIZE / 2, SLIDE_SIZE / 2);
89 shader->setLocalMatrix(s); 85 SkShader* shader = SkShader::CreateBitmapShader(
86 bmp, fMode, fMode, &s);
87
88 SkPaint paint;
90 paint.setShader(shader)->unref(); 89 paint.setShader(shader)->unref();
91 90
92 if (fHQ) { 91 if (fHQ) {
93 paint.setFilterLevel(SkPaint::kHigh_FilterLevel); 92 paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
94 } 93 }
95 94
96 SkScalar margin = (SLIDE_SIZE / 3 - RECT_SIZE) / 2; 95 SkScalar margin = (SLIDE_SIZE / 3 - RECT_SIZE) / 2;
97 for (int i = 0; i < 3; i++) { 96 for (int i = 0; i < 3; i++) {
98 SkScalar yOrigin = SLIDE_SIZE / 3 * i + margin; 97 SkScalar yOrigin = SLIDE_SIZE / 3 * i + margin;
99 for (int j = 0; j < 3; j++) { 98 for (int j = 0; j < 3; j++) {
(...skipping 20 matching lines...) Expand all
120 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode); ) 119 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode); )
121 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode); ) 120 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode); )
122 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode); ) 121 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode); )
123 122
124 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode, true); ) 123 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode, true); )
125 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode, true); ) 124 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode, true); )
126 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode, true); ) 125 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode, true); )
127 126
128 127
129 } 128 }
OLDNEW
« no previous file with comments | « gm/bitmapshader.cpp ('k') | gm/colortype.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698