OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 |
11 #include "gm.h" | 11 #include "gm.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 | 14 |
| 15 #include "GrDrawContext.h" |
15 #include "GrContext.h" | 16 #include "GrContext.h" |
16 #include "GrPathUtils.h" | 17 #include "GrPathUtils.h" |
17 #include "GrTest.h" | 18 #include "GrTest.h" |
18 #include "SkColorPriv.h" | 19 #include "SkColorPriv.h" |
19 #include "SkDevice.h" | 20 #include "SkDevice.h" |
20 #include "SkGeometry.h" | 21 #include "SkGeometry.h" |
21 | 22 |
22 #include "batches/GrTestBatch.h" | 23 #include "batches/GrTestBatch.h" |
23 | 24 |
24 #include "effects/GrBezierEffect.h" | 25 #include "effects/GrBezierEffect.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 123 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
123 if (nullptr == rt) { | 124 if (nullptr == rt) { |
124 skiagm::GM::DrawGpuOnlyMessage(canvas); | 125 skiagm::GM::DrawGpuOnlyMessage(canvas); |
125 return; | 126 return; |
126 } | 127 } |
127 GrContext* context = rt->getContext(); | 128 GrContext* context = rt->getContext(); |
128 if (nullptr == context) { | 129 if (nullptr == context) { |
129 return; | 130 return; |
130 } | 131 } |
131 | 132 |
| 133 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
| 134 if (!drawContext) { |
| 135 return; |
| 136 } |
| 137 |
132 struct Vertex { | 138 struct Vertex { |
133 SkPoint fPosition; | 139 SkPoint fPosition; |
134 float fKLM[4]; // The last value is ignored. The effect expects a
vec4f. | 140 float fKLM[4]; // The last value is ignored. The effect expects a
vec4f. |
135 }; | 141 }; |
136 | 142 |
137 static const int kNumCubics = 15; | 143 static const int kNumCubics = 15; |
138 SkRandom rand; | 144 SkRandom rand; |
139 | 145 |
140 // Mult by 3 for each edge effect type | 146 // Mult by 3 for each edge effect type |
141 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3)
)); | 147 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3)
)); |
142 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumCubics*3) / numCols); | 148 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumCubics*3) / numCols); |
143 SkScalar w = SkIntToScalar(rt->width()) / numCols; | 149 SkScalar w = SkIntToScalar(rt->width()) / numCols; |
144 SkScalar h = SkIntToScalar(rt->height()) / numRows; | 150 SkScalar h = SkIntToScalar(rt->height()) / numRows; |
145 int row = 0; | 151 int row = 0; |
146 int col = 0; | 152 int col = 0; |
147 static const GrColor color = 0xff000000; | 153 static const GrColor color = 0xff000000; |
148 | 154 |
149 for (int i = 0; i < kNumCubics; ++i) { | 155 for (int i = 0; i < kNumCubics; ++i) { |
150 SkPoint baseControlPts[] = { | 156 SkPoint baseControlPts[] = { |
151 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 157 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
152 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 158 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
153 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 159 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
154 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 160 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
155 }; | 161 }; |
156 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { | 162 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { |
157 SkAutoTUnref<GrGeometryProcessor> gp; | 163 SkAutoTUnref<GrGeometryProcessor> gp; |
158 { // scope to contain GrTestTarget | 164 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
159 GrTestTarget tt; | 165 gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et, |
160 context->getTestTarget(&tt, rt); | 166 *context->caps())); |
161 if (nullptr == tt.target()) { | 167 if (!gp) { |
162 continue; | 168 continue; |
163 } | |
164 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; | |
165 gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et, | |
166 *tt.target()->caps())); | |
167 if (!gp) { | |
168 continue; | |
169 } | |
170 } | 169 } |
171 | |
172 SkScalar x = SkScalarMul(col, w); | 170 SkScalar x = SkScalarMul(col, w); |
173 SkScalar y = SkScalarMul(row, h); | 171 SkScalar y = SkScalarMul(row, h); |
174 SkPoint controlPts[] = { | 172 SkPoint controlPts[] = { |
175 {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, | 173 {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, |
176 {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, | 174 {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, |
177 {x + baseControlPts[2].fX, y + baseControlPts[2].fY}, | 175 {x + baseControlPts[2].fX, y + baseControlPts[2].fY}, |
178 {x + baseControlPts[3].fX, y + baseControlPts[3].fY} | 176 {x + baseControlPts[3].fX, y + baseControlPts[3].fY} |
179 }; | 177 }; |
180 SkPoint chopped[10]; | 178 SkPoint chopped[10]; |
181 SkScalar klmEqs[9]; | 179 SkScalar klmEqs[9]; |
(...skipping 27 matching lines...) Expand all Loading... |
209 | 207 |
210 SkRect bounds; | 208 SkRect bounds; |
211 bounds.set(pts, 4); | 209 bounds.set(pts, 4); |
212 | 210 |
213 SkPaint boundsPaint; | 211 SkPaint boundsPaint; |
214 boundsPaint.setColor(0xff808080); | 212 boundsPaint.setColor(0xff808080); |
215 boundsPaint.setStrokeWidth(0); | 213 boundsPaint.setStrokeWidth(0); |
216 boundsPaint.setStyle(SkPaint::kStroke_Style); | 214 boundsPaint.setStyle(SkPaint::kStroke_Style); |
217 canvas->drawRect(bounds, boundsPaint); | 215 canvas->drawRect(bounds, boundsPaint); |
218 | 216 |
219 GrTestTarget tt; | |
220 context->getTestTarget(&tt, rt); | |
221 SkASSERT(tt.target()); | |
222 | |
223 GrPipelineBuilder pipelineBuilder; | 217 GrPipelineBuilder pipelineBuilder; |
224 pipelineBuilder.setXPFactory( | 218 pipelineBuilder.setXPFactory( |
225 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->u
nref(); | 219 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->u
nref(); |
226 pipelineBuilder.setRenderTarget(rt); | 220 pipelineBuilder.setRenderTarget(rt); |
227 | 221 |
228 BezierCubicOrConicTestBatch::Geometry geometry; | 222 BezierCubicOrConicTestBatch::Geometry geometry; |
229 geometry.fColor = color; | 223 geometry.fColor = color; |
230 geometry.fBounds = bounds; | 224 geometry.fBounds = bounds; |
231 | 225 |
232 SkAutoTUnref<GrDrawBatch> batch( | 226 SkAutoTUnref<GrDrawBatch> batch( |
233 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, klmSigns[c])); | 227 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, klmSigns[c])); |
234 | 228 |
235 tt.target()->drawBatch(pipelineBuilder, batch); | 229 drawContext->internal_drawBatch(pipelineBuilder, batch); |
236 } | 230 } |
237 ++col; | 231 ++col; |
238 if (numCols == col) { | 232 if (numCols == col) { |
239 col = 0; | 233 col = 0; |
240 ++row; | 234 ++row; |
241 } | 235 } |
242 } | 236 } |
243 } | 237 } |
244 } | 238 } |
245 | 239 |
(...skipping 26 matching lines...) Expand all Loading... |
272 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 266 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
273 if (nullptr == rt) { | 267 if (nullptr == rt) { |
274 skiagm::GM::DrawGpuOnlyMessage(canvas); | 268 skiagm::GM::DrawGpuOnlyMessage(canvas); |
275 return; | 269 return; |
276 } | 270 } |
277 GrContext* context = rt->getContext(); | 271 GrContext* context = rt->getContext(); |
278 if (nullptr == context) { | 272 if (nullptr == context) { |
279 return; | 273 return; |
280 } | 274 } |
281 | 275 |
| 276 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
| 277 if (!drawContext) { |
| 278 return; |
| 279 } |
| 280 |
282 struct Vertex { | 281 struct Vertex { |
283 SkPoint fPosition; | 282 SkPoint fPosition; |
284 float fKLM[4]; // The last value is ignored. The effect expects a
vec4f. | 283 float fKLM[4]; // The last value is ignored. The effect expects a
vec4f. |
285 }; | 284 }; |
286 | 285 |
287 static const int kNumConics = 10; | 286 static const int kNumConics = 10; |
288 SkRandom rand; | 287 SkRandom rand; |
289 | 288 |
290 // Mult by 3 for each edge effect type | 289 // Mult by 3 for each edge effect type |
291 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3)
)); | 290 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3)
)); |
292 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumConics*3) / numCols); | 291 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumConics*3) / numCols); |
293 SkScalar w = SkIntToScalar(rt->width()) / numCols; | 292 SkScalar w = SkIntToScalar(rt->width()) / numCols; |
294 SkScalar h = SkIntToScalar(rt->height()) / numRows; | 293 SkScalar h = SkIntToScalar(rt->height()) / numRows; |
295 int row = 0; | 294 int row = 0; |
296 int col = 0; | 295 int col = 0; |
297 static const GrColor color = 0xff000000; | 296 static const GrColor color = 0xff000000; |
298 | 297 |
299 for (int i = 0; i < kNumConics; ++i) { | 298 for (int i = 0; i < kNumConics; ++i) { |
300 SkPoint baseControlPts[] = { | 299 SkPoint baseControlPts[] = { |
301 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 300 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
302 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 301 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
303 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 302 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
304 }; | 303 }; |
305 SkScalar weight = rand.nextRangeF(0.f, 2.f); | 304 SkScalar weight = rand.nextRangeF(0.f, 2.f); |
306 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { | 305 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { |
307 SkAutoTUnref<GrGeometryProcessor> gp; | 306 SkAutoTUnref<GrGeometryProcessor> gp; |
308 { // scope to contain GrTestTarget | 307 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
309 GrTestTarget tt; | 308 gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et, |
310 context->getTestTarget(&tt, rt); | 309 *context->caps(), SkMatrix::I(),
false)); |
311 if (nullptr == tt.target()) { | 310 if (!gp) { |
312 continue; | 311 continue; |
313 } | |
314 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; | |
315 gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et, | |
316 *tt.target()->caps(), SkMatri
x::I(), false)); | |
317 if (!gp) { | |
318 continue; | |
319 } | |
320 } | 312 } |
321 | 313 |
322 SkScalar x = SkScalarMul(col, w); | 314 SkScalar x = SkScalarMul(col, w); |
323 SkScalar y = SkScalarMul(row, h); | 315 SkScalar y = SkScalarMul(row, h); |
324 SkPoint controlPts[] = { | 316 SkPoint controlPts[] = { |
325 {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, | 317 {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, |
326 {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, | 318 {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, |
327 {x + baseControlPts[2].fX, y + baseControlPts[2].fY} | 319 {x + baseControlPts[2].fX, y + baseControlPts[2].fY} |
328 }; | 320 }; |
329 SkConic dst[4]; | 321 SkConic dst[4]; |
(...skipping 26 matching lines...) Expand all Loading... |
356 //SkPoint bPts[] = {{0.f, 0.f}, {800.f, 800.f}}; | 348 //SkPoint bPts[] = {{0.f, 0.f}, {800.f, 800.f}}; |
357 //bounds.set(bPts, 2); | 349 //bounds.set(bPts, 2); |
358 bounds.set(pts, 3); | 350 bounds.set(pts, 3); |
359 | 351 |
360 SkPaint boundsPaint; | 352 SkPaint boundsPaint; |
361 boundsPaint.setColor(0xff808080); | 353 boundsPaint.setColor(0xff808080); |
362 boundsPaint.setStrokeWidth(0); | 354 boundsPaint.setStrokeWidth(0); |
363 boundsPaint.setStyle(SkPaint::kStroke_Style); | 355 boundsPaint.setStyle(SkPaint::kStroke_Style); |
364 canvas->drawRect(bounds, boundsPaint); | 356 canvas->drawRect(bounds, boundsPaint); |
365 | 357 |
366 GrTestTarget tt; | |
367 context->getTestTarget(&tt, rt); | |
368 SkASSERT(tt.target()); | |
369 | |
370 GrPipelineBuilder pipelineBuilder; | 358 GrPipelineBuilder pipelineBuilder; |
371 pipelineBuilder.setXPFactory( | 359 pipelineBuilder.setXPFactory( |
372 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->u
nref(); | 360 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->u
nref(); |
373 pipelineBuilder.setRenderTarget(rt); | 361 pipelineBuilder.setRenderTarget(rt); |
374 | 362 |
375 BezierCubicOrConicTestBatch::Geometry geometry; | 363 BezierCubicOrConicTestBatch::Geometry geometry; |
376 geometry.fColor = color; | 364 geometry.fColor = color; |
377 geometry.fBounds = bounds; | 365 geometry.fBounds = bounds; |
378 | 366 |
379 SkAutoTUnref<GrDrawBatch> batch( | 367 SkAutoTUnref<GrDrawBatch> batch( |
380 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, 1.f)); | 368 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, 1.f)); |
381 | 369 |
382 tt.target()->drawBatch(pipelineBuilder, batch); | 370 drawContext->internal_drawBatch(pipelineBuilder, batch); |
383 } | 371 } |
384 ++col; | 372 ++col; |
385 if (numCols == col) { | 373 if (numCols == col) { |
386 col = 0; | 374 col = 0; |
387 ++row; | 375 ++row; |
388 } | 376 } |
389 } | 377 } |
390 } | 378 } |
391 } | 379 } |
392 | 380 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 505 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
518 if (nullptr == rt) { | 506 if (nullptr == rt) { |
519 skiagm::GM::DrawGpuOnlyMessage(canvas); | 507 skiagm::GM::DrawGpuOnlyMessage(canvas); |
520 return; | 508 return; |
521 } | 509 } |
522 GrContext* context = rt->getContext(); | 510 GrContext* context = rt->getContext(); |
523 if (nullptr == context) { | 511 if (nullptr == context) { |
524 return; | 512 return; |
525 } | 513 } |
526 | 514 |
| 515 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
| 516 if (!drawContext) { |
| 517 return; |
| 518 } |
| 519 |
527 struct Vertex { | 520 struct Vertex { |
528 SkPoint fPosition; | 521 SkPoint fPosition; |
529 float fUV[4]; // The last two values are ignored. The effect expec
ts a vec4f. | 522 float fUV[4]; // The last two values are ignored. The effect expec
ts a vec4f. |
530 }; | 523 }; |
531 | 524 |
532 static const int kNumQuads = 5; | 525 static const int kNumQuads = 5; |
533 SkRandom rand; | 526 SkRandom rand; |
534 | 527 |
535 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3))
); | 528 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3))
); |
536 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols); | 529 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols); |
537 SkScalar w = SkIntToScalar(rt->width()) / numCols; | 530 SkScalar w = SkIntToScalar(rt->width()) / numCols; |
538 SkScalar h = SkIntToScalar(rt->height()) / numRows; | 531 SkScalar h = SkIntToScalar(rt->height()) / numRows; |
539 int row = 0; | 532 int row = 0; |
540 int col = 0; | 533 int col = 0; |
541 static const GrColor color = 0xff000000; | 534 static const GrColor color = 0xff000000; |
542 | 535 |
543 for (int i = 0; i < kNumQuads; ++i) { | 536 for (int i = 0; i < kNumQuads; ++i) { |
544 SkPoint baseControlPts[] = { | 537 SkPoint baseControlPts[] = { |
545 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 538 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
546 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 539 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
547 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 540 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
548 }; | 541 }; |
549 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { | 542 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { |
550 SkAutoTUnref<GrGeometryProcessor> gp; | 543 SkAutoTUnref<GrGeometryProcessor> gp; |
551 { // scope to contain GrTestTarget | 544 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
552 GrTestTarget tt; | 545 gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et, |
553 context->getTestTarget(&tt, rt); | 546 *context->caps(), SkMatrix::I(), f
alse)); |
554 if (nullptr == tt.target()) { | 547 if (!gp) { |
555 continue; | 548 continue; |
556 } | |
557 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; | |
558 gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et, | |
559 *tt.target()->caps(), SkMatrix
::I(), false)); | |
560 if (!gp) { | |
561 continue; | |
562 } | |
563 } | 549 } |
564 | 550 |
565 SkScalar x = SkScalarMul(col, w); | 551 SkScalar x = SkScalarMul(col, w); |
566 SkScalar y = SkScalarMul(row, h); | 552 SkScalar y = SkScalarMul(row, h); |
567 SkPoint controlPts[] = { | 553 SkPoint controlPts[] = { |
568 {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, | 554 {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, |
569 {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, | 555 {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, |
570 {x + baseControlPts[2].fX, y + baseControlPts[2].fY} | 556 {x + baseControlPts[2].fX, y + baseControlPts[2].fY} |
571 }; | 557 }; |
572 SkPoint chopped[5]; | 558 SkPoint chopped[5]; |
(...skipping 23 matching lines...) Expand all Loading... |
596 | 582 |
597 SkRect bounds; | 583 SkRect bounds; |
598 bounds.set(pts, 3); | 584 bounds.set(pts, 3); |
599 | 585 |
600 SkPaint boundsPaint; | 586 SkPaint boundsPaint; |
601 boundsPaint.setColor(0xff808080); | 587 boundsPaint.setColor(0xff808080); |
602 boundsPaint.setStrokeWidth(0); | 588 boundsPaint.setStrokeWidth(0); |
603 boundsPaint.setStyle(SkPaint::kStroke_Style); | 589 boundsPaint.setStyle(SkPaint::kStroke_Style); |
604 canvas->drawRect(bounds, boundsPaint); | 590 canvas->drawRect(bounds, boundsPaint); |
605 | 591 |
606 GrTestTarget tt; | |
607 context->getTestTarget(&tt, rt); | |
608 SkASSERT(tt.target()); | |
609 | |
610 GrPipelineBuilder pipelineBuilder; | 592 GrPipelineBuilder pipelineBuilder; |
611 pipelineBuilder.setXPFactory( | 593 pipelineBuilder.setXPFactory( |
612 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->u
nref(); | 594 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->u
nref(); |
613 pipelineBuilder.setRenderTarget(rt); | 595 pipelineBuilder.setRenderTarget(rt); |
614 | 596 |
615 GrPathUtils::QuadUVMatrix DevToUV(pts); | 597 GrPathUtils::QuadUVMatrix DevToUV(pts); |
616 | 598 |
617 BezierQuadTestBatch::Geometry geometry; | 599 BezierQuadTestBatch::Geometry geometry; |
618 geometry.fColor = color; | 600 geometry.fColor = color; |
619 geometry.fBounds = bounds; | 601 geometry.fBounds = bounds; |
620 | 602 |
621 SkAutoTUnref<GrDrawBatch> batch(BezierQuadTestBatch::Create(
gp, geometry, | 603 SkAutoTUnref<GrDrawBatch> batch(BezierQuadTestBatch::Create(
gp, geometry, |
622
DevToUV)); | 604
DevToUV)); |
623 | 605 |
624 tt.target()->drawBatch(pipelineBuilder, batch); | 606 drawContext->internal_drawBatch(pipelineBuilder, batch); |
625 } | 607 } |
626 ++col; | 608 ++col; |
627 if (numCols == col) { | 609 if (numCols == col) { |
628 col = 0; | 610 col = 0; |
629 ++row; | 611 ++row; |
630 } | 612 } |
631 } | 613 } |
632 } | 614 } |
633 } | 615 } |
634 | 616 |
635 private: | 617 private: |
636 typedef GM INHERITED; | 618 typedef GM INHERITED; |
637 }; | 619 }; |
638 | 620 |
639 DEF_GM(return new BezierCubicEffects;) | 621 DEF_GM(return new BezierCubicEffects;) |
640 DEF_GM(return new BezierConicEffects;) | 622 DEF_GM(return new BezierConicEffects;) |
641 DEF_GM(return new BezierQuadEffects;) | 623 DEF_GM(return new BezierQuadEffects;) |
642 } | 624 } |
643 | 625 |
644 #endif | 626 #endif |
OLD | NEW |