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 "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 573 |
574 void GrContext::drawRect(GrRenderTarget* rt, | 574 void GrContext::drawRect(GrRenderTarget* rt, |
575 const GrClip& clip, | 575 const GrClip& clip, |
576 const GrPaint& paint, | 576 const GrPaint& paint, |
577 const SkMatrix& viewMatrix, | 577 const SkMatrix& viewMatrix, |
578 const SkRect& rect, | 578 const SkRect& rect, |
579 const GrStrokeInfo* strokeInfo) { | 579 const GrStrokeInfo* strokeInfo) { |
580 RETURN_IF_ABANDONED | 580 RETURN_IF_ABANDONED |
581 if (strokeInfo && strokeInfo->isDashed()) { | 581 if (strokeInfo && strokeInfo->isDashed()) { |
582 SkPath path; | 582 SkPath path; |
| 583 path.setIsVolatile(true); |
583 path.addRect(rect); | 584 path.addRect(rect); |
584 this->drawPath(rt, clip, paint, viewMatrix, path, *strokeInfo); | 585 this->drawPath(rt, clip, paint, viewMatrix, path, *strokeInfo); |
585 return; | 586 return; |
586 } | 587 } |
587 | 588 |
588 AutoCheckFlush acf(this); | 589 AutoCheckFlush acf(this); |
589 GrPipelineBuilder pipelineBuilder; | 590 GrPipelineBuilder pipelineBuilder; |
590 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); | 591 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); |
591 if (NULL == target) { | 592 if (NULL == target) { |
592 return; | 593 return; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 const SkMatrix& viewMatrix, | 1031 const SkMatrix& viewMatrix, |
1031 const SkRRect& rrect, | 1032 const SkRRect& rrect, |
1032 const GrStrokeInfo& strokeInfo) { | 1033 const GrStrokeInfo& strokeInfo) { |
1033 RETURN_IF_ABANDONED | 1034 RETURN_IF_ABANDONED |
1034 if (rrect.isEmpty()) { | 1035 if (rrect.isEmpty()) { |
1035 return; | 1036 return; |
1036 } | 1037 } |
1037 | 1038 |
1038 if (strokeInfo.isDashed()) { | 1039 if (strokeInfo.isDashed()) { |
1039 SkPath path; | 1040 SkPath path; |
| 1041 path.setIsVolatile(true); |
1040 path.addRRect(rrect); | 1042 path.addRRect(rrect); |
1041 this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); | 1043 this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); |
1042 return; | 1044 return; |
1043 } | 1045 } |
1044 | 1046 |
1045 AutoCheckFlush acf(this); | 1047 AutoCheckFlush acf(this); |
1046 GrPipelineBuilder pipelineBuilder; | 1048 GrPipelineBuilder pipelineBuilder; |
1047 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); | 1049 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); |
1048 if (NULL == target) { | 1050 if (NULL == target) { |
1049 return; | 1051 return; |
1050 } | 1052 } |
1051 | 1053 |
1052 GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target); | 1054 GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target); |
1053 | 1055 |
1054 GrColor color = paint.getColor(); | 1056 GrColor color = paint.getColor(); |
1055 if (!fOvalRenderer->drawRRect(target, | 1057 if (!fOvalRenderer->drawRRect(target, |
1056 &pipelineBuilder, | 1058 &pipelineBuilder, |
1057 color, | 1059 color, |
1058 viewMatrix, | 1060 viewMatrix, |
1059 paint.isAntiAlias(), | 1061 paint.isAntiAlias(), |
1060 rrect, | 1062 rrect, |
1061 strokeInfo)) { | 1063 strokeInfo)) { |
1062 SkPath path; | 1064 SkPath path; |
| 1065 path.setIsVolatile(true); |
1063 path.addRRect(rrect); | 1066 path.addRRect(rrect); |
1064 this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, pain
t.isAntiAlias(), | 1067 this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, pain
t.isAntiAlias(), |
1065 path, strokeInfo); | 1068 path, strokeInfo); |
1066 } | 1069 } |
1067 } | 1070 } |
1068 | 1071 |
1069 /////////////////////////////////////////////////////////////////////////////// | 1072 /////////////////////////////////////////////////////////////////////////////// |
1070 | 1073 |
1071 void GrContext::drawDRRect(GrRenderTarget* rt, | 1074 void GrContext::drawDRRect(GrRenderTarget* rt, |
1072 const GrClip& clip, | 1075 const GrClip& clip, |
(...skipping 14 matching lines...) Expand all Loading... |
1087 | 1090 |
1088 GrColor color = paint.getColor(); | 1091 GrColor color = paint.getColor(); |
1089 if (!fOvalRenderer->drawDRRect(target, | 1092 if (!fOvalRenderer->drawDRRect(target, |
1090 &pipelineBuilder, | 1093 &pipelineBuilder, |
1091 color, | 1094 color, |
1092 viewMatrix, | 1095 viewMatrix, |
1093 paint.isAntiAlias(), | 1096 paint.isAntiAlias(), |
1094 outer, | 1097 outer, |
1095 inner)) { | 1098 inner)) { |
1096 SkPath path; | 1099 SkPath path; |
| 1100 path.setIsVolatile(true); |
1097 path.addRRect(inner); | 1101 path.addRRect(inner); |
1098 path.addRRect(outer); | 1102 path.addRRect(outer); |
1099 path.setFillType(SkPath::kEvenOdd_FillType); | 1103 path.setFillType(SkPath::kEvenOdd_FillType); |
1100 | |
1101 GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle); | 1104 GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle); |
1102 this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, pain
t.isAntiAlias(), | 1105 this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, pain
t.isAntiAlias(), |
1103 path, fillRec); | 1106 path, fillRec); |
1104 } | 1107 } |
1105 } | 1108 } |
1106 | 1109 |
1107 /////////////////////////////////////////////////////////////////////////////// | 1110 /////////////////////////////////////////////////////////////////////////////// |
1108 | 1111 |
1109 void GrContext::drawOval(GrRenderTarget* rt, | 1112 void GrContext::drawOval(GrRenderTarget* rt, |
1110 const GrClip& clip, | 1113 const GrClip& clip, |
1111 const GrPaint& paint, | 1114 const GrPaint& paint, |
1112 const SkMatrix& viewMatrix, | 1115 const SkMatrix& viewMatrix, |
1113 const SkRect& oval, | 1116 const SkRect& oval, |
1114 const GrStrokeInfo& strokeInfo) { | 1117 const GrStrokeInfo& strokeInfo) { |
1115 RETURN_IF_ABANDONED | 1118 RETURN_IF_ABANDONED |
1116 if (oval.isEmpty()) { | 1119 if (oval.isEmpty()) { |
1117 return; | 1120 return; |
1118 } | 1121 } |
1119 | 1122 |
1120 if (strokeInfo.isDashed()) { | 1123 if (strokeInfo.isDashed()) { |
1121 SkPath path; | 1124 SkPath path; |
| 1125 path.setIsVolatile(true); |
1122 path.addOval(oval); | 1126 path.addOval(oval); |
1123 this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); | 1127 this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); |
1124 return; | 1128 return; |
1125 } | 1129 } |
1126 | 1130 |
1127 AutoCheckFlush acf(this); | 1131 AutoCheckFlush acf(this); |
1128 GrPipelineBuilder pipelineBuilder; | 1132 GrPipelineBuilder pipelineBuilder; |
1129 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); | 1133 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); |
1130 if (NULL == target) { | 1134 if (NULL == target) { |
1131 return; | 1135 return; |
1132 } | 1136 } |
1133 | 1137 |
1134 GR_CREATE_TRACE_MARKER("GrContext::drawOval", target); | 1138 GR_CREATE_TRACE_MARKER("GrContext::drawOval", target); |
1135 | 1139 |
1136 GrColor color = paint.getColor(); | 1140 GrColor color = paint.getColor(); |
1137 if (!fOvalRenderer->drawOval(target, | 1141 if (!fOvalRenderer->drawOval(target, |
1138 &pipelineBuilder, | 1142 &pipelineBuilder, |
1139 color, | 1143 color, |
1140 viewMatrix, | 1144 viewMatrix, |
1141 paint.isAntiAlias(), | 1145 paint.isAntiAlias(), |
1142 oval, | 1146 oval, |
1143 strokeInfo)) { | 1147 strokeInfo)) { |
1144 SkPath path; | 1148 SkPath path; |
| 1149 path.setIsVolatile(true); |
1145 path.addOval(oval); | 1150 path.addOval(oval); |
1146 this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, pain
t.isAntiAlias(), | 1151 this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, pain
t.isAntiAlias(), |
1147 path, strokeInfo); | 1152 path, strokeInfo); |
1148 } | 1153 } |
1149 } | 1154 } |
1150 | 1155 |
1151 // Can 'path' be drawn as a pair of filled nested rectangles? | 1156 // Can 'path' be drawn as a pair of filled nested rectangles? |
1152 static bool is_nested_rects(GrDrawTarget* target, | 1157 static bool is_nested_rects(GrDrawTarget* target, |
1153 GrPipelineBuilder* pipelineBuilder, | 1158 GrPipelineBuilder* pipelineBuilder, |
1154 GrColor color, | 1159 GrColor color, |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 geometry.fColor = GrRandomColor(random); | 1990 geometry.fColor = GrRandomColor(random); |
1986 return DrawVerticesBatch::Create(geometry, type, viewMatrix, | 1991 return DrawVerticesBatch::Create(geometry, type, viewMatrix, |
1987 positions.begin(), vertexCount, | 1992 positions.begin(), vertexCount, |
1988 indices.begin(), hasIndices ? vertexCount :
0, | 1993 indices.begin(), hasIndices ? vertexCount :
0, |
1989 colors.begin(), | 1994 colors.begin(), |
1990 texCoords.begin(), | 1995 texCoords.begin(), |
1991 bounds); | 1996 bounds); |
1992 } | 1997 } |
1993 | 1998 |
1994 #endif | 1999 #endif |
OLD | NEW |