| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrAARectRenderer.h" | 8 #include "GrAARectRenderer.h" |
| 9 #include "GrBatch.h" | 9 #include "GrBatch.h" |
| 10 #include "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 504 |
| 505 bool miterStroke = true; | 505 bool miterStroke = true; |
| 506 // For hairlines, make bevel and round joins appear the same as mitered ones
. | 506 // For hairlines, make bevel and round joins appear the same as mitered ones
. |
| 507 // small miter limit means right angles show bevel... | 507 // small miter limit means right angles show bevel... |
| 508 if ((width > 0) && (stroke.getJoin() != SkPaint::kMiter_Join || | 508 if ((width > 0) && (stroke.getJoin() != SkPaint::kMiter_Join || |
| 509 stroke.getMiter() < SK_ScalarSqrt2)) { | 509 stroke.getMiter() < SK_ScalarSqrt2)) { |
| 510 miterStroke = false; | 510 miterStroke = false; |
| 511 } | 511 } |
| 512 | 512 |
| 513 if (spare <= 0 && miterStroke) { | 513 if (spare <= 0 && miterStroke) { |
| 514 this->fillAARect(target, pipelineBuilder, color, viewMatrix, devOutside, | 514 this->fillAARect(target, pipelineBuilder, color, viewMatrix, devOutside,
devOutside); |
| 515 devOutside); | |
| 516 return; | 515 return; |
| 517 } | 516 } |
| 518 | 517 |
| 519 SkRect devInside(devRect); | 518 SkRect devInside(devRect); |
| 520 devInside.inset(rx, ry); | 519 devInside.inset(rx, ry); |
| 521 | 520 |
| 522 SkRect devOutsideAssist(devRect); | 521 SkRect devOutsideAssist(devRect); |
| 523 | 522 |
| 524 // For bevel-stroke, use 2 SkRect instances(devOutside and devOutsideAssist) | 523 // For bevel-stroke, use 2 SkRect instances(devOutside and devOutsideAssist) |
| 525 // to draw the outer of the rect. Because there are 8 vertices on the outer | 524 // to draw the outer of the rect. Because there are 8 vertices on the outer |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 const SkRect rects[2]) { | 869 const SkRect rects[2]) { |
| 871 SkASSERT(viewMatrix.rectStaysRect()); | 870 SkASSERT(viewMatrix.rectStaysRect()); |
| 872 SkASSERT(!rects[1].isEmpty()); | 871 SkASSERT(!rects[1].isEmpty()); |
| 873 | 872 |
| 874 SkRect devOutside, devOutsideAssist, devInside; | 873 SkRect devOutside, devOutsideAssist, devInside; |
| 875 viewMatrix.mapRect(&devOutside, rects[0]); | 874 viewMatrix.mapRect(&devOutside, rects[0]); |
| 876 // can't call mapRect for devInside since it calls sort | 875 // can't call mapRect for devInside since it calls sort |
| 877 viewMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2); | 876 viewMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2); |
| 878 | 877 |
| 879 if (devInside.isEmpty()) { | 878 if (devInside.isEmpty()) { |
| 880 this->fillAARect(target, pipelineBuilder, color, viewMatrix, devOutside, | 879 this->fillAARect(target, pipelineBuilder, color, viewMatrix, devOutside,
devOutside); |
| 881 devOutside); | |
| 882 return; | 880 return; |
| 883 } | 881 } |
| 884 | 882 |
| 885 this->geometryStrokeAARect(target, pipelineBuilder, color, viewMatrix, devOu
tside, | 883 this->geometryStrokeAARect(target, pipelineBuilder, color, viewMatrix, devOu
tside, |
| 886 devOutsideAssist, devInside, true); | 884 devOutsideAssist, devInside, true); |
| 887 } | 885 } |
| OLD | NEW |