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

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

Issue 1467553002: New API for computing optimization invariants. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « src/gpu/batches/GrTInstanceBatch.h ('k') | src/gpu/batches/GrTestBatch.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 * 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 "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 static GrDrawBatch* Create(const GrColor& color, 1390 static GrDrawBatch* Create(const GrColor& color,
1391 const SkPath& path, 1391 const SkPath& path,
1392 const GrStrokeInfo& stroke, 1392 const GrStrokeInfo& stroke,
1393 const SkMatrix& viewMatrix, 1393 const SkMatrix& viewMatrix,
1394 SkRect clipBounds) { 1394 SkRect clipBounds) {
1395 return new TessellatingPathBatch(color, path, stroke, viewMatrix, clipBo unds); 1395 return new TessellatingPathBatch(color, path, stroke, viewMatrix, clipBo unds);
1396 } 1396 }
1397 1397
1398 const char* name() const override { return "TessellatingPathBatch"; } 1398 const char* name() const override { return "TessellatingPathBatch"; }
1399 1399
1400 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 1400 void computePipelineOptimizations(GrInitInvariantOutput* color,
1401 out->setKnownFourComponents(fColor); 1401 GrInitInvariantOutput* coverage,
1402 } 1402 GrBatchToXPOverrides* overrides) const ove rride {
1403 1403 color->setKnownFourComponents(fColor);
1404 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 1404 coverage->setUnknownSingleComponent();
1405 out->setUnknownSingleComponent(); 1405 overrides->fUsePLSDstRead = false;
1406 } 1406 }
1407 1407
1408 private: 1408 private:
1409 void initBatchTracker(const GrPipelineOptimizations& opt) override { 1409 void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
1410 // Handle any color overrides 1410 // Handle any color overrides
1411 if (!opt.readsColor()) { 1411 if (!overrides.readsColor()) {
1412 fColor = GrColor_ILLEGAL; 1412 fColor = GrColor_ILLEGAL;
1413 } 1413 }
1414 opt.getOverrideColorIfSet(&fColor); 1414 overrides.getOverrideColorIfSet(&fColor);
1415 fPipelineInfo = opt; 1415 fPipelineInfo = overrides;
1416 } 1416 }
1417 1417
1418 int tessellate(GrUniqueKey* key, 1418 int tessellate(GrUniqueKey* key,
1419 GrResourceProvider* resourceProvider, 1419 GrResourceProvider* resourceProvider,
1420 SkAutoTUnref<GrVertexBuffer>& vertexBuffer, 1420 SkAutoTUnref<GrVertexBuffer>& vertexBuffer,
1421 bool canMapVB) { 1421 bool canMapVB) {
1422 SkPath path; 1422 SkPath path;
1423 GrStrokeInfo stroke(fStroke); 1423 GrStrokeInfo stroke(fStroke);
1424 if (stroke.isDashed()) { 1424 if (stroke.isDashed()) {
1425 if (!stroke.applyDashToPath(&path, &stroke, fPath)) { 1425 if (!stroke.applyDashToPath(&path, &stroke, fPath)) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 fBounds.outset(radius, radius); 1614 fBounds.outset(radius, radius);
1615 } 1615 }
1616 viewMatrix.mapRect(&fBounds); 1616 viewMatrix.mapRect(&fBounds);
1617 } 1617 }
1618 1618
1619 GrColor fColor; 1619 GrColor fColor;
1620 SkPath fPath; 1620 SkPath fPath;
1621 GrStrokeInfo fStroke; 1621 GrStrokeInfo fStroke;
1622 SkMatrix fViewMatrix; 1622 SkMatrix fViewMatrix;
1623 SkRect fClipBounds; // in source space 1623 SkRect fClipBounds; // in source space
1624 GrPipelineOptimizations fPipelineInfo; 1624 GrXPOverridesForBatch fPipelineInfo;
1625 1625
1626 typedef GrVertexBatch INHERITED; 1626 typedef GrVertexBatch INHERITED;
1627 }; 1627 };
1628 1628
1629 bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { 1629 bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
1630 SkASSERT(!args.fAntiAlias); 1630 SkASSERT(!args.fAntiAlias);
1631 const GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget(); 1631 const GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget();
1632 if (nullptr == rt) { 1632 if (nullptr == rt) {
1633 return false; 1633 return false;
1634 } 1634 }
(...skipping 27 matching lines...) Expand all
1662 bool result = viewMatrix.invert(&vmi); 1662 bool result = viewMatrix.invert(&vmi);
1663 if (!result) { 1663 if (!result) {
1664 SkFAIL("Cannot invert matrix\n"); 1664 SkFAIL("Cannot invert matrix\n");
1665 } 1665 }
1666 vmi.mapRect(&clipBounds); 1666 vmi.mapRect(&clipBounds);
1667 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); 1667 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random);
1668 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds); 1668 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds);
1669 } 1669 }
1670 1670
1671 #endif 1671 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrTInstanceBatch.h ('k') | src/gpu/batches/GrTestBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698