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

Side by Side Diff: gm/convexpolyeffect.cpp

Issue 1264283004: Revert of Use new API everywhere for GrDefaultGeoProcFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup2
Patch Set: Created 5 years, 4 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 | src/gpu/GrAAConvexPathRenderer.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 /* 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // vertically/horizontally thin rects that don't cover pixel centers 140 // vertically/horizontally thin rects that don't cover pixel centers
141 fRects.addToTail(SkRect::MakeLTRB(5.55f, 0.5f, 5.75f, 24.5f)); 141 fRects.addToTail(SkRect::MakeLTRB(5.55f, 0.5f, 5.75f, 24.5f));
142 fRects.addToTail(SkRect::MakeLTRB(5.5f, .05f, 29.5f, .25f)); 142 fRects.addToTail(SkRect::MakeLTRB(5.5f, .05f, 29.5f, .25f));
143 // small in x and y 143 // small in x and y
144 fRects.addToTail(SkRect::MakeLTRB(5.05f, .55f, 5.45f, .85f)); 144 fRects.addToTail(SkRect::MakeLTRB(5.05f, .55f, 5.45f, .85f));
145 // inverted in x and y 145 // inverted in x and y
146 fRects.addToTail(SkRect::MakeLTRB(100.f, 50.5f, 5.f, 0.5f)); 146 fRects.addToTail(SkRect::MakeLTRB(100.f, 50.5f, 5.f, 0.5f));
147 } 147 }
148 148
149 void onDraw(SkCanvas* canvas) override { 149 void onDraw(SkCanvas* canvas) override {
150 using namespace GrDefaultGeoProcFactory;
151 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); 150 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget ();
152 if (NULL == rt) { 151 if (NULL == rt) {
153 this->drawGpuOnlyMessage(canvas); 152 this->drawGpuOnlyMessage(canvas);
154 return; 153 return;
155 } 154 }
156 GrContext* context = rt->getContext(); 155 GrContext* context = rt->getContext();
157 if (NULL == context) { 156 if (NULL == context) {
158 return; 157 return;
159 } 158 }
160 159
161 Color color(0xff000000); 160 static const GrColor color = 0xff000000;
162 Coverage coverage(Coverage::kSolid_Type);
163 LocalCoords localCoords(LocalCoords::kUnused_Type);
164 SkAutoTUnref<const GrGeometryProcessor> gp( 161 SkAutoTUnref<const GrGeometryProcessor> gp(
165 GrDefaultGeoProcFactory::Create(color, coverage, localCoords, Sk Matrix::I())); 162 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi on_GPType, color,
163 false, false));
166 164
167 SkScalar y = 0; 165 SkScalar y = 0;
168 for (SkTLList<SkPath>::Iter iter(fPaths, SkTLList<SkPath>::Iter::kHead_I terStart); 166 for (SkTLList<SkPath>::Iter iter(fPaths, SkTLList<SkPath>::Iter::kHead_I terStart);
169 iter.get(); 167 iter.get();
170 iter.next()) { 168 iter.next()) {
171 const SkPath* path = iter.get(); 169 const SkPath* path = iter.get();
172 SkScalar x = 0; 170 SkScalar x = 0;
173 171
174 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { 172 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) {
175 GrTestTarget tt; 173 GrTestTarget tt;
(...skipping 10 matching lines...) Expand all
186 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, p)); 184 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, p));
187 if (!fp) { 185 if (!fp) {
188 continue; 186 continue;
189 } 187 }
190 188
191 GrPipelineBuilder pipelineBuilder; 189 GrPipelineBuilder pipelineBuilder;
192 pipelineBuilder.addCoverageProcessor(fp); 190 pipelineBuilder.addCoverageProcessor(fp);
193 pipelineBuilder.setRenderTarget(rt); 191 pipelineBuilder.setRenderTarget(rt);
194 192
195 ConvexPolyTestBatch::Geometry geometry; 193 ConvexPolyTestBatch::Geometry geometry;
196 geometry.fColor = color.fColor; 194 geometry.fColor = color;
197 geometry.fBounds = p.getBounds(); 195 geometry.fBounds = p.getBounds();
198 196
199 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry)); 197 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry));
200 198
201 tt.target()->drawBatch(pipelineBuilder, batch); 199 tt.target()->drawBatch(pipelineBuilder, batch);
202 200
203 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f); 201 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f);
204 } 202 }
205 203
206 // Draw AA and non AA paths using normal API for reference. 204 // Draw AA and non AA paths using normal API for reference.
(...skipping 28 matching lines...) Expand all
235 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, rect)); 233 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, rect));
236 if (!fp) { 234 if (!fp) {
237 continue; 235 continue;
238 } 236 }
239 237
240 GrPipelineBuilder pipelineBuilder; 238 GrPipelineBuilder pipelineBuilder;
241 pipelineBuilder.addCoverageProcessor(fp); 239 pipelineBuilder.addCoverageProcessor(fp);
242 pipelineBuilder.setRenderTarget(rt); 240 pipelineBuilder.setRenderTarget(rt);
243 241
244 ConvexPolyTestBatch::Geometry geometry; 242 ConvexPolyTestBatch::Geometry geometry;
245 geometry.fColor = color.fColor; 243 geometry.fColor = color;
246 geometry.fBounds = rect; 244 geometry.fBounds = rect;
247 245
248 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry)); 246 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geom etry));
249 247
250 tt.target()->drawBatch(pipelineBuilder, batch); 248 tt.target()->drawBatch(pipelineBuilder, batch);
251 249
252 x += SkScalarCeilToScalar(rect.width() + 10.f); 250 x += SkScalarCeilToScalar(rect.width() + 10.f);
253 } 251 }
254 252
255 // Draw rect without and with AA using normal API for reference 253 // Draw rect without and with AA using normal API for reference
(...skipping 14 matching lines...) Expand all
270 SkTLList<SkPath> fPaths; 268 SkTLList<SkPath> fPaths;
271 SkTLList<SkRect> fRects; 269 SkTLList<SkRect> fRects;
272 270
273 typedef GM INHERITED; 271 typedef GM INHERITED;
274 }; 272 };
275 273
276 DEF_GM( return SkNEW(ConvexPolyEffect); ) 274 DEF_GM( return SkNEW(ConvexPolyEffect); )
277 } 275 }
278 276
279 #endif 277 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698