| 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 #include "GrAAHairLinePathRenderer.h" | 9 #include "GrAAHairLinePathRenderer.h" |
| 10 | 10 |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 | 809 |
| 810 if (!this->createGeom(path, | 810 if (!this->createGeom(path, |
| 811 target, | 811 target, |
| 812 &lineCnt, | 812 &lineCnt, |
| 813 &quadCnt, | 813 &quadCnt, |
| 814 &arg, | 814 &arg, |
| 815 &devBounds)) { | 815 &devBounds)) { |
| 816 return false; | 816 return false; |
| 817 } | 817 } |
| 818 | 818 |
| 819 GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit); | 819 GrDrawTarget::AutoStateRestore asr; |
| 820 GrDrawState* drawState = target->drawState(); | |
| 821 | 820 |
| 822 GrDrawState::AutoDeviceCoordDraw adcd; | |
| 823 // createGeom transforms the geometry to device space when the matrix does n
ot have | 821 // createGeom transforms the geometry to device space when the matrix does n
ot have |
| 824 // perspective. | 822 // perspective. |
| 825 if (!drawState->getViewMatrix().hasPerspective()) { | 823 if (target->getDrawState().getViewMatrix().hasPerspective()) { |
| 826 adcd.set(drawState); | 824 asr.set(target, GrDrawTarget::kPreserve_ASRInit); |
| 827 if (!adcd.succeeded()) { | 825 } else if (!asr.setIdentity(target, GrDrawTarget::kPreserve_ASRInit)) { |
| 828 return false; | 826 return false; |
| 829 } | |
| 830 } | 827 } |
| 828 GrDrawState* drawState = target->drawState(); |
| 831 | 829 |
| 832 // TODO: See whether rendering lines as degenerate quads improves perf | 830 // TODO: See whether rendering lines as degenerate quads improves perf |
| 833 // when we have a mix | 831 // when we have a mix |
| 834 | 832 |
| 835 enum { | 833 enum { |
| 836 // the edge effects share this stage with glyph rendering | 834 // the edge effects share this stage with glyph rendering |
| 837 // (kGlyphMaskStage in GrTextContext) && SW path rendering | 835 // (kGlyphMaskStage in GrTextContext) && SW path rendering |
| 838 // (kPathMaskStage in GrSWMaskHelper) | 836 // (kPathMaskStage in GrSWMaskHelper) |
| 839 kEdgeEffectStage = GrPaint::kTotalStages, | 837 kEdgeEffectStage = GrPaint::kTotalStages, |
| 840 }; | 838 }; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 0, // startI | 893 0, // startI |
| 896 kVertsPerQuad*n, // vCount | 894 kVertsPerQuad*n, // vCount |
| 897 kIdxsPerQuad*n, // iCount | 895 kIdxsPerQuad*n, // iCount |
| 898 &devBounds); | 896 &devBounds); |
| 899 quads += n; | 897 quads += n; |
| 900 } | 898 } |
| 901 target->resetIndexSource(); | 899 target->resetIndexSource(); |
| 902 | 900 |
| 903 return true; | 901 return true; |
| 904 } | 902 } |
| OLD | NEW |