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

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

Issue 1759653004: enforce 16byte alignment in shader contexts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/core/SkColorFilterShader.h ('k') | src/core/SkColorShader.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 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 "SkColorFilterShader.h" 8 #include "SkColorFilterShader.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SkShader::Context* SkColorFilterShader::onCreateContext(const ContextRec& rec, 55 SkShader::Context* SkColorFilterShader::onCreateContext(const ContextRec& rec,
56 void* storage) const { 56 void* storage) const {
57 char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext); 57 char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext);
58 SkShader::Context* shaderContext = fShader->createContext(rec, shaderContext Storage); 58 SkShader::Context* shaderContext = fShader->createContext(rec, shaderContext Storage);
59 if (nullptr == shaderContext) { 59 if (nullptr == shaderContext) {
60 return nullptr; 60 return nullptr;
61 } 61 }
62 return new (storage) FilterShaderContext(*this, shaderContext, rec); 62 return new (storage) FilterShaderContext(*this, shaderContext, rec);
63 } 63 }
64 64
65 size_t SkColorFilterShader::contextSize(const ContextRec& rec) const { 65 size_t SkColorFilterShader::onContextSize(const ContextRec& rec) const {
66 return sizeof(FilterShaderContext) + fShader->contextSize(rec); 66 return SkAlign16(sizeof(FilterShaderContext)) + fShader->contextSize(rec);
67 } 67 }
68 68
69 SkColorFilterShader::FilterShaderContext::FilterShaderContext( 69 SkColorFilterShader::FilterShaderContext::FilterShaderContext(
70 const SkColorFilterShad er& filterShader, 70 const SkColorFilterShad er& filterShader,
71 SkShader::Context* shad erContext, 71 SkShader::Context* shad erContext,
72 const ContextRec& rec) 72 const ContextRec& rec)
73 : INHERITED(filterShader, rec) 73 : INHERITED(filterShader, rec)
74 , fShaderContext(shaderContext) 74 , fShaderContext(shaderContext)
75 {} 75 {}
76 76
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 //////////////////////////////////////////////////////////////////////////////// /////////////////// 138 //////////////////////////////////////////////////////////////////////////////// ///////////////////
139 139
140 SkShader* SkShader::newWithColorFilter(SkColorFilter* filter) const { 140 SkShader* SkShader::newWithColorFilter(SkColorFilter* filter) const {
141 SkShader* base = const_cast<SkShader*>(this); 141 SkShader* base = const_cast<SkShader*>(this);
142 if (!filter) { 142 if (!filter) {
143 return SkRef(base); 143 return SkRef(base);
144 } 144 }
145 return new SkColorFilterShader(base, filter); 145 return new SkColorFilterShader(base, filter);
146 } 146 }
OLDNEW
« no previous file with comments | « src/core/SkColorFilterShader.h ('k') | src/core/SkColorShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698