OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 GrDrawState* drawState = tt.target()->drawState(); | 129 GrDrawState* drawState = tt.target()->drawState(); |
130 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs)); | 130 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs)); |
131 | 131 |
132 SkMatrix m; | 132 SkMatrix m; |
133 SkPath p; | 133 SkPath p; |
134 m.setTranslate(x, y); | 134 m.setTranslate(x, y); |
135 path->transform(m, &p); | 135 path->transform(m, &p); |
136 | 136 |
137 GrEffectEdgeType edgeType = (GrEffectEdgeType) et; | 137 GrEffectEdgeType edgeType = (GrEffectEdgeType) et; |
138 SkAutoTUnref<GrEffectRef> effect(GrConvexPolyEffect::Create(edge
Type, p)); | 138 SkAutoTUnref<GrEffect> effect(GrConvexPolyEffect::Create(edgeTyp
e, p)); |
139 if (!effect) { | 139 if (!effect) { |
140 continue; | 140 continue; |
141 } | 141 } |
142 drawState->addCoverageEffect(effect, 1); | 142 drawState->addCoverageEffect(effect, 1); |
143 drawState->setIdentityViewMatrix(); | 143 drawState->setIdentityViewMatrix(); |
144 drawState->setRenderTarget(rt); | 144 drawState->setRenderTarget(rt); |
145 drawState->setColor(0xff000000); | 145 drawState->setColor(0xff000000); |
146 | 146 |
147 SkPoint verts[4]; | 147 SkPoint verts[4]; |
148 SkRect bounds = p.getBounds(); | 148 SkRect bounds = p.getBounds(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 for (int et = 0; et < kGrEffectEdgeTypeCnt; ++et) { | 180 for (int et = 0; et < kGrEffectEdgeTypeCnt; ++et) { |
181 GrTestTarget tt; | 181 GrTestTarget tt; |
182 context->getTestTarget(&tt); | 182 context->getTestTarget(&tt); |
183 if (NULL == tt.target()) { | 183 if (NULL == tt.target()) { |
184 SkDEBUGFAIL("Couldn't get Gr test target."); | 184 SkDEBUGFAIL("Couldn't get Gr test target."); |
185 return; | 185 return; |
186 } | 186 } |
187 SkRect rect = *iter.get(); | 187 SkRect rect = *iter.get(); |
188 rect.offset(x, y); | 188 rect.offset(x, y); |
189 GrEffectEdgeType edgeType = (GrEffectEdgeType) et; | 189 GrEffectEdgeType edgeType = (GrEffectEdgeType) et; |
190 SkAutoTUnref<GrEffectRef> effect(GrConvexPolyEffect::Create(edge
Type, rect)); | 190 SkAutoTUnref<GrEffect> effect(GrConvexPolyEffect::Create(edgeTyp
e, rect)); |
191 if (!effect) { | 191 if (!effect) { |
192 continue; | 192 continue; |
193 } | 193 } |
194 | 194 |
195 GrDrawState* drawState = tt.target()->drawState(); | 195 GrDrawState* drawState = tt.target()->drawState(); |
196 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs)); | 196 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs)); |
197 drawState->addCoverageEffect(effect, 1); | 197 drawState->addCoverageEffect(effect, 1); |
198 drawState->setIdentityViewMatrix(); | 198 drawState->setIdentityViewMatrix(); |
199 drawState->setRenderTarget(rt); | 199 drawState->setRenderTarget(rt); |
200 drawState->setColor(0xff000000); | 200 drawState->setColor(0xff000000); |
(...skipping 28 matching lines...) Expand all Loading... |
229 SkTLList<SkPath> fPaths; | 229 SkTLList<SkPath> fPaths; |
230 SkTLList<SkRect> fRects; | 230 SkTLList<SkRect> fRects; |
231 | 231 |
232 typedef GM INHERITED; | 232 typedef GM INHERITED; |
233 }; | 233 }; |
234 | 234 |
235 DEF_GM( return SkNEW(ConvexPolyEffect); ) | 235 DEF_GM( return SkNEW(ConvexPolyEffect); ) |
236 } | 236 } |
237 | 237 |
238 #endif | 238 #endif |
OLD | NEW |