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

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

Issue 1352813003: add a ClassID function to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 3 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 "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) cons t { 1378 bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) cons t {
1379 // This path renderer can draw all fill styles, all stroke styles except hai rlines, but does 1379 // This path renderer can draw all fill styles, all stroke styles except hai rlines, but does
1380 // not do antialiasing. It can do convex and concave paths, but we'll leave the convex ones to 1380 // not do antialiasing. It can do convex and concave paths, but we'll leave the convex ones to
1381 // simpler algorithms. 1381 // simpler algorithms.
1382 return !IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, nullp tr) && 1382 return !IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, nullp tr) &&
1383 !args.fAntiAlias && !args.fPath->isConvex(); 1383 !args.fAntiAlias && !args.fPath->isConvex();
1384 } 1384 }
1385 1385
1386 class TessellatingPathBatch : public GrVertexBatch { 1386 class TessellatingPathBatch : public GrVertexBatch {
1387 public: 1387 public:
1388
1389 static GrDrawBatch* Create(const GrColor& color, 1388 static GrDrawBatch* Create(const GrColor& color,
1390 const SkPath& path, 1389 const SkPath& path,
1391 const GrStrokeInfo& stroke, 1390 const GrStrokeInfo& stroke,
1392 const SkMatrix& viewMatrix, 1391 const SkMatrix& viewMatrix,
1393 SkRect clipBounds) { 1392 SkRect clipBounds) {
1394 return new TessellatingPathBatch(color, path, stroke, viewMatrix, clipBo unds); 1393 return new TessellatingPathBatch(color, path, stroke, viewMatrix, clipBo unds);
1395 } 1394 }
1396 1395
1396 BATCH_CLASS_ID
1397
1397 const char* name() const override { return "TessellatingPathBatch"; } 1398 const char* name() const override { return "TessellatingPathBatch"; }
1398 1399
1399 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 1400 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
1400 out->setKnownFourComponents(fColor); 1401 out->setKnownFourComponents(fColor);
1401 } 1402 }
1402 1403
1403 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 1404 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
1404 out->setUnknownSingleComponent(); 1405 out->setUnknownSingleComponent();
1405 } 1406 }
1406 1407
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 bool result = viewMatrix.invert(&vmi); 1653 bool result = viewMatrix.invert(&vmi);
1653 if (!result) { 1654 if (!result) {
1654 SkFAIL("Cannot invert matrix\n"); 1655 SkFAIL("Cannot invert matrix\n");
1655 } 1656 }
1656 vmi.mapRect(&clipBounds); 1657 vmi.mapRect(&clipBounds);
1657 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); 1658 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random);
1658 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds); 1659 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds);
1659 } 1660 }
1660 1661
1661 #endif 1662 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698