OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 "GrAARectRenderer.h" | 9 #include "GrAARectRenderer.h" |
10 #include "GrAtlasTextContext.h" | 10 #include "GrAtlasTextContext.h" |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 strokeInfo)) { | 983 strokeInfo)) { |
984 SkPath path; | 984 SkPath path; |
985 path.setIsVolatile(true); | 985 path.setIsVolatile(true); |
986 path.addOval(oval); | 986 path.addOval(oval); |
987 this->internalDrawPath(fDrawTarget, &pipelineBuilder, viewMatrix, color, | 987 this->internalDrawPath(fDrawTarget, &pipelineBuilder, viewMatrix, color, |
988 paint.isAntiAlias(), path, strokeInfo); | 988 paint.isAntiAlias(), path, strokeInfo); |
989 } | 989 } |
990 } | 990 } |
991 | 991 |
992 // Can 'path' be drawn as a pair of filled nested rectangles? | 992 // Can 'path' be drawn as a pair of filled nested rectangles? |
993 static bool is_nested_rects(GrDrawTarget* target, | 993 static bool is_nested_rects(const SkMatrix& viewMatrix, |
994 GrPipelineBuilder* pipelineBuilder, | |
995 GrColor color, | |
996 const SkMatrix& viewMatrix, | |
997 const SkPath& path, | 994 const SkPath& path, |
998 const SkStrokeRec& stroke, | 995 const SkStrokeRec& stroke, |
999 SkRect rects[2]) { | 996 SkRect rects[2]) { |
1000 SkASSERT(stroke.isFillStyle()); | 997 SkASSERT(stroke.isFillStyle()); |
1001 | 998 |
1002 if (path.isInverseFillType()) { | 999 if (path.isInverseFillType()) { |
1003 return false; | 1000 return false; |
1004 } | 1001 } |
1005 | 1002 |
1006 // TODO: this restriction could be lifted if we were willing to apply | 1003 // TODO: this restriction could be lifted if we were willing to apply |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 | 1067 |
1071 GrPipelineBuilder pipelineBuilder(paint, rt, clip); | 1068 GrPipelineBuilder pipelineBuilder(paint, rt, clip); |
1072 if (!strokeInfo.isDashed()) { | 1069 if (!strokeInfo.isDashed()) { |
1073 bool useCoverageAA = paint.isAntiAlias() && | 1070 bool useCoverageAA = paint.isAntiAlias() && |
1074 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); | 1071 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); |
1075 | 1072 |
1076 if (useCoverageAA && strokeInfo.getWidth() < 0 && !path.isConvex()) { | 1073 if (useCoverageAA && strokeInfo.getWidth() < 0 && !path.isConvex()) { |
1077 // Concave AA paths are expensive - try to avoid them for special ca
ses | 1074 // Concave AA paths are expensive - try to avoid them for special ca
ses |
1078 SkRect rects[2]; | 1075 SkRect rects[2]; |
1079 | 1076 |
1080 if (is_nested_rects(fDrawTarget, &pipelineBuilder, color, viewMatrix
, path, strokeInfo, | 1077 if (is_nested_rects(viewMatrix, path, strokeInfo, rects)) { |
1081 rects)) { | |
1082 GrAARectRenderer::FillAANestedRects(fDrawTarget, &pipelineBuilde
r, color, | 1078 GrAARectRenderer::FillAANestedRects(fDrawTarget, &pipelineBuilde
r, color, |
1083 viewMatrix, rects); | 1079 viewMatrix, rects); |
1084 return; | 1080 return; |
1085 } | 1081 } |
1086 } | 1082 } |
1087 SkRect ovalRect; | 1083 SkRect ovalRect; |
1088 bool isOval = path.isOval(&ovalRect); | 1084 bool isOval = path.isOval(&ovalRect); |
1089 | 1085 |
1090 if (isOval && !path.isInverseFillType()) { | 1086 if (isOval && !path.isInverseFillType()) { |
1091 if (GrOvalRenderer::DrawOval(fDrawTarget, | 1087 if (GrOvalRenderer::DrawOval(fDrawTarget, |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 return DrawVerticesBatch::Create(geometry, type, viewMatrix, | 1311 return DrawVerticesBatch::Create(geometry, type, viewMatrix, |
1316 positions.begin(), vertexCount, | 1312 positions.begin(), vertexCount, |
1317 indices.begin(), hasIndices ? vertexCount :
0, | 1313 indices.begin(), hasIndices ? vertexCount :
0, |
1318 colors.begin(), | 1314 colors.begin(), |
1319 texCoords.begin(), | 1315 texCoords.begin(), |
1320 bounds); | 1316 bounds); |
1321 } | 1317 } |
1322 | 1318 |
1323 #endif | 1319 #endif |
1324 | 1320 |
OLD | NEW |