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