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

Side by Side Diff: src/gpu/GrOvalRenderer.cpp

Issue 1726223008: Hide GrPipelineBuilder from GrOvalRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « src/gpu/GrOvalRenderer.h ('k') | 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 2013 Google Inc. 2 * Copyright 2013 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 "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
11 #include "GrBatchTest.h" 11 #include "GrBatchTest.h"
12 #include "GrGeometryProcessor.h" 12 #include "GrGeometryProcessor.h"
13 #include "GrInvariantOutput.h" 13 #include "GrInvariantOutput.h"
14 #include "GrPipelineBuilder.h"
15 #include "GrProcessor.h" 14 #include "GrProcessor.h"
16 #include "GrResourceProvider.h" 15 #include "GrResourceProvider.h"
17 #include "SkRRect.h" 16 #include "SkRRect.h"
18 #include "SkStrokeRec.h" 17 #include "SkStrokeRec.h"
19 #include "batches/GrVertexBatch.h" 18 #include "batches/GrVertexBatch.h"
20 #include "glsl/GrGLSLFragmentShaderBuilder.h" 19 #include "glsl/GrGLSLFragmentShaderBuilder.h"
21 #include "glsl/GrGLSLGeometryProcessor.h" 20 #include "glsl/GrGLSLGeometryProcessor.h"
22 #include "glsl/GrGLSLProgramDataManager.h" 21 #include "glsl/GrGLSLProgramDataManager.h"
23 #include "glsl/GrGLSLVarying.h" 22 #include "glsl/GrGLSLVarying.h"
24 #include "glsl/GrGLSLVertexShaderBuilder.h" 23 #include "glsl/GrGLSLVertexShaderBuilder.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 572
574 const GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(GrProcessorTestData* d) { 573 const GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(GrProcessorTestData* d) {
575 return DIEllipseEdgeEffect::Create(GrRandomColor(d->fRandom), 574 return DIEllipseEdgeEffect::Create(GrRandomColor(d->fRandom),
576 GrTest::TestMatrix(d->fRandom), 575 GrTest::TestMatrix(d->fRandom),
577 (Mode)(d->fRandom->nextRangeU(0,2)), 576 (Mode)(d->fRandom->nextRangeU(0,2)),
578 d->fRandom->nextBool()); 577 d->fRandom->nextBool());
579 } 578 }
580 579
581 /////////////////////////////////////////////////////////////////////////////// 580 ///////////////////////////////////////////////////////////////////////////////
582 581
583 GrDrawBatch* GrOvalRenderer::CreateOvalBatch(const GrPipelineBuilder& pipelineBu ilder, 582 GrDrawBatch* GrOvalRenderer::CreateOvalBatch(GrColor color,
584 GrColor color,
585 const SkMatrix& viewMatrix, 583 const SkMatrix& viewMatrix,
586 bool useAA,
587 const SkRect& oval, 584 const SkRect& oval,
588 const SkStrokeRec& stroke, 585 const SkStrokeRec& stroke,
589 GrShaderCaps* shaderCaps) { 586 GrShaderCaps* shaderCaps) {
590 bool useCoverageAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedM ultisampled();
591 if (!useCoverageAA) {
592 return nullptr;
593 }
594
595 // we can draw circles 587 // we can draw circles
596 if (SkScalarNearlyEqual(oval.width(), oval.height()) && circle_stays_circle( viewMatrix)) { 588 if (SkScalarNearlyEqual(oval.width(), oval.height()) && circle_stays_circle( viewMatrix)) {
597 return CreateCircleBatch(color, viewMatrix, oval, stroke); 589 return CreateCircleBatch(color, viewMatrix, oval, stroke);
598 } 590 }
599 591
600 // if we have shader derivative support, render as device-independent 592 // if we have shader derivative support, render as device-independent
601 if (shaderCaps->shaderDerivativeSupport()) { 593 if (shaderCaps->shaderDerivativeSupport()) {
602 return CreateDIEllipseBatch(color, viewMatrix, oval, stroke); 594 return CreateDIEllipseBatch(color, viewMatrix, oval, stroke);
603 } 595 }
604 596
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 geometry.fYRadius = yRadius; 1875 geometry.fYRadius = yRadius;
1884 geometry.fInnerXRadius = innerXRadius; 1876 geometry.fInnerXRadius = innerXRadius;
1885 geometry.fInnerYRadius = innerYRadius; 1877 geometry.fInnerYRadius = innerYRadius;
1886 geometry.fStroke = isStrokeOnly; 1878 geometry.fStroke = isStrokeOnly;
1887 geometry.fDevBounds = bounds; 1879 geometry.fDevBounds = bounds;
1888 1880
1889 return RRectEllipseRendererBatch::Create(geometry); 1881 return RRectEllipseRendererBatch::Create(geometry);
1890 } 1882 }
1891 } 1883 }
1892 1884
1893 GrDrawBatch* GrOvalRenderer::CreateRRectBatch(const GrPipelineBuilder& pipelineB uilder, 1885 GrDrawBatch* GrOvalRenderer::CreateRRectBatch(GrColor color,
1894 GrColor color,
1895 const SkMatrix& viewMatrix, 1886 const SkMatrix& viewMatrix,
1896 bool useAA,
1897 const SkRRect& rrect, 1887 const SkRRect& rrect,
1898 const SkStrokeRec& stroke, 1888 const SkStrokeRec& stroke,
1899 GrShaderCaps* shaderCaps) { 1889 GrShaderCaps* shaderCaps) {
1900 bool useCoverageAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedM ultisampled();
1901
1902 // only anti-aliased rrects for now
1903 if (!useCoverageAA) {
1904 return nullptr;
1905 }
1906
1907 if (rrect.isOval()) { 1890 if (rrect.isOval()) {
1908 return CreateOvalBatch(pipelineBuilder, color, viewMatrix, useAA, 1891 return CreateOvalBatch(color, viewMatrix, rrect.getBounds(), stroke, sha derCaps);
1909 rrect.getBounds(), stroke, shaderCaps);
1910 } 1892 }
1911 1893
1912 if (!viewMatrix.rectStaysRect() || !rrect.isSimple()) { 1894 if (!viewMatrix.rectStaysRect() || !rrect.isSimple()) {
1913 return nullptr; 1895 return nullptr;
1914 } 1896 }
1915 1897
1916 return create_rrect_batch(color, viewMatrix, rrect, stroke); 1898 return create_rrect_batch(color, viewMatrix, rrect, stroke);
1917 } 1899 }
1918 1900
1919 //////////////////////////////////////////////////////////////////////////////// /////////////////// 1901 //////////////////////////////////////////////////////////////////////////////// ///////////////////
(...skipping 22 matching lines...) Expand all
1942 } 1924 }
1943 1925
1944 DRAW_BATCH_TEST_DEFINE(RRectBatch) { 1926 DRAW_BATCH_TEST_DEFINE(RRectBatch) {
1945 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 1927 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
1946 GrColor color = GrRandomColor(random); 1928 GrColor color = GrRandomColor(random);
1947 const SkRRect& rrect = GrTest::TestRRectSimple(random); 1929 const SkRRect& rrect = GrTest::TestRRectSimple(random);
1948 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); 1930 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom));
1949 } 1931 }
1950 1932
1951 #endif 1933 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698