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" |
362 | 363 |
363 bool SkTwoPointConicalGradient::asFragmentProcessor(GrContext* context, | 364 const GrFragmentProcessor* SkTwoPointConicalGradient::asFragmentProcessor( |
364 const SkPaint& paint, | 365 GrContext* context, |
365 const SkMatrix& viewM, | 366 const SkMatrix& viewM, |
366 const SkMatrix* localMatrix, | 367 const SkMatrix* localMatrix, |
367 GrColor* paintColor, | 368 SkFilterQuality, |
368 GrProcessorDataManager* proc
DataManager, | 369 GrProcessorDataManager* procDa
taManager) const { |
369 GrFragmentProcessor** fp) c
onst { | |
370 SkASSERT(context); | 370 SkASSERT(context); |
371 SkASSERT(fPtsToUnit.isIdentity()); | 371 SkASSERT(fPtsToUnit.isIdentity()); |
372 | 372 SkAutoTUnref<const GrFragmentProcessor> inner( |
373 *fp = Gr2PtConicalGradientEffect::Create(context, procDataManager, *this, fT
ileMode, | 373 Gr2PtConicalGradientEffect::Create(context, procDataManager, *this, fTil
eMode, |
374 localMatrix); | 374 localMatrix)); |
375 *paintColor = SkColor2GrColorJustAlpha(paint.getColor()); | 375 return GrExtractAlphaFragmentProcessor::Create(inner); |
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; | |
387 } | 376 } |
388 | 377 |
389 #endif | 378 #endif |
390 | 379 |
391 #ifndef SK_IGNORE_TO_STRING | 380 #ifndef SK_IGNORE_TO_STRING |
392 void SkTwoPointConicalGradient::toString(SkString* str) const { | 381 void SkTwoPointConicalGradient::toString(SkString* str) const { |
393 str->append("SkTwoPointConicalGradient: ("); | 382 str->append("SkTwoPointConicalGradient: ("); |
394 | 383 |
395 str->append("center1: ("); | 384 str->append("center1: ("); |
396 str->appendScalar(fCenter1.fX); | 385 str->appendScalar(fCenter1.fX); |
397 str->append(", "); | 386 str->append(", "); |
398 str->appendScalar(fCenter1.fY); | 387 str->appendScalar(fCenter1.fY); |
399 str->append(") radius1: "); | 388 str->append(") radius1: "); |
400 str->appendScalar(fRadius1); | 389 str->appendScalar(fRadius1); |
401 str->append(" "); | 390 str->append(" "); |
402 | 391 |
403 str->append("center2: ("); | 392 str->append("center2: ("); |
404 str->appendScalar(fCenter2.fX); | 393 str->appendScalar(fCenter2.fX); |
405 str->append(", "); | 394 str->append(", "); |
406 str->appendScalar(fCenter2.fY); | 395 str->appendScalar(fCenter2.fY); |
407 str->append(") radius2: "); | 396 str->append(") radius2: "); |
408 str->appendScalar(fRadius2); | 397 str->appendScalar(fRadius2); |
409 str->append(" "); | 398 str->append(" "); |
410 | 399 |
411 this->INHERITED::toString(str); | 400 this->INHERITED::toString(str); |
412 | 401 |
413 str->append(")"); | 402 str->append(")"); |
414 } | 403 } |
415 #endif | 404 #endif |
OLD | NEW |