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