OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 } | 716 } |
717 const GrDrawState& drawState = target->getDrawState(); | 717 const GrDrawState& drawState = target->getDrawState(); |
718 if (drawState.getRenderTarget()->isMultisampled()) { | 718 if (drawState.getRenderTarget()->isMultisampled()) { |
719 return false; | 719 return false; |
720 } | 720 } |
721 | 721 |
722 if (0 == strokeWidth && target->willUseHWAALines()) { | 722 if (0 == strokeWidth && target->willUseHWAALines()) { |
723 return false; | 723 return false; |
724 } | 724 } |
725 | 725 |
726 #ifdef SHADER_AA_FILL_RECT | 726 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) |
727 if (strokeWidth >= 0) { | 727 if (strokeWidth >= 0) { |
728 #endif | 728 #endif |
729 if (!drawState.getViewMatrix().preservesAxisAlignment()) { | 729 if (!drawState.getViewMatrix().preservesAxisAlignment()) { |
730 return false; | 730 return false; |
731 } | 731 } |
732 | 732 |
733 if (NULL != matrix && !matrix->preservesAxisAlignment()) { | 733 if (NULL != matrix && !matrix->preservesAxisAlignment()) { |
734 return false; | 734 return false; |
735 } | 735 } |
736 #ifdef SHADER_AA_FILL_RECT | 736 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) |
737 } else { | 737 } else { |
738 if (!drawState.getViewMatrix().preservesAxisAlignment() && | 738 if (!drawState.getViewMatrix().preservesAxisAlignment() && |
739 !drawState.getViewMatrix().preservesRightAngles()) { | 739 !drawState.getViewMatrix().preservesRightAngles()) { |
740 return false; | 740 return false; |
741 } | 741 } |
742 | 742 |
743 if (NULL != matrix && !matrix->preservesRightAngles()) { | 743 if (NULL != matrix && !matrix->preservesRightAngles()) { |
744 return false; | 744 return false; |
745 } | 745 } |
746 } | 746 } |
747 #endif | 747 #endif |
748 | 748 |
749 *combinedMatrix = drawState.getViewMatrix(); | 749 *combinedMatrix = drawState.getViewMatrix(); |
750 if (NULL != matrix) { | 750 if (NULL != matrix) { |
751 combinedMatrix->preConcat(*matrix); | 751 combinedMatrix->preConcat(*matrix); |
752 | 752 |
753 #if GR_DEBUG | 753 #if GR_DEBUG |
754 #ifdef SHADER_AA_FILL_RECT | 754 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) |
755 if (strokeWidth >= 0) { | 755 if (strokeWidth >= 0) { |
756 #endif | 756 #endif |
757 GrAssert(combinedMatrix->preservesAxisAlignment()); | 757 GrAssert(combinedMatrix->preservesAxisAlignment()); |
758 #ifdef SHADER_AA_FILL_RECT | 758 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) |
759 } else { | 759 } else { |
760 GrAssert(combinedMatrix->preservesRightAngles()); | 760 GrAssert(combinedMatrix->preservesRightAngles()); |
761 } | 761 } |
762 #endif | 762 #endif |
763 #endif | 763 #endif |
764 } | 764 } |
765 | 765 |
766 combinedMatrix->mapRect(devRect, rect); | 766 combinedMatrix->mapRect(devRect, rect); |
767 | 767 |
768 if (strokeWidth < 0) { | 768 if (strokeWidth < 0 |
| 769 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) |
| 770 && drawState.getViewMatrix().preservesAxisAlignment() |
| 771 #endif |
| 772 ) { |
769 return !isIRect(*devRect); | 773 return !isIRect(*devRect); |
770 } else { | 774 } else { |
771 return true; | 775 return true; |
772 } | 776 } |
773 } | 777 } |
774 | 778 |
775 void GrContext::drawRect(const GrPaint& paint, | 779 void GrContext::drawRect(const GrPaint& paint, |
776 const GrRect& rect, | 780 const GrRect& rect, |
777 SkScalar width, | 781 SkScalar width, |
778 const SkMatrix* matrix) { | 782 const SkMatrix* matrix) { |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1802 return srcTexture; | 1806 return srcTexture; |
1803 } | 1807 } |
1804 } | 1808 } |
1805 | 1809 |
1806 /////////////////////////////////////////////////////////////////////////////// | 1810 /////////////////////////////////////////////////////////////////////////////// |
1807 #if GR_CACHE_STATS | 1811 #if GR_CACHE_STATS |
1808 void GrContext::printCacheStats() const { | 1812 void GrContext::printCacheStats() const { |
1809 fTextureCache->printStats(); | 1813 fTextureCache->printStats(); |
1810 } | 1814 } |
1811 #endif | 1815 #endif |
OLD | NEW |