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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 214 } |
215 | 215 |
216 SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
storage) const { | 216 SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
storage) const { |
217 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix, rec.
fLocalMatrix)); | 217 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix, rec.
fLocalMatrix)); |
218 if (NULL == bitmapShader.get()) { | 218 if (NULL == bitmapShader.get()) { |
219 return NULL; | 219 return NULL; |
220 } | 220 } |
221 return PictureShaderContext::Create(storage, *this, rec, bitmapShader); | 221 return PictureShaderContext::Create(storage, *this, rec, bitmapShader); |
222 } | 222 } |
223 | 223 |
| 224 void SkPictureShader::onPreroll() const { |
| 225 fPicture->preroll(NULL, NULL, NULL, NULL); |
| 226 } |
| 227 |
224 ////////////////////////////////////////////////////////////////////////////////
///////// | 228 ////////////////////////////////////////////////////////////////////////////////
///////// |
225 | 229 |
226 SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage, | 230 SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage, |
227 const SkPictureShader& shader, const ContextRec& rec, SkShade
r* bitmapShader) { | 231 const SkPictureShader& shader, const ContextRec& rec, SkShade
r* bitmapShader) { |
228 PictureShaderContext* ctx = SkNEW_PLACEMENT_ARGS(storage, PictureShaderConte
xt, | 232 PictureShaderContext* ctx = SkNEW_PLACEMENT_ARGS(storage, PictureShaderConte
xt, |
229 (shader, rec, bitmapShader)
); | 233 (shader, rec, bitmapShader)
); |
230 if (NULL == ctx->fBitmapShaderContext) { | 234 if (NULL == ctx->fBitmapShaderContext) { |
231 ctx->~PictureShaderContext(); | 235 ctx->~PictureShaderContext(); |
232 ctx = NULL; | 236 ctx = NULL; |
233 } | 237 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); | 305 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); |
302 } | 306 } |
303 #else | 307 #else |
304 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, | 308 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, |
305 const SkMatrix*, GrColor*, | 309 const SkMatrix*, GrColor*, |
306 GrFragmentProcessor**) const { | 310 GrFragmentProcessor**) const { |
307 SkDEBUGFAIL("Should not call in GPU-less build"); | 311 SkDEBUGFAIL("Should not call in GPU-less build"); |
308 return false; | 312 return false; |
309 } | 313 } |
310 #endif | 314 #endif |
OLD | NEW |