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

Side by Side Diff: src/core/SkFilterShader.cpp

Issue 279573002: return null if subshader fails (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « no previous file | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkFilterShader.h" 8 #include "SkFilterShader.h"
9 9
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // if the filter might change alpha, clear the opaque flag in the shader 51 // if the filter might change alpha, clear the opaque flag in the shader
52 if (!(filterF & SkColorFilter::kAlphaUnchanged_Flag)) { 52 if (!(filterF & SkColorFilter::kAlphaUnchanged_Flag)) {
53 shaderF &= ~(SkShader::kOpaqueAlpha_Flag | SkShader::kHasSpan16_Flag); 53 shaderF &= ~(SkShader::kOpaqueAlpha_Flag | SkShader::kHasSpan16_Flag);
54 } 54 }
55 return shaderF; 55 return shaderF;
56 } 56 }
57 57
58 SkShader::Context* SkFilterShader::onCreateContext(const ContextRec& rec, void* storage) const { 58 SkShader::Context* SkFilterShader::onCreateContext(const ContextRec& rec, void* storage) const {
59 char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext); 59 char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext);
60 SkShader::Context* shaderContext = fShader->createContext(rec, shaderContext Storage); 60 SkShader::Context* shaderContext = fShader->createContext(rec, shaderContext Storage);
61 SkASSERT(shaderContext); 61 if (NULL == shaderContext) {
62 62 return NULL;
63 }
63 return SkNEW_PLACEMENT_ARGS(storage, FilterShaderContext, (*this, shaderCont ext, rec)); 64 return SkNEW_PLACEMENT_ARGS(storage, FilterShaderContext, (*this, shaderCont ext, rec));
64 } 65 }
65 66
66 size_t SkFilterShader::contextSize() const { 67 size_t SkFilterShader::contextSize() const {
67 return sizeof(FilterShaderContext) + fShader->contextSize(); 68 return sizeof(FilterShaderContext) + fShader->contextSize();
68 } 69 }
69 70
70 SkFilterShader::FilterShaderContext::FilterShaderContext(const SkFilterShader& f ilterShader, 71 SkFilterShader::FilterShaderContext::FilterShaderContext(const SkFilterShader& f ilterShader,
71 SkShader::Context* shad erContext, 72 SkShader::Context* shad erContext,
72 const ContextRec& rec) 73 const ContextRec& rec)
(...skipping 28 matching lines...) Expand all
101 str->append("Shader: "); 102 str->append("Shader: ");
102 fShader->toString(str); 103 fShader->toString(str);
103 str->append(" Filter: "); 104 str->append(" Filter: ");
104 // TODO: add "fFilter->toString(str);" once SkColorFilter::toString is added 105 // TODO: add "fFilter->toString(str);" once SkColorFilter::toString is added
105 106
106 this->INHERITED::toString(str); 107 this->INHERITED::toString(str);
107 108
108 str->append(")"); 109 str->append(")");
109 } 110 }
110 #endif 111 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698