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

Side by Side Diff: gm/texdata.cpp

Issue 19449002: Replace all instances of GrRect with SkRect. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | include/gpu/GrAARectRenderer.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 2011 Google Inc. 3 * Copyright 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 desc.fWidth = 2 * S; 88 desc.fWidth = 2 * S;
89 desc.fHeight = 2 * S; 89 desc.fHeight = 2 * S;
90 GrTexture* texture = 90 GrTexture* texture =
91 ctx->createUncachedTexture(desc, gTextureData, 0); 91 ctx->createUncachedTexture(desc, gTextureData, 0);
92 92
93 if (!texture) { 93 if (!texture) {
94 return; 94 return;
95 } 95 }
96 GrAutoUnref au(texture); 96 GrAutoUnref au(texture);
97 97
98 GrContext::AutoClip acs(ctx, GrRect::MakeWH(2*S, 2*S)); 98 GrContext::AutoClip acs(ctx, SkRect::MakeWH(2*S, 2*S));
99 99
100 ctx->setRenderTarget(target); 100 ctx->setRenderTarget(target);
101 101
102 GrPaint paint; 102 GrPaint paint;
103 paint.setBlendFunc(kOne_GrBlendCoeff, kISA_GrBlendCoeff); 103 paint.setBlendFunc(kOne_GrBlendCoeff, kISA_GrBlendCoeff);
104 SkMatrix vm; 104 SkMatrix vm;
105 if (i) { 105 if (i) {
106 vm.setRotate(90 * SK_Scalar1, 106 vm.setRotate(90 * SK_Scalar1,
107 S * SK_Scalar1, 107 S * SK_Scalar1,
108 S * SK_Scalar1); 108 S * SK_Scalar1);
109 } else { 109 } else {
110 vm.reset(); 110 vm.reset();
111 } 111 }
112 ctx->setMatrix(vm); 112 ctx->setMatrix(vm);
113 SkMatrix tm; 113 SkMatrix tm;
114 tm = vm; 114 tm = vm;
115 tm.postIDiv(2*S, 2*S); 115 tm.postIDiv(2*S, 2*S);
116 paint.addColorTextureEffect(texture, tm); 116 paint.addColorTextureEffect(texture, tm);
117 117
118 ctx->drawRect(paint, GrRect::MakeWH(2*S, 2*S)); 118 ctx->drawRect(paint, SkRect::MakeWH(2*S, 2*S));
119 119
120 // now update the lower right of the texture in first pass 120 // now update the lower right of the texture in first pass
121 // or upper right in second pass 121 // or upper right in second pass
122 offset = 0; 122 offset = 0;
123 for (int y = 0; y < S; ++y) { 123 for (int y = 0; y < S; ++y) {
124 for (int x = 0; x < S; ++x) { 124 for (int x = 0; x < S; ++x) {
125 gTextureData[offset + y * stride + x] = 125 gTextureData[offset + y * stride + x] =
126 ((x + y) % 2) ? (i ? green : red) : blue; 126 ((x + y) % 2) ? (i ? green : red) : blue;
127 } 127 }
128 } 128 }
129 texture->writePixels(S, (i ? 0 : S), S, S, 129 texture->writePixels(S, (i ? 0 : S), S, S,
130 texture->config(), gTextureData, 130 texture->config(), gTextureData,
131 4 * stride); 131 4 * stride);
132 ctx->drawRect(paint, GrRect::MakeWH(2*S, 2*S)); 132 ctx->drawRect(paint, SkRect::MakeWH(2*S, 2*S));
133 } 133 }
134 } 134 }
135 } 135 }
136 136
137 private: 137 private:
138 typedef GM INHERITED; 138 typedef GM INHERITED;
139 }; 139 };
140 140
141 ////////////////////////////////////////////////////////////////////////////// 141 //////////////////////////////////////////////////////////////////////////////
142 142
143 static GM* MyFactory(void*) { return new TexDataGM; } 143 static GM* MyFactory(void*) { return new TexDataGM; }
144 static GMRegistry reg(MyFactory); 144 static GMRegistry reg(MyFactory);
145 145
146 } 146 }
147 147
148 #endif 148 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrAARectRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698