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

Side by Side Diff: src/effects/SkTransparentShader.cpp

Issue 264843006: create struct to hold all the params passed around for shader::context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review comments 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/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 9
10 #include "SkTransparentShader.h" 10 #include "SkTransparentShader.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 13
14 SkShader::Context* SkTransparentShader::createContext(const SkBitmap& device, 14 SkShader::Context* SkTransparentShader::createContext(const ContextRec& rec, voi d* storage) const {
15 const SkPaint& paint, 15 if (!this->validContext(rec)) {
16 const SkMatrix& matrix,
17 void* storage) const {
18 if (!this->validContext(device, paint, matrix)) {
19 return NULL; 16 return NULL;
20 } 17 }
21 18
22 return SkNEW_PLACEMENT_ARGS(storage, TransparentShaderContext, (*this, devic e, paint, matrix)); 19 return SkNEW_PLACEMENT_ARGS(storage, TransparentShaderContext, (*this, rec)) ;
23 } 20 }
24 21
25 size_t SkTransparentShader::contextSize() const { 22 size_t SkTransparentShader::contextSize() const {
26 return sizeof(TransparentShaderContext); 23 return sizeof(TransparentShaderContext);
27 } 24 }
28 25
29 SkTransparentShader::TransparentShaderContext::TransparentShaderContext( 26 SkTransparentShader::TransparentShaderContext::TransparentShaderContext(
30 const SkTransparentShader& shader, const SkBitmap& device, 27 const SkTransparentShader& shader, const ContextRec& rec)
31 const SkPaint& paint, const SkMatrix& matrix) 28 : INHERITED(shader, rec)
32 : INHERITED(shader, device, paint, matrix) 29 , fDevice(rec.fDevice) {}
33 , fDevice(&device) {}
34 30
35 SkTransparentShader::TransparentShaderContext::~TransparentShaderContext() {} 31 SkTransparentShader::TransparentShaderContext::~TransparentShaderContext() {}
36 32
37 uint32_t SkTransparentShader::TransparentShaderContext::getFlags() const { 33 uint32_t SkTransparentShader::TransparentShaderContext::getFlags() const {
38 uint32_t flags = this->INHERITED::getFlags(); 34 uint32_t flags = this->INHERITED::getFlags();
39 35
40 switch (fDevice->colorType()) { 36 switch (fDevice->colorType()) {
41 case kRGB_565_SkColorType: 37 case kRGB_565_SkColorType:
42 flags |= kHasSpan16_Flag; 38 flags |= kHasSpan16_Flag;
43 if (this->getPaintAlpha() == 255) 39 if (this->getPaintAlpha() == 255)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 120
125 #ifndef SK_IGNORE_TO_STRING 121 #ifndef SK_IGNORE_TO_STRING
126 void SkTransparentShader::toString(SkString* str) const { 122 void SkTransparentShader::toString(SkString* str) const {
127 str->append("SkTransparentShader: ("); 123 str->append("SkTransparentShader: (");
128 124
129 this->INHERITED::toString(str); 125 this->INHERITED::toString(str);
130 126
131 str->append(")"); 127 str->append(")");
132 } 128 }
133 #endif 129 #endif
OLDNEW
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698