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

Side by Side Diff: src/core/SkPictureShader.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/SkPictureShader.h ('k') | src/core/SkShader.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 2014 Google Inc. 2 * Copyright 2014 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 "SkPictureShader.h" 8 #include "SkPictureShader.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 tileShader.reset(tileImage->newShader(fTmx, fTmy, &shaderMatrix)); 234 tileShader.reset(tileImage->newShader(fTmx, fTmy, &shaderMatrix));
235 235
236 const SkImageInfo tileInfo = SkImageInfo::MakeN32Premul(tileSize); 236 const SkImageInfo tileInfo = SkImageInfo::MakeN32Premul(tileSize);
237 SkResourceCache::Add(new BitmapShaderRec(key, tileShader.get(), 237 SkResourceCache::Add(new BitmapShaderRec(key, tileShader.get(),
238 tileInfo.getSafeSize(tileInfo.m inRowBytes()))); 238 tileInfo.getSafeSize(tileInfo.m inRowBytes())));
239 } 239 }
240 240
241 return tileShader.detach(); 241 return tileShader.detach();
242 } 242 }
243 243
244 size_t SkPictureShader::contextSize(const ContextRec&) const { 244 size_t SkPictureShader::onContextSize(const ContextRec&) const {
245 return sizeof(PictureShaderContext); 245 return SkAlign16(sizeof(PictureShaderContext));
246 } 246 }
247 247
248 SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void* storage) const { 248 SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void* storage) const {
249 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix, rec. fLocalMatrix)); 249 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix, rec. fLocalMatrix));
250 if (nullptr == bitmapShader.get()) { 250 if (nullptr == bitmapShader.get()) {
251 return nullptr; 251 return nullptr;
252 } 252 }
253 return PictureShaderContext::Create(storage, *this, rec, bitmapShader); 253 return PictureShaderContext::Create(storage, *this, rec, bitmapShader);
254 } 254 }
255 255
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (context) { 325 if (context) {
326 maxTextureSize = context->caps()->maxTextureSize(); 326 maxTextureSize = context->caps()->maxTextureSize();
327 } 327 }
328 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix , maxTextureSize)); 328 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix , maxTextureSize));
329 if (!bitmapShader) { 329 if (!bitmapShader) {
330 return nullptr; 330 return nullptr;
331 } 331 }
332 return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq); 332 return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq);
333 } 333 }
334 #endif 334 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureShader.h ('k') | src/core/SkShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698