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

Side by Side Diff: src/gpu/batches/GrTessellatingPathRenderer.cpp

Issue 2035823002: Make GrClipMaskManager stateless and push GrPipelineBuilder construction downstack (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrTessellatingPathRenderer.h" 8 #include "GrTessellatingPathRenderer.h"
9 9
10 #include "GrAuditTrail.h"
10 #include "GrBatchFlushState.h" 11 #include "GrBatchFlushState.h"
11 #include "GrBatchTest.h" 12 #include "GrBatchTest.h"
13 #include "GrClip.h"
12 #include "GrDefaultGeoProcFactory.h" 14 #include "GrDefaultGeoProcFactory.h"
13 #include "GrMesh.h" 15 #include "GrMesh.h"
14 #include "GrPathUtils.h" 16 #include "GrPathUtils.h"
15 #include "GrResourceCache.h" 17 #include "GrResourceCache.h"
16 #include "GrResourceProvider.h" 18 #include "GrResourceProvider.h"
17 #include "GrTessellator.h" 19 #include "GrTessellator.h"
18 #include "SkGeometry.h" 20 #include "SkGeometry.h"
19 21
20 #include "batches/GrVertexBatch.h" 22 #include "batches/GrVertexBatch.h"
21 23
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 SkPath fPath; 273 SkPath fPath;
272 GrStyle fStyle; 274 GrStyle fStyle;
273 SkMatrix fViewMatrix; 275 SkMatrix fViewMatrix;
274 SkRect fClipBounds; // in source space 276 SkRect fClipBounds; // in source space
275 GrXPOverridesForBatch fPipelineInfo; 277 GrXPOverridesForBatch fPipelineInfo;
276 278
277 typedef GrVertexBatch INHERITED; 279 typedef GrVertexBatch INHERITED;
278 }; 280 };
279 281
280 bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { 282 bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
281 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), 283 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
282 "GrTessellatingPathRenderer::onDrawPath"); 284 "GrTessellatingPathRenderer::onDrawPath");
283 SkASSERT(!args.fAntiAlias); 285 SkASSERT(!args.fAntiAlias);
284 const GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget();
285 if (nullptr == rt) {
286 return false;
287 }
288 286
289 SkIRect clipBoundsI; 287 SkIRect clipBoundsI;
290 args.fClip->getConservativeBounds(rt->width(), rt->height(), &clipBoundsI); 288 args.fClip->getConservativeBounds(args.fDrawContext->width(), args.fDrawCont ext->height(),
289 &clipBoundsI);
291 SkRect clipBounds = SkRect::Make(clipBoundsI); 290 SkRect clipBounds = SkRect::Make(clipBoundsI);
292 SkMatrix vmi; 291 SkMatrix vmi;
293 if (!args.fViewMatrix->invert(&vmi)) { 292 if (!args.fViewMatrix->invert(&vmi)) {
294 return false; 293 return false;
295 } 294 }
296 vmi.mapRect(&clipBounds); 295 vmi.mapRect(&clipBounds);
297 SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fColor, * args.fPath, 296 SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fColor, * args.fPath,
298 *args.fStyle, *args.fViewMatrix, 297 *args.fStyle, *args.fViewMatrix,
299 clipBounds)); 298 clipBounds));
300 args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch); 299
300 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnified Multisampled());
301 pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget());
302 pipelineBuilder.setUserStencil(args.fUserStencilSettings);
303
304 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
301 305
302 return true; 306 return true;
303 } 307 }
304 308
305 //////////////////////////////////////////////////////////////////////////////// /////////////////// 309 //////////////////////////////////////////////////////////////////////////////// ///////////////////
306 310
307 #ifdef GR_TEST_UTILS 311 #ifdef GR_TEST_UTILS
308 312
309 DRAW_BATCH_TEST_DEFINE(TesselatingPathBatch) { 313 DRAW_BATCH_TEST_DEFINE(TesselatingPathBatch) {
310 GrColor color = GrRandomColor(random); 314 GrColor color = GrRandomColor(random);
311 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); 315 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
312 SkPath path = GrTest::TestPath(random); 316 SkPath path = GrTest::TestPath(random);
313 SkRect clipBounds = GrTest::TestRect(random); 317 SkRect clipBounds = GrTest::TestRect(random);
314 SkMatrix vmi; 318 SkMatrix vmi;
315 bool result = viewMatrix.invert(&vmi); 319 bool result = viewMatrix.invert(&vmi);
316 if (!result) { 320 if (!result) {
317 SkFAIL("Cannot invert matrix\n"); 321 SkFAIL("Cannot invert matrix\n");
318 } 322 }
319 vmi.mapRect(&clipBounds); 323 vmi.mapRect(&clipBounds);
320 GrStyle style; 324 GrStyle style;
321 do { 325 do {
322 GrTest::TestStyle(random, &style); 326 GrTest::TestStyle(random, &style);
323 } while (style.strokeRec().isHairlineStyle()); 327 } while (style.strokeRec().isHairlineStyle());
324 return TessellatingPathBatch::Create(color, path, style, viewMatrix, clipBou nds); 328 return TessellatingPathBatch::Create(color, path, style, viewMatrix, clipBou nds);
325 } 329 }
326 330
327 #endif 331 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698