OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTwoPointConicalGradient.h" | 8 #include "SkTwoPointConicalGradient.h" |
9 #include "SkTwoPointConicalGradient_gpu.h" | |
10 | 9 |
11 struct TwoPtRadialContext { | 10 struct TwoPtRadialContext { |
12 const TwoPtRadial& fRec; | 11 const TwoPtRadial& fRec; |
13 float fRelX, fRelY; | 12 float fRelX, fRelY; |
14 const float fIncX, fIncY; | 13 const float fIncX, fIncY; |
15 float fB; | 14 float fB; |
16 const float fDB; | 15 const float fDB; |
17 | 16 |
18 TwoPtRadialContext(const TwoPtRadial& rec, SkScalar fx, SkScalar fy, | 17 TwoPtRadialContext(const TwoPtRadial& rec, SkScalar fx, SkScalar fy, |
19 SkScalar dfx, SkScalar dfy); | 18 SkScalar dfx, SkScalar dfy); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 buffer.writePoint(fCenter1); | 347 buffer.writePoint(fCenter1); |
349 buffer.writePoint(fCenter2); | 348 buffer.writePoint(fCenter2); |
350 buffer.writeScalar(fRadius1); | 349 buffer.writeScalar(fRadius1); |
351 buffer.writeScalar(fRadius2); | 350 buffer.writeScalar(fRadius2); |
352 buffer.writeBool(fFlippedGrad); | 351 buffer.writeBool(fFlippedGrad); |
353 } | 352 } |
354 | 353 |
355 #if SK_SUPPORT_GPU | 354 #if SK_SUPPORT_GPU |
356 | 355 |
357 #include "SkGr.h" | 356 #include "SkGr.h" |
| 357 #include "SkTwoPointConicalGradient_gpu.h" |
358 | 358 |
359 sk_sp<GrFragmentProcessor> SkTwoPointConicalGradient::asFragmentProcessor( | 359 sk_sp<GrFragmentProcessor> SkTwoPointConicalGradient::asFragmentProcessor( |
360 const AsFPArgs& args) const { | 360 const AsFPArgs& args) const { |
361 SkASSERT(args.fContext); | 361 SkASSERT(args.fContext); |
362 SkASSERT(fPtsToUnit.isIdentity()); | 362 SkASSERT(fPtsToUnit.isIdentity()); |
363 sk_sp<GrFragmentProcessor> inner( | 363 sk_sp<GrFragmentProcessor> inner(Gr2PtConicalGradientEffect::Make( |
364 Gr2PtConicalGradientEffect::Make(args.fContext, *this, fTileMode, args.f
LocalMatrix)); | 364 GrGradientEffect::CreateArgs(args.fContext, this, args.fLocalMatrix, fTi
leMode))); |
365 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); | 365 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); |
366 } | 366 } |
367 | 367 |
368 #endif | 368 #endif |
369 | 369 |
370 #ifndef SK_IGNORE_TO_STRING | 370 #ifndef SK_IGNORE_TO_STRING |
371 void SkTwoPointConicalGradient::toString(SkString* str) const { | 371 void SkTwoPointConicalGradient::toString(SkString* str) const { |
372 str->append("SkTwoPointConicalGradient: ("); | 372 str->append("SkTwoPointConicalGradient: ("); |
373 | 373 |
374 str->append("center1: ("); | 374 str->append("center1: ("); |
(...skipping 10 matching lines...) Expand all Loading... |
385 str->appendScalar(fCenter2.fY); | 385 str->appendScalar(fCenter2.fY); |
386 str->append(") radius2: "); | 386 str->append(") radius2: "); |
387 str->appendScalar(fRadius2); | 387 str->appendScalar(fRadius2); |
388 str->append(" "); | 388 str->append(" "); |
389 | 389 |
390 this->INHERITED::toString(str); | 390 this->INHERITED::toString(str); |
391 | 391 |
392 str->append(")"); | 392 str->append(")"); |
393 } | 393 } |
394 #endif | 394 #endif |
OLD | NEW |