| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 } | 738 } |
| 739 | 739 |
| 740 static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po
int) { | 740 static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po
int) { |
| 741 return point.fX >= rect.fLeft && point.fX <= rect.fRight && | 741 return point.fX >= rect.fLeft && point.fX <= rect.fRight && |
| 742 point.fY >= rect.fTop && point.fY <= rect.fBottom; | 742 point.fY >= rect.fTop && point.fY <= rect.fBottom; |
| 743 } | 743 } |
| 744 | 744 |
| 745 void GrContext::drawRect(const GrPaint& paint, | 745 void GrContext::drawRect(const GrPaint& paint, |
| 746 const SkRect& rect, | 746 const SkRect& rect, |
| 747 SkScalar width, | 747 SkScalar width, |
| 748 const SkMatrix* matrix) { | 748 const SkMatrix* matrix, |
| 749 bool miterStroke) { |
| 749 SK_TRACE_EVENT0("GrContext::drawRect"); | 750 SK_TRACE_EVENT0("GrContext::drawRect"); |
| 750 | 751 |
| 751 AutoRestoreEffects are; | 752 AutoRestoreEffects are; |
| 752 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); | 753 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); |
| 753 | 754 |
| 754 SkMatrix combinedMatrix = target->drawState()->getViewMatrix(); | 755 SkMatrix combinedMatrix = target->drawState()->getViewMatrix(); |
| 755 if (NULL != matrix) { | 756 if (NULL != matrix) { |
| 756 combinedMatrix.preConcat(*matrix); | 757 combinedMatrix.preConcat(*matrix); |
| 757 } | 758 } |
| 758 | 759 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 bool needAA = paint.isAntiAlias() && | 797 bool needAA = paint.isAntiAlias() && |
| 797 !target->getDrawState().getRenderTarget()->isMultisampled(); | 798 !target->getDrawState().getRenderTarget()->isMultisampled(); |
| 798 bool doAA = needAA && apply_aa_to_rect(target, rect, width, combinedMatrix,
&devBoundRect, | 799 bool doAA = needAA && apply_aa_to_rect(target, rect, width, combinedMatrix,
&devBoundRect, |
| 799 &useVertexCoverage); | 800 &useVertexCoverage); |
| 800 if (doAA) { | 801 if (doAA) { |
| 801 GrDrawState::AutoViewMatrixRestore avmr; | 802 GrDrawState::AutoViewMatrixRestore avmr; |
| 802 if (!avmr.setIdentity(target->drawState())) { | 803 if (!avmr.setIdentity(target->drawState())) { |
| 803 return; | 804 return; |
| 804 } | 805 } |
| 805 if (width >= 0) { | 806 if (width >= 0) { |
| 806 fAARectRenderer->strokeAARect(this->getGpu(), target, | 807 fAARectRenderer->strokeAARect(this->getGpu(), target, rect, |
| 807 rect, combinedMatrix, devBoundRect, | 808 combinedMatrix, devBoundRect, width, |
| 808 width, useVertexCoverage); | 809 useVertexCoverage, miterStroke); |
| 809 } else { | 810 } else { |
| 810 // filled AA rect | 811 // filled AA rect |
| 811 fAARectRenderer->fillAARect(this->getGpu(), target, | 812 fAARectRenderer->fillAARect(this->getGpu(), target, |
| 812 rect, combinedMatrix, devBoundRect, | 813 rect, combinedMatrix, devBoundRect, |
| 813 useVertexCoverage); | 814 useVertexCoverage); |
| 814 } | 815 } |
| 815 return; | 816 return; |
| 816 } | 817 } |
| 817 | 818 |
| 818 if (width >= 0) { | 819 if (width >= 0) { |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 return NULL; | 1744 return NULL; |
| 1744 } | 1745 } |
| 1745 } | 1746 } |
| 1746 | 1747 |
| 1747 /////////////////////////////////////////////////////////////////////////////// | 1748 /////////////////////////////////////////////////////////////////////////////// |
| 1748 #if GR_CACHE_STATS | 1749 #if GR_CACHE_STATS |
| 1749 void GrContext::printCacheStats() const { | 1750 void GrContext::printCacheStats() const { |
| 1750 fTextureCache->printStats(); | 1751 fTextureCache->printStats(); |
| 1751 } | 1752 } |
| 1752 #endif | 1753 #endif |
| OLD | NEW |