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 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 int col = 0; | 86 int col = 0; |
87 | 87 |
88 for (int i = 0; i < kNumCubics; ++i) { | 88 for (int i = 0; i < kNumCubics; ++i) { |
89 SkPoint baseControlPts[] = { | 89 SkPoint baseControlPts[] = { |
90 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 90 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
91 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 91 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
92 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 92 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
93 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 93 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
94 }; | 94 }; |
95 for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) { | 95 for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) { |
96 SkAutoTUnref<GrEffectRef> effect; | 96 SkAutoTUnref<GrEffect> effect; |
97 { // scope to contain GrTestTarget | 97 { // scope to contain GrTestTarget |
98 GrTestTarget tt; | 98 GrTestTarget tt; |
99 context->getTestTarget(&tt); | 99 context->getTestTarget(&tt); |
100 if (NULL == tt.target()) { | 100 if (NULL == tt.target()) { |
101 continue; | 101 continue; |
102 } | 102 } |
103 GrEffectEdgeType et = (GrEffectEdgeType)edgeType; | 103 GrEffectEdgeType et = (GrEffectEdgeType)edgeType; |
104 effect.reset(GrCubicEffect::Create(et, *tt.target()->caps())
); | 104 effect.reset(GrCubicEffect::Create(et, *tt.target()->caps())
); |
105 if (!effect) { | 105 if (!effect) { |
106 continue; | 106 continue; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 int col = 0; | 244 int col = 0; |
245 | 245 |
246 for (int i = 0; i < kNumConics; ++i) { | 246 for (int i = 0; i < kNumConics; ++i) { |
247 SkPoint baseControlPts[] = { | 247 SkPoint baseControlPts[] = { |
248 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 248 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
249 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 249 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
250 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 250 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
251 }; | 251 }; |
252 SkScalar weight = rand.nextRangeF(0.f, 2.f); | 252 SkScalar weight = rand.nextRangeF(0.f, 2.f); |
253 for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) { | 253 for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) { |
254 SkAutoTUnref<GrEffectRef> effect; | 254 SkAutoTUnref<GrEffect> effect; |
255 { // scope to contain GrTestTarget | 255 { // scope to contain GrTestTarget |
256 GrTestTarget tt; | 256 GrTestTarget tt; |
257 context->getTestTarget(&tt); | 257 context->getTestTarget(&tt); |
258 if (NULL == tt.target()) { | 258 if (NULL == tt.target()) { |
259 continue; | 259 continue; |
260 } | 260 } |
261 GrEffectEdgeType et = (GrEffectEdgeType)edgeType; | 261 GrEffectEdgeType et = (GrEffectEdgeType)edgeType; |
262 effect.reset(GrConicEffect::Create(et, *tt.target()->caps())
); | 262 effect.reset(GrConicEffect::Create(et, *tt.target()->caps())
); |
263 if (!effect) { | 263 if (!effect) { |
264 continue; | 264 continue; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 int row = 0; | 433 int row = 0; |
434 int col = 0; | 434 int col = 0; |
435 | 435 |
436 for (int i = 0; i < kNumQuads; ++i) { | 436 for (int i = 0; i < kNumQuads; ++i) { |
437 SkPoint baseControlPts[] = { | 437 SkPoint baseControlPts[] = { |
438 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 438 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
439 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 439 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
440 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 440 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
441 }; | 441 }; |
442 for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) { | 442 for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) { |
443 SkAutoTUnref<GrEffectRef> effect; | 443 SkAutoTUnref<GrEffect> effect; |
444 { // scope to contain GrTestTarget | 444 { // scope to contain GrTestTarget |
445 GrTestTarget tt; | 445 GrTestTarget tt; |
446 context->getTestTarget(&tt); | 446 context->getTestTarget(&tt); |
447 if (NULL == tt.target()) { | 447 if (NULL == tt.target()) { |
448 continue; | 448 continue; |
449 } | 449 } |
450 GrEffectEdgeType et = (GrEffectEdgeType)edgeType; | 450 GrEffectEdgeType et = (GrEffectEdgeType)edgeType; |
451 effect.reset(GrQuadEffect::Create(et, *tt.target()->caps()))
; | 451 effect.reset(GrQuadEffect::Create(et, *tt.target()->caps()))
; |
452 if (!effect) { | 452 if (!effect) { |
453 continue; | 453 continue; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 typedef GM INHERITED; | 530 typedef GM INHERITED; |
531 }; | 531 }; |
532 | 532 |
533 DEF_GM( return SkNEW(BezierCubicEffects); ) | 533 DEF_GM( return SkNEW(BezierCubicEffects); ) |
534 DEF_GM( return SkNEW(BezierConicEffects); ) | 534 DEF_GM( return SkNEW(BezierConicEffects); ) |
535 DEF_GM( return SkNEW(BezierQuadEffects); ) | 535 DEF_GM( return SkNEW(BezierQuadEffects); ) |
536 | 536 |
537 } | 537 } |
538 | 538 |
539 #endif | 539 #endif |
OLD | NEW |