Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: src/effects/gradients/SkRadialGradient.cpp

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 #include "SkRadialGradient.h" 9 #include "SkRadialGradient.h"
10 #include "SkRadialGradient_Table.h" 10 #include "SkRadialGradient_Table.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const { 246 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const {
247 if (info) { 247 if (info) {
248 commonAsAGradient(info); 248 commonAsAGradient(info);
249 info->fPoint[0] = fCenter; 249 info->fPoint[0] = fCenter;
250 info->fRadius[0] = fRadius; 250 info->fRadius[0] = fRadius;
251 } 251 }
252 return kRadial_GradientType; 252 return kRadial_GradientType;
253 } 253 }
254 254
255 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
256 SkRadialGradient::SkRadialGradient(SkReadBuffer& buffer)
257 : INHERITED(buffer),
258 fCenter(buffer.readPoint()),
259 fRadius(buffer.readScalar()) {
260 }
261 #endif
262
255 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) { 263 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) {
256 DescriptorScope desc; 264 DescriptorScope desc;
257 if (!desc.unflatten(buffer)) { 265 if (!desc.unflatten(buffer)) {
258 return NULL; 266 return NULL;
259 } 267 }
260 const SkPoint center = buffer.readPoint(); 268 const SkPoint center = buffer.readPoint();
261 const SkScalar radius = buffer.readScalar(); 269 const SkScalar radius = buffer.readScalar();
262 return SkGradientShader::CreateRadial(center, radius, desc.fColors, desc.fPo s, desc.fCount, 270 return SkGradientShader::CreateRadial(center, radius, desc.fColors, desc.fPo s, desc.fCount,
263 desc.fTileMode, desc.fGradFlags, desc. fLocalMatrix); 271 desc.fTileMode, desc.fGradFlags, desc. fLocalMatrix);
264 } 272 }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 t.append(")"); 571 t.append(")");
564 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); 572 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers);
565 } 573 }
566 574
567 ///////////////////////////////////////////////////////////////////// 575 /////////////////////////////////////////////////////////////////////
568 576
569 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa int, 577 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa int,
570 const SkMatrix* localMatrix, GrColor* paintColor, 578 const SkMatrix* localMatrix, GrColor* paintColor,
571 GrFragmentProcessor** fp) const { 579 GrFragmentProcessor** fp) const {
572 SkASSERT(context); 580 SkASSERT(context);
573 581
574 SkMatrix matrix; 582 SkMatrix matrix;
575 if (!this->getLocalMatrix().invert(&matrix)) { 583 if (!this->getLocalMatrix().invert(&matrix)) {
576 return false; 584 return false;
577 } 585 }
578 if (localMatrix) { 586 if (localMatrix) {
579 SkMatrix inv; 587 SkMatrix inv;
580 if (!localMatrix->invert(&inv)) { 588 if (!localMatrix->invert(&inv)) {
581 return false; 589 return false;
582 } 590 }
583 matrix.postConcat(inv); 591 matrix.postConcat(inv);
584 } 592 }
585 matrix.postConcat(fPtsToUnit); 593 matrix.postConcat(fPtsToUnit);
586 594
587 *paintColor = SkColor2GrColorJustAlpha(paint.getColor()); 595 *paintColor = SkColor2GrColorJustAlpha(paint.getColor());
588 *fp = GrRadialGradient::Create(context, *this, matrix, fTileMode); 596 *fp = GrRadialGradient::Create(context, *this, matrix, fTileMode);
589 597
590 return true; 598 return true;
591 } 599 }
592 600
593 #else 601 #else
594 602
595 bool SkRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkM atrix*, GrColor*, 603 bool SkRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkM atrix*, GrColor*,
596 GrFragmentProcessor**) const { 604 GrFragmentProcessor**) const {
597 SkDEBUGFAIL("Should not call in GPU-less build"); 605 SkDEBUGFAIL("Should not call in GPU-less build");
598 return false; 606 return false;
599 } 607 }
(...skipping 10 matching lines...) Expand all
610 str->appendScalar(fCenter.fY); 618 str->appendScalar(fCenter.fY);
611 str->append(") radius: "); 619 str->append(") radius: ");
612 str->appendScalar(fRadius); 620 str->appendScalar(fRadius);
613 str->append(" "); 621 str->append(" ");
614 622
615 this->INHERITED::toString(str); 623 this->INHERITED::toString(str);
616 624
617 str->append(")"); 625 str->append(")");
618 } 626 }
619 #endif 627 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698