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