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

Side by Side Diff: gm/texturedomaineffect.cpp

Issue 646213003: Add `SkIRect bounds()` convenience method to SkImageInfo and SkBitmap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reed nits Created 6 years, 2 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 | « no previous file | include/core/SkBitmap.h » ('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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 SkTArray<SkMatrix> textureMatrices; 100 SkTArray<SkMatrix> textureMatrices;
101 textureMatrices.push_back().setIDiv(texture->width(), texture->height()) ; 101 textureMatrices.push_back().setIDiv(texture->width(), texture->height()) ;
102 textureMatrices.push_back() = textureMatrices[0]; 102 textureMatrices.push_back() = textureMatrices[0];
103 textureMatrices.back().postScale(1.5f, 0.85f); 103 textureMatrices.back().postScale(1.5f, 0.85f);
104 textureMatrices.push_back() = textureMatrices[0]; 104 textureMatrices.push_back() = textureMatrices[0];
105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture-> height() / 2.f); 105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture-> height() / 2.f);
106 106
107 const SkIRect texelDomains[] = { 107 const SkIRect texelDomains[] = {
108 SkIRect::MakeWH(fBmp.width(), fBmp.height()), 108 fBmp.bounds(),
109 SkIRect::MakeXYWH(fBmp.width() / 4, 109 SkIRect::MakeXYWH(fBmp.width() / 4,
110 fBmp.height() / 4, 110 fBmp.height() / 4,
111 fBmp.width() / 2, 111 fBmp.width() / 2,
112 fBmp.height() / 2), 112 fBmp.height() / 2),
113 }; 113 };
114 114
115 SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp.width()), 115 SkRect renderRect = SkRect::Make(fBmp.bounds());
116 SkIntToScalar(fBmp.height()));
117 renderRect.outset(kDrawPad, kDrawPad); 116 renderRect.outset(kDrawPad, kDrawPad);
118 117
119 SkScalar y = kDrawPad + kTestPad; 118 SkScalar y = kDrawPad + kTestPad;
120 for (int tm = 0; tm < textureMatrices.count(); ++tm) { 119 for (int tm = 0; tm < textureMatrices.count(); ++tm) {
121 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) { 120 for (size_t d = 0; d < SK_ARRAY_COUNT(texelDomains); ++d) {
122 SkScalar x = kDrawPad + kTestPad; 121 SkScalar x = kDrawPad + kTestPad;
123 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) { 122 for (int m = 0; m < GrTextureDomain::kModeCount; ++m) {
124 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; 123 GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m;
125 SkAutoTUnref<GrFragmentProcessor> fp( 124 SkAutoTUnref<GrFragmentProcessor> fp(
126 GrTextureDomainEffect::Create(texture, textureMatrices[t m], 125 GrTextureDomainEffect::Create(texture, textureMatrices[t m],
(...skipping 30 matching lines...) Expand all
157 }; 156 };
158 157
159 // Windows builds did not like SkScalar initialization in class :( 158 // Windows builds did not like SkScalar initialization in class :(
160 const SkScalar TextureDomainEffect::kDrawPad = 10.f; 159 const SkScalar TextureDomainEffect::kDrawPad = 10.f;
161 const SkScalar TextureDomainEffect::kTestPad = 10.f; 160 const SkScalar TextureDomainEffect::kTestPad = 10.f;
162 161
163 DEF_GM( return SkNEW(TextureDomainEffect); ) 162 DEF_GM( return SkNEW(TextureDomainEffect); )
164 } 163 }
165 164
166 #endif 165 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698