| 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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 } | 1416 } |
| 1417 GrPrimitiveEdgeType edgeType = applyAA ? | 1417 GrPrimitiveEdgeType edgeType = applyAA ? |
| 1418 kInverseFillAA_GrProcessorEdgeType : | 1418 kInverseFillAA_GrProcessorEdgeType : |
| 1419 kInverseFillBW_GrProcessorEdgeType; | 1419 kInverseFillBW_GrProcessorEdgeType; |
| 1420 // TODO this needs to be a geometry processor | 1420 // TODO this needs to be a geometry processor |
| 1421 GrFragmentProcessor* fp = GrRRectEffect::Create(edgeType, *inner); | 1421 GrFragmentProcessor* fp = GrRRectEffect::Create(edgeType, *inner); |
| 1422 if (NULL == fp) { | 1422 if (NULL == fp) { |
| 1423 return false; | 1423 return false; |
| 1424 } | 1424 } |
| 1425 arfps.set(&pipelineBuilder); | 1425 arfps.set(&pipelineBuilder); |
| 1426 arfps.addCoverageFragmentProcessor(fp)->unref(); | 1426 arfps.addCoverageProcessor(fp)->unref(); |
| 1427 } | 1427 } |
| 1428 | 1428 |
| 1429 SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle); | 1429 SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle); |
| 1430 if (DrawRRect(target, pipelineBuilder, color, viewMatrix, useAA, origOuter,
fillRec)) { | 1430 if (DrawRRect(target, pipelineBuilder, color, viewMatrix, useAA, origOuter,
fillRec)) { |
| 1431 return true; | 1431 return true; |
| 1432 } | 1432 } |
| 1433 | 1433 |
| 1434 SkASSERT(!origOuter.isEmpty()); | 1434 SkASSERT(!origOuter.isEmpty()); |
| 1435 SkTCopyOnFirstWrite<SkRRect> outer(origOuter); | 1435 SkTCopyOnFirstWrite<SkRRect> outer(origOuter); |
| 1436 if (!viewMatrix.isIdentity()) { | 1436 if (!viewMatrix.isIdentity()) { |
| 1437 if (!origOuter.transform(viewMatrix, outer.writable())) { | 1437 if (!origOuter.transform(viewMatrix, outer.writable())) { |
| 1438 return false; | 1438 return false; |
| 1439 } | 1439 } |
| 1440 } | 1440 } |
| 1441 GrPrimitiveEdgeType edgeType = applyAA ? kFillAA_GrProcessorEdgeType : | 1441 GrPrimitiveEdgeType edgeType = applyAA ? kFillAA_GrProcessorEdgeType : |
| 1442 kFillBW_GrProcessorEdgeType; | 1442 kFillBW_GrProcessorEdgeType; |
| 1443 GrFragmentProcessor* effect = GrRRectEffect::Create(edgeType, *outer); | 1443 GrFragmentProcessor* effect = GrRRectEffect::Create(edgeType, *outer); |
| 1444 if (NULL == effect) { | 1444 if (NULL == effect) { |
| 1445 return false; | 1445 return false; |
| 1446 } | 1446 } |
| 1447 if (!arfps.isSet()) { | 1447 if (!arfps.isSet()) { |
| 1448 arfps.set(&pipelineBuilder); | 1448 arfps.set(&pipelineBuilder); |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 SkMatrix invert; | 1451 SkMatrix invert; |
| 1452 if (!viewMatrix.invert(&invert)) { | 1452 if (!viewMatrix.invert(&invert)) { |
| 1453 return false; | 1453 return false; |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 arfps.addCoverageFragmentProcessor(effect)->unref(); | 1456 arfps.addCoverageProcessor(effect)->unref(); |
| 1457 SkRect bounds = outer->getBounds(); | 1457 SkRect bounds = outer->getBounds(); |
| 1458 if (applyAA) { | 1458 if (applyAA) { |
| 1459 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); | 1459 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
| 1460 } | 1460 } |
| 1461 target->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), bounds, invert)
; | 1461 target->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), bounds, invert)
; |
| 1462 return true; | 1462 return true; |
| 1463 } | 1463 } |
| 1464 | 1464 |
| 1465 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 1465 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 1466 | 1466 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 } | 2037 } |
| 2038 | 2038 |
| 2039 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 2039 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
| 2040 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2040 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 2041 GrColor color = GrRandomColor(random); | 2041 GrColor color = GrRandomColor(random); |
| 2042 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2042 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 2043 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2043 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
| 2044 } | 2044 } |
| 2045 | 2045 |
| 2046 #endif | 2046 #endif |
| OLD | NEW |