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: src/gpu/GrDefaultPathRenderer.cpp

Issue 1129203002: Adding unit tests for limited subset of DefaultPathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more tidying Created 5 years, 7 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 | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
11 #include "GrBatchTarget.h" 11 #include "GrBatchTarget.h"
12 #include "GrBatchTest.h"
12 #include "GrBufferAllocPool.h" 13 #include "GrBufferAllocPool.h"
13 #include "GrContext.h" 14 #include "GrContext.h"
14 #include "GrDefaultGeoProcFactory.h" 15 #include "GrDefaultGeoProcFactory.h"
15 #include "GrPathUtils.h" 16 #include "GrPathUtils.h"
16 #include "GrPipelineBuilder.h" 17 #include "GrPipelineBuilder.h"
17 #include "GrVertices.h" 18 #include "GrVertices.h"
18 #include "SkGeometry.h" 19 #include "SkGeometry.h"
19 #include "SkString.h" 20 #include "SkString.h"
20 #include "SkStrokeRec.h" 21 #include "SkStrokeRec.h"
21 #include "SkTLazy.h" 22 #include "SkTLazy.h"
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 742
742 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, 743 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
743 GrPipelineBuilder* pipelineBuilder, 744 GrPipelineBuilder* pipelineBuilder,
744 const SkMatrix& viewMatrix, 745 const SkMatrix& viewMatrix,
745 const SkPath& path, 746 const SkPath& path,
746 const GrStrokeInfo& stroke) { 747 const GrStrokeInfo& stroke) {
747 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 748 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
748 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); 749 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
749 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true); 750 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true);
750 } 751 }
752
753 //////////////////////////////////////////////////////////////////////////////// ///////////////////
754
755 #ifdef GR_TEST_UTILS
756
757 BATCH_TEST_DEFINE(DefaultPathRenderer) {
758 GrColor color = GrRandomColor(random);
759 SkMatrix viewMatrix = GrTest::TestMatrix(random);
760
761 // For now just hairlines because the other types of draws require two batch es.
762 // TODO we should figure out a way to combine the stencil and cover steps in to one batch
763 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
764 SkPath path = GrTest::TestPath(random);
765
766 // Compute srcSpaceTol
767 SkRect bounds = path.getBounds();
768 SkScalar tol = GrPathUtils::kDefaultTolerance;
769 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou nds);
770
771 DefaultPathBatch::Geometry geometry;
772 geometry.fColor = color;
773 geometry.fPath = path;
774 geometry.fTolerance = srcSpaceTol;
775
776 viewMatrix.mapRect(&bounds);
777 uint8_t coverage = GrRandomCoverage(random);
778 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds );
779 }
780
781 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698