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

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

Issue 2397473003: Harden degenerate gradient context handling (Closed)
Patch Set: Created 4 years, 2 months 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.cpp » ('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 * 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 "SkRadialGradient.h" 8 #include "SkRadialGradient.h"
9 #include "SkNx.h" 9 #include "SkNx.h"
10 10
(...skipping 26 matching lines...) Expand all
37 : SkGradientShaderBase(desc, rad_to_unit_matrix(center, radius)) 37 : SkGradientShaderBase(desc, rad_to_unit_matrix(center, radius))
38 , fCenter(center) 38 , fCenter(center)
39 , fRadius(radius) { 39 , fRadius(radius) {
40 } 40 }
41 41
42 size_t SkRadialGradient::onContextSize(const ContextRec&) const { 42 size_t SkRadialGradient::onContextSize(const ContextRec&) const {
43 return sizeof(RadialGradientContext); 43 return sizeof(RadialGradientContext);
44 } 44 }
45 45
46 SkShader::Context* SkRadialGradient::onCreateContext(const ContextRec& rec, void * storage) const { 46 SkShader::Context* SkRadialGradient::onCreateContext(const ContextRec& rec, void * storage) const {
47 return new (storage) RadialGradientContext(*this, rec); 47 return CheckedCreateContext<RadialGradientContext>(storage, *this, rec);
48 } 48 }
49 49
50 SkRadialGradient::RadialGradientContext::RadialGradientContext( 50 SkRadialGradient::RadialGradientContext::RadialGradientContext(
51 const SkRadialGradient& shader, const ContextRec& rec) 51 const SkRadialGradient& shader, const ContextRec& rec)
52 : INHERITED(shader, rec) {} 52 : INHERITED(shader, rec) {}
53 53
54 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const { 54 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const {
55 if (info) { 55 if (info) {
56 commonAsAGradient(info); 56 commonAsAGradient(info);
57 info->fPoint[0] = fCenter; 57 info->fPoint[0] = fCenter;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 str->appendScalar(fCenter.fY); 377 str->appendScalar(fCenter.fY);
378 str->append(") radius: "); 378 str->append(") radius: ");
379 str->appendScalar(fRadius); 379 str->appendScalar(fRadius);
380 str->append(" "); 380 str->append(" ");
381 381
382 this->INHERITED::toString(str); 382 this->INHERITED::toString(str);
383 383
384 str->append(")"); 384 str->append(")");
385 } 385 }
386 #endif 386 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698