Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: src/gpu/GrContext.cpp

Issue 818233002: Remove coordchanges from drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@coord-change-off-paint
Patch Set: adding test to ignore Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 736 }
737 } 737 }
738 738
739 GrColor color = paint.getColor(); 739 GrColor color = paint.getColor();
740 SkRect devBoundRect; 740 SkRect devBoundRect;
741 bool needAA = paint.isAntiAlias() && !drawState.getRenderTarget()->isMultisa mpled(); 741 bool needAA = paint.isAntiAlias() && !drawState.getRenderTarget()->isMultisa mpled();
742 bool doAA = needAA && apply_aa_to_rect(target, &drawState, &devBoundRect, re ct, width, matrix, 742 bool doAA = needAA && apply_aa_to_rect(target, &drawState, &devBoundRect, re ct, width, matrix,
743 color); 743 color);
744 744
745 if (doAA) { 745 if (doAA) {
746 GrDrawState::AutoViewMatrixRestore avmr; 746 SkMatrix invert;
747 if (!avmr.setIdentity(&drawState)) { 747 if (!drawState.getViewMatrix().invert(&invert)) {
748 return; 748 return;
749 } 749 }
750 GrDrawState::AutoViewMatrixRestore avmr(&drawState);
750 751
751 if (width >= 0) { 752 if (width >= 0) {
752 const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec(); 753 const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec();
753 fAARectRenderer->strokeAARect(target, 754 fAARectRenderer->strokeAARect(target,
754 &drawState, 755 &drawState,
755 color, 756 color,
757 invert,
756 rect, 758 rect,
757 matrix, 759 matrix,
758 devBoundRect, 760 devBoundRect,
759 strokeRec); 761 strokeRec);
760 } else { 762 } else {
761 // filled AA rect 763 // filled AA rect
762 fAARectRenderer->fillAARect(target, &drawState, color, rect, matrix, devBoundRect); 764 fAARectRenderer->fillAARect(target, &drawState, color, invert, rect, matrix,
765 devBoundRect);
763 } 766 }
764 return; 767 return;
765 } 768 }
766 769
767 if (width >= 0) { 770 if (width >= 0) {
768 // TODO: consider making static vertex buffers for these cases. 771 // TODO: consider making static vertex buffers for these cases.
769 // Hairline could be done by just adding closing vertex to 772 // Hairline could be done by just adding closing vertex to
770 // unitSquareVertexBuffer() 773 // unitSquareVertexBuffer()
771 774
772 static const int worstCaseVertCount = 10; 775 static const int worstCaseVertCount = 10;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 1084
1082 GrColor color = paint.getColor(); 1085 GrColor color = paint.getColor();
1083 if (strokeInfo.isDashed()) { 1086 if (strokeInfo.isDashed()) {
1084 SkPoint pts[2]; 1087 SkPoint pts[2];
1085 if (path.isLine(pts)) { 1088 if (path.isLine(pts)) {
1086 AutoCheckFlush acf(this); 1089 AutoCheckFlush acf(this);
1087 GrDrawState drawState; 1090 GrDrawState drawState;
1088 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &view Matrix, &acf); 1091 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &view Matrix, &acf);
1089 if (NULL == target) { 1092 if (NULL == target) {
1090 return; 1093 return;
1091 }; 1094 }
1092 1095
1093 SkMatrix origViewMatrix = drawState.getViewMatrix(); 1096 if (GrDashingEffect::DrawDashLine(fGpu, target, &drawState, color, p ts, paint,
1094 GrDrawState::AutoViewMatrixRestore avmr; 1097 strokeInfo)) {
1095 if (avmr.setIdentity(&drawState)) { 1098 return;
1096 if (GrDashingEffect::DrawDashLine(fGpu, target, &drawState, colo r, pts, paint,
1097 strokeInfo, origViewMatrix)) {
1098 return;
1099 }
1100 } 1099 }
1101 } 1100 }
1102 1101
1103 // Filter dashed path into new path with the dashing applied 1102 // Filter dashed path into new path with the dashing applied
1104 const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo(); 1103 const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo();
1105 SkTLazy<SkPath> effectPath; 1104 SkTLazy<SkPath> effectPath;
1106 GrStrokeInfo newStrokeInfo(strokeInfo, false); 1105 GrStrokeInfo newStrokeInfo(strokeInfo, false);
1107 SkStrokeRec* stroke = newStrokeInfo.getStrokeRecPtr(); 1106 SkStrokeRec* stroke = newStrokeInfo.getStrokeRecPtr();
1108 if (SkDashPath::FilterDashPath(effectPath.init(), path, stroke, NULL, in fo)) { 1107 if (SkDashPath::FilterDashPath(effectPath.init(), path, stroke, NULL, in fo)) {
1109 this->drawPath(paint, viewMatrix, *effectPath.get(), newStrokeInfo); 1108 this->drawPath(paint, viewMatrix, *effectPath.get(), newStrokeInfo);
(...skipping 21 matching lines...) Expand all
1131 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec(); 1130 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec();
1132 1131
1133 bool useCoverageAA = paint.isAntiAlias() && !drawState.getRenderTarget()->is Multisampled(); 1132 bool useCoverageAA = paint.isAntiAlias() && !drawState.getRenderTarget()->is Multisampled();
1134 1133
1135 if (useCoverageAA && strokeRec.getWidth() < 0 && !path.isConvex()) { 1134 if (useCoverageAA && strokeRec.getWidth() < 0 && !path.isConvex()) {
1136 // Concave AA paths are expensive - try to avoid them for special cases 1135 // Concave AA paths are expensive - try to avoid them for special cases
1137 SkRect rects[2]; 1136 SkRect rects[2];
1138 1137
1139 if (is_nested_rects(target, &drawState, color, path, strokeRec, rects)) { 1138 if (is_nested_rects(target, &drawState, color, path, strokeRec, rects)) {
1140 SkMatrix origViewMatrix = drawState.getViewMatrix(); 1139 SkMatrix origViewMatrix = drawState.getViewMatrix();
1141 GrDrawState::AutoViewMatrixRestore avmr; 1140
1142 if (!avmr.setIdentity(&drawState)) { 1141 SkMatrix invert;
1142 if (!drawState.getViewMatrix().invert(&invert)) {
1143 return; 1143 return;
1144 } 1144 }
1145 GrDrawState::AutoViewMatrixRestore avmr(&drawState);
1145 1146
1146 fAARectRenderer->fillAANestedRects(target, &drawState, color, rects, origViewMatrix); 1147 fAARectRenderer->fillAANestedRects(target, &drawState, color, invert , rects,
1148 origViewMatrix);
1147 return; 1149 return;
1148 } 1150 }
1149 } 1151 }
1150 1152
1151 SkRect ovalRect; 1153 SkRect ovalRect;
1152 bool isOval = path.isOval(&ovalRect); 1154 bool isOval = path.isOval(&ovalRect);
1153 1155
1154 if (!isOval || path.isInverseFillType() 1156 if (!isOval || path.isInverseFillType()
1155 || !fOvalRenderer->drawOval(target, &drawState, color, paint.isAntiAlias (), ovalRect, 1157 || !fOvalRenderer->drawOval(target, &drawState, color, paint.isAntiAlias (), ovalRect,
1156 strokeRec)) { 1158 strokeRec)) {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 fResourceCache2->printStats(); 1751 fResourceCache2->printStats();
1750 } 1752 }
1751 #endif 1753 #endif
1752 1754
1753 #if GR_GPU_STATS 1755 #if GR_GPU_STATS
1754 const GrContext::GPUStats* GrContext::gpuStats() const { 1756 const GrContext::GPUStats* GrContext::gpuStats() const {
1755 return fGpu->gpuStats(); 1757 return fGpu->gpuStats();
1756 } 1758 }
1757 #endif 1759 #endif
1758 1760
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698