| 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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 | 780 |
| 781 GrRect devRect; | 781 GrRect devRect; |
| 782 SkMatrix combinedMatrix; | 782 SkMatrix combinedMatrix; |
| 783 bool useVertexCoverage; | 783 bool useVertexCoverage; |
| 784 bool needAA = paint.isAntiAlias() && | 784 bool needAA = paint.isAntiAlias() && |
| 785 !this->getRenderTarget()->isMultisampled(); | 785 !this->getRenderTarget()->isMultisampled(); |
| 786 bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, | 786 bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, |
| 787 &combinedMatrix, &devRect, | 787 &combinedMatrix, &devRect, |
| 788 &useVertexCoverage); | 788 &useVertexCoverage); |
| 789 if (doAA) { | 789 if (doAA) { |
| 790 GrDrawState::AutoDeviceCoordDraw adcd(target->drawState()); | 790 GrDrawState::AutoViewMatrixRestore avmr; |
| 791 if (!adcd.succeeded()) { | 791 if (!avmr.setIdentity(target->drawState())) { |
| 792 return; | 792 return; |
| 793 } | 793 } |
| 794 if (width >= 0) { | 794 if (width >= 0) { |
| 795 fAARectRenderer->strokeAARect(this->getGpu(), target, | 795 fAARectRenderer->strokeAARect(this->getGpu(), target, |
| 796 rect, combinedMatrix, devRect, | 796 rect, combinedMatrix, devRect, |
| 797 width, useVertexCoverage); | 797 width, useVertexCoverage); |
| 798 } else { | 798 } else { |
| 799 // filled AA rect | 799 // filled AA rect |
| 800 fAARectRenderer->fillAARect(this->getGpu(), target, | 800 fAARectRenderer->fillAARect(this->getGpu(), target, |
| 801 rect, combinedMatrix, devRect, | 801 rect, combinedMatrix, devRect, |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); | 1059 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); |
| 1060 GrDrawState::AutoStageDisable atr(fDrawState); | 1060 GrDrawState::AutoStageDisable atr(fDrawState); |
| 1061 | 1061 |
| 1062 bool useAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled
(); | 1062 bool useAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled
(); |
| 1063 if (useAA && stroke.getWidth() < 0 && !path.isConvex()) { | 1063 if (useAA && stroke.getWidth() < 0 && !path.isConvex()) { |
| 1064 // Concave AA paths are expensive - try to avoid them for special cases | 1064 // Concave AA paths are expensive - try to avoid them for special cases |
| 1065 bool useVertexCoverage; | 1065 bool useVertexCoverage; |
| 1066 SkRect rects[2]; | 1066 SkRect rects[2]; |
| 1067 | 1067 |
| 1068 if (is_nested_rects(target, path, stroke, rects, &useVertexCoverage)) { | 1068 if (is_nested_rects(target, path, stroke, rects, &useVertexCoverage)) { |
| 1069 GrDrawState::AutoDeviceCoordDraw adcd(target->drawState()); | 1069 SkMatrix origViewMatrix = target->getDrawState().getViewMatrix(); |
| 1070 if (!adcd.succeeded()) { | 1070 GrDrawState::AutoViewMatrixRestore avmr; |
| 1071 if (!avmr.setIdentity(target->drawState())) { |
| 1071 return; | 1072 return; |
| 1072 } | 1073 } |
| 1073 | 1074 |
| 1074 fAARectRenderer->fillAANestedRects(this->getGpu(), target, | 1075 fAARectRenderer->fillAANestedRects(this->getGpu(), target, |
| 1075 rects, | 1076 rects, |
| 1076 adcd.getOriginalMatrix(), | 1077 origViewMatrix, |
| 1077 useVertexCoverage); | 1078 useVertexCoverage); |
| 1078 return; | 1079 return; |
| 1079 } | 1080 } |
| 1080 } | 1081 } |
| 1081 | 1082 |
| 1082 SkRect ovalRect; | 1083 SkRect ovalRect; |
| 1083 bool isOval = path.isOval(&ovalRect); | 1084 bool isOval = path.isOval(&ovalRect); |
| 1084 | 1085 |
| 1085 if (!isOval || path.isInverseFillType() | 1086 if (!isOval || path.isInverseFillType() |
| 1086 || !fOvalRenderer->drawOval(target, this, useAA, ovalRect, stroke)) { | 1087 || !fOvalRenderer->drawOval(target, this, useAA, ovalRect, stroke)) { |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 return srcTexture; | 1862 return srcTexture; |
| 1862 } | 1863 } |
| 1863 } | 1864 } |
| 1864 | 1865 |
| 1865 /////////////////////////////////////////////////////////////////////////////// | 1866 /////////////////////////////////////////////////////////////////////////////// |
| 1866 #if GR_CACHE_STATS | 1867 #if GR_CACHE_STATS |
| 1867 void GrContext::printCacheStats() const { | 1868 void GrContext::printCacheStats() const { |
| 1868 fTextureCache->printStats(); | 1869 fTextureCache->printStats(); |
| 1869 } | 1870 } |
| 1870 #endif | 1871 #endif |
| OLD | NEW |