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" | 9 #include "SkTwoPointConicalGradient_gpu.h" |
10 | 10 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 buffer.writePoint(fCenter1); | 352 buffer.writePoint(fCenter1); |
353 buffer.writePoint(fCenter2); | 353 buffer.writePoint(fCenter2); |
354 buffer.writeScalar(fRadius1); | 354 buffer.writeScalar(fRadius1); |
355 buffer.writeScalar(fRadius2); | 355 buffer.writeScalar(fRadius2); |
356 buffer.writeBool(fFlippedGrad); | 356 buffer.writeBool(fFlippedGrad); |
357 } | 357 } |
358 | 358 |
359 #if SK_SUPPORT_GPU | 359 #if SK_SUPPORT_GPU |
360 | 360 |
361 #include "SkGr.h" | 361 #include "SkGr.h" |
362 #include "effects/GrExtractAlphaFragmentProcessor.h" | |
363 | 362 |
364 const GrFragmentProcessor* SkTwoPointConicalGradient::asFragmentProcessor(GrCont
ext* context, | 363 bool SkTwoPointConicalGradient::asFragmentProcessor(GrContext* context, |
365 const SkMatrix& viewM, const SkMatrix* localMatrix, SkFilterQuality, | 364 const SkPaint& paint, |
366 GrProcessorDataManager* procDataManager) const { | 365 const SkMatrix& viewM, |
| 366 const SkMatrix* localMatrix, |
| 367 GrColor* paintColor, |
| 368 GrProcessorDataManager* proc
DataManager, |
| 369 GrFragmentProcessor** fp) c
onst { |
367 SkASSERT(context); | 370 SkASSERT(context); |
368 SkASSERT(fPtsToUnit.isIdentity()); | 371 SkASSERT(fPtsToUnit.isIdentity()); |
369 SkAutoTUnref<const GrFragmentProcessor> inner( | 372 |
370 Gr2PtConicalGradientEffect::Create(context, procDataManager, *this, fTil
eMode, | 373 *fp = Gr2PtConicalGradientEffect::Create(context, procDataManager, *this, fT
ileMode, |
371 localMatrix)); | 374 localMatrix); |
372 return GrExtractAlphaFragmentProcessor::Create(inner); | 375 *paintColor = SkColor2GrColorJustAlpha(paint.getColor()); |
| 376 return true; |
| 377 } |
| 378 |
| 379 #else |
| 380 |
| 381 bool SkTwoPointConicalGradient::asFragmentProcessor(GrContext*, const SkPaint&, |
| 382 const SkMatrix&, const SkMat
rix*, |
| 383 GrColor*, GrProcessorDataMan
ager*, |
| 384 GrFragmentProcessor**) cons
t { |
| 385 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 386 return false; |
373 } | 387 } |
374 | 388 |
375 #endif | 389 #endif |
376 | 390 |
377 #ifndef SK_IGNORE_TO_STRING | 391 #ifndef SK_IGNORE_TO_STRING |
378 void SkTwoPointConicalGradient::toString(SkString* str) const { | 392 void SkTwoPointConicalGradient::toString(SkString* str) const { |
379 str->append("SkTwoPointConicalGradient: ("); | 393 str->append("SkTwoPointConicalGradient: ("); |
380 | 394 |
381 str->append("center1: ("); | 395 str->append("center1: ("); |
382 str->appendScalar(fCenter1.fX); | 396 str->appendScalar(fCenter1.fX); |
383 str->append(", "); | 397 str->append(", "); |
384 str->appendScalar(fCenter1.fY); | 398 str->appendScalar(fCenter1.fY); |
385 str->append(") radius1: "); | 399 str->append(") radius1: "); |
386 str->appendScalar(fRadius1); | 400 str->appendScalar(fRadius1); |
387 str->append(" "); | 401 str->append(" "); |
388 | 402 |
389 str->append("center2: ("); | 403 str->append("center2: ("); |
390 str->appendScalar(fCenter2.fX); | 404 str->appendScalar(fCenter2.fX); |
391 str->append(", "); | 405 str->append(", "); |
392 str->appendScalar(fCenter2.fY); | 406 str->appendScalar(fCenter2.fY); |
393 str->append(") radius2: "); | 407 str->append(") radius2: "); |
394 str->appendScalar(fRadius2); | 408 str->appendScalar(fRadius2); |
395 str->append(" "); | 409 str->append(" "); |
396 | 410 |
397 this->INHERITED::toString(str); | 411 this->INHERITED::toString(str); |
398 | 412 |
399 str->append(")"); | 413 str->append(")"); |
400 } | 414 } |
401 #endif | 415 #endif |
OLD | NEW |