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

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

Issue 769953002: 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
263 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) { 255 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) {
264 DescriptorScope desc; 256 DescriptorScope desc;
265 if (!desc.unflatten(buffer)) { 257 if (!desc.unflatten(buffer)) {
266 return NULL; 258 return NULL;
267 } 259 }
268 const SkPoint center = buffer.readPoint(); 260 const SkPoint center = buffer.readPoint();
269 const SkScalar radius = buffer.readScalar(); 261 const SkScalar radius = buffer.readScalar();
270 return SkGradientShader::CreateRadial(center, radius, desc.fColors, desc.fPo s, desc.fCount, 262 return SkGradientShader::CreateRadial(center, radius, desc.fColors, desc.fPo s, desc.fCount,
271 desc.fTileMode, desc.fGradFlags, desc. fLocalMatrix); 263 desc.fTileMode, desc.fGradFlags, desc. fLocalMatrix);
272 } 264 }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 t.append(")"); 563 t.append(")");
572 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); 564 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers);
573 } 565 }
574 566
575 ///////////////////////////////////////////////////////////////////// 567 /////////////////////////////////////////////////////////////////////
576 568
577 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa int, 569 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa int,
578 const SkMatrix* localMatrix, GrColor* paintColor, 570 const SkMatrix* localMatrix, GrColor* paintColor,
579 GrFragmentProcessor** fp) const { 571 GrFragmentProcessor** fp) const {
580 SkASSERT(context); 572 SkASSERT(context);
581 573
582 SkMatrix matrix; 574 SkMatrix matrix;
583 if (!this->getLocalMatrix().invert(&matrix)) { 575 if (!this->getLocalMatrix().invert(&matrix)) {
584 return false; 576 return false;
585 } 577 }
586 if (localMatrix) { 578 if (localMatrix) {
587 SkMatrix inv; 579 SkMatrix inv;
588 if (!localMatrix->invert(&inv)) { 580 if (!localMatrix->invert(&inv)) {
589 return false; 581 return false;
590 } 582 }
591 matrix.postConcat(inv); 583 matrix.postConcat(inv);
592 } 584 }
593 matrix.postConcat(fPtsToUnit); 585 matrix.postConcat(fPtsToUnit);
594 586
595 *paintColor = SkColor2GrColorJustAlpha(paint.getColor()); 587 *paintColor = SkColor2GrColorJustAlpha(paint.getColor());
596 *fp = GrRadialGradient::Create(context, *this, matrix, fTileMode); 588 *fp = GrRadialGradient::Create(context, *this, matrix, fTileMode);
597 589
598 return true; 590 return true;
599 } 591 }
600 592
601 #else 593 #else
602 594
603 bool SkRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkM atrix*, GrColor*, 595 bool SkRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkM atrix*, GrColor*,
604 GrFragmentProcessor**) const { 596 GrFragmentProcessor**) const {
605 SkDEBUGFAIL("Should not call in GPU-less build"); 597 SkDEBUGFAIL("Should not call in GPU-less build");
606 return false; 598 return false;
607 } 599 }
(...skipping 10 matching lines...) Expand all
618 str->appendScalar(fCenter.fY); 610 str->appendScalar(fCenter.fY);
619 str->append(") radius: "); 611 str->append(") radius: ");
620 str->appendScalar(fRadius); 612 str->appendScalar(fRadius);
621 str->append(" "); 613 str->append(" ");
622 614
623 this->INHERITED::toString(str); 615 this->INHERITED::toString(str);
624 616
625 str->append(")"); 617 str->append(")");
626 } 618 }
627 #endif 619 #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