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

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

Issue 261773005: Remove SkShader virtual method validContext (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: correctly call shaderA/B in composeshader Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.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 * 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 "SkLinearGradient.h" 8 #include "SkLinearGradient.h"
9 9
10 static inline int repeat_bits(int x, const int bits) { 10 static inline int repeat_bits(int x, const int bits) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { 69 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const {
70 this->INHERITED::flatten(buffer); 70 this->INHERITED::flatten(buffer);
71 buffer.writePoint(fStart); 71 buffer.writePoint(fStart);
72 buffer.writePoint(fEnd); 72 buffer.writePoint(fEnd);
73 } 73 }
74 74
75 size_t SkLinearGradient::contextSize() const { 75 size_t SkLinearGradient::contextSize() const {
76 return sizeof(LinearGradientContext); 76 return sizeof(LinearGradientContext);
77 } 77 }
78 78
79 SkShader::Context* SkLinearGradient::createContext(const ContextRec& rec, void* storage) const { 79 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void * storage) const {
80 if (!this->validContext(rec)) {
81 return NULL;
82 }
83
84 return SkNEW_PLACEMENT_ARGS(storage, LinearGradientContext, (*this, rec)); 80 return SkNEW_PLACEMENT_ARGS(storage, LinearGradientContext, (*this, rec));
85 } 81 }
86 82
87 SkLinearGradient::LinearGradientContext::LinearGradientContext( 83 SkLinearGradient::LinearGradientContext::LinearGradientContext(
88 const SkLinearGradient& shader, const ContextRec& rec) 84 const SkLinearGradient& shader, const ContextRec& rec)
89 : INHERITED(shader, rec) 85 : INHERITED(shader, rec)
90 { 86 {
91 unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask; 87 unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
92 if ((fDstToIndex.getType() & ~mask) == 0) { 88 if ((fDstToIndex.getType() & ~mask) == 0) {
93 // when we dither, we are (usually) not const-in-Y 89 // when we dither, we are (usually) not const-in-Y
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 str->append("SkLinearGradient ("); 571 str->append("SkLinearGradient (");
576 572
577 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); 573 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY);
578 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); 574 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY);
579 575
580 this->INHERITED::toString(str); 576 this->INHERITED::toString(str);
581 577
582 str->append(")"); 578 str->append(")");
583 } 579 }
584 #endif 580 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698