| OLD | NEW |
| 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 "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 /////////////////////////////////////////////////////////////////////////////// | 603 /////////////////////////////////////////////////////////////////////////////// |
| 604 | 604 |
| 605 bool GrOvalRenderer::DrawOval(GrDrawTarget* target, | 605 bool GrOvalRenderer::DrawOval(GrDrawTarget* target, |
| 606 GrPipelineBuilder* pipelineBuilder, | 606 GrPipelineBuilder* pipelineBuilder, |
| 607 GrColor color, | 607 GrColor color, |
| 608 const SkMatrix& viewMatrix, | 608 const SkMatrix& viewMatrix, |
| 609 bool useAA, | 609 bool useAA, |
| 610 const SkRect& oval, | 610 const SkRect& oval, |
| 611 const SkStrokeRec& stroke) | 611 const SkStrokeRec& stroke) |
| 612 { | 612 { |
| 613 bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isMultisa
mpled(); | 613 bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isUnified
Multisampled(); |
| 614 | 614 |
| 615 if (!useCoverageAA) { | 615 if (!useCoverageAA) { |
| 616 return false; | 616 return false; |
| 617 } | 617 } |
| 618 | 618 |
| 619 // we can draw circles | 619 // we can draw circles |
| 620 if (SkScalarNearlyEqual(oval.width(), oval.height()) && circle_stays_circle(
viewMatrix)) { | 620 if (SkScalarNearlyEqual(oval.width(), oval.height()) && circle_stays_circle(
viewMatrix)) { |
| 621 DrawCircle(target, pipelineBuilder, color, viewMatrix, useCoverageAA, ov
al, stroke); | 621 DrawCircle(target, pipelineBuilder, color, viewMatrix, useCoverageAA, ov
al, stroke); |
| 622 // if we have shader derivative support, render as device-independent | 622 // if we have shader derivative support, render as device-independent |
| 623 } else if (target->caps()->shaderCaps()->shaderDerivativeSupport()) { | 623 } else if (target->caps()->shaderCaps()->shaderDerivativeSupport()) { |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, | 1399 bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, |
| 1400 GrPipelineBuilder* pipelineBuilder, | 1400 GrPipelineBuilder* pipelineBuilder, |
| 1401 GrColor color, | 1401 GrColor color, |
| 1402 const SkMatrix& viewMatrix, | 1402 const SkMatrix& viewMatrix, |
| 1403 bool useAA, | 1403 bool useAA, |
| 1404 const SkRRect& origOuter, | 1404 const SkRRect& origOuter, |
| 1405 const SkRRect& origInner) { | 1405 const SkRRect& origInner) { |
| 1406 bool applyAA = useAA && | 1406 bool applyAA = useAA && |
| 1407 !pipelineBuilder->getRenderTarget()->isMultisampled(); | 1407 !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled(); |
| 1408 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 1408 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
| 1409 if (!origInner.isEmpty()) { | 1409 if (!origInner.isEmpty()) { |
| 1410 SkTCopyOnFirstWrite<SkRRect> inner(origInner); | 1410 SkTCopyOnFirstWrite<SkRRect> inner(origInner); |
| 1411 if (!viewMatrix.isIdentity()) { | 1411 if (!viewMatrix.isIdentity()) { |
| 1412 if (!origInner.transform(viewMatrix, inner.writable())) { | 1412 if (!origInner.transform(viewMatrix, inner.writable())) { |
| 1413 return false; | 1413 return false; |
| 1414 } | 1414 } |
| 1415 } | 1415 } |
| 1416 GrPrimitiveEdgeType edgeType = applyAA ? | 1416 GrPrimitiveEdgeType edgeType = applyAA ? |
| 1417 kInverseFillAA_GrProcessorEdgeType : | 1417 kInverseFillAA_GrProcessorEdgeType : |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 GrColor color, | 1971 GrColor color, |
| 1972 const SkMatrix& viewMatrix, | 1972 const SkMatrix& viewMatrix, |
| 1973 bool useAA, | 1973 bool useAA, |
| 1974 const SkRRect& rrect, | 1974 const SkRRect& rrect, |
| 1975 const SkStrokeRec& stroke) { | 1975 const SkStrokeRec& stroke) { |
| 1976 if (rrect.isOval()) { | 1976 if (rrect.isOval()) { |
| 1977 return DrawOval(target, pipelineBuilder, color, viewMatrix, useAA, rrect
.getBounds(), | 1977 return DrawOval(target, pipelineBuilder, color, viewMatrix, useAA, rrect
.getBounds(), |
| 1978 stroke); | 1978 stroke); |
| 1979 } | 1979 } |
| 1980 | 1980 |
| 1981 bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isMultisa
mpled(); | 1981 bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isUnified
Multisampled(); |
| 1982 | 1982 |
| 1983 // only anti-aliased rrects for now | 1983 // only anti-aliased rrects for now |
| 1984 if (!useCoverageAA) { | 1984 if (!useCoverageAA) { |
| 1985 return false; | 1985 return false; |
| 1986 } | 1986 } |
| 1987 | 1987 |
| 1988 if (!viewMatrix.rectStaysRect() || !rrect.isSimple()) { | 1988 if (!viewMatrix.rectStaysRect() || !rrect.isSimple()) { |
| 1989 return false; | 1989 return false; |
| 1990 } | 1990 } |
| 1991 | 1991 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 } | 2029 } |
| 2030 | 2030 |
| 2031 BATCH_TEST_DEFINE(RRectBatch) { | 2031 BATCH_TEST_DEFINE(RRectBatch) { |
| 2032 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2032 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 2033 GrColor color = GrRandomColor(random); | 2033 GrColor color = GrRandomColor(random); |
| 2034 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2034 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 2035 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2035 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 #endif | 2038 #endif |
| OLD | NEW |