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

Side by Side Diff: gm/clippedbitmapshaders.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/circles.cpp ('k') | gm/color4f.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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SkMatrix s; 81 SkMatrix s;
82 s.reset(); 82 s.reset();
83 s.setScale(8, 8); 83 s.setScale(8, 8);
84 s.postTranslate(SLIDE_SIZE / 2, SLIDE_SIZE / 2); 84 s.postTranslate(SLIDE_SIZE / 2, SLIDE_SIZE / 2);
85 SkShader* shader = SkShader::CreateBitmapShader(
86 bmp, fMode, fMode, &s);
87
88 SkPaint paint; 85 SkPaint paint;
89 paint.setShader(shader)->unref(); 86 paint.setShader(SkShader::MakeBitmapShader(bmp, fMode, fMode, &s));
90 87
91 if (fHQ) { 88 if (fHQ) {
92 paint.setFilterQuality(kHigh_SkFilterQuality); 89 paint.setFilterQuality(kHigh_SkFilterQuality);
93 } 90 }
94 91
95 SkScalar margin = (SLIDE_SIZE / 3 - RECT_SIZE) / 2; 92 SkScalar margin = (SLIDE_SIZE / 3 - RECT_SIZE) / 2;
96 for (int i = 0; i < 3; i++) { 93 for (int i = 0; i < 3; i++) {
97 SkScalar yOrigin = SLIDE_SIZE / 3 * i + margin; 94 SkScalar yOrigin = SLIDE_SIZE / 3 * i + margin;
98 for (int j = 0; j < 3; j++) { 95 for (int j = 0; j < 3; j++) {
99 SkScalar xOrigin = SLIDE_SIZE / 3 * j + margin; 96 SkScalar xOrigin = SLIDE_SIZE / 3 * j + margin;
(...skipping 19 matching lines...) Expand all
119 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode); ) 116 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode); )
120 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode); ) 117 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode); )
121 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode); ) 118 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode); )
122 119
123 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode, true); ) 120 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode, true); )
124 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode, true); ) 121 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode, true); )
125 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode, true); ) 122 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode, true); )
126 123
127 124
128 } 125 }
OLDNEW
« no previous file with comments | « gm/circles.cpp ('k') | gm/color4f.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698