OLD | NEW |
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 Loading... |
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::onContextSize(const ContextRec&) const { | 244 size_t SkPictureShader::contextSize(const ContextRec&) const { |
245 return SkAlign16(sizeof(PictureShaderContext)); | 245 return 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 Loading... |
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 |
OLD | NEW |