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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 size_t SkPictureShader::contextSize() const { | 113 size_t SkPictureShader::contextSize() const { |
114 return sizeof(PictureShaderContext); | 114 return sizeof(PictureShaderContext); |
115 } | 115 } |
116 | 116 |
117 SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
storage) const { | 117 SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
storage) const { |
118 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix)); | 118 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(*rec.fMatrix)); |
119 if (NULL == bitmapShader.get()) { | 119 if (NULL == bitmapShader.get()) { |
120 return NULL; | 120 return NULL; |
121 } | 121 } |
122 return PictureShaderContext::Create(storage, *this, rec, bitmapShader.detach
()); | 122 return PictureShaderContext::Create(storage, *this, rec, bitmapShader); |
123 } | 123 } |
124 | 124 |
125 ////////////////////////////////////////////////////////////////////////////////
///////// | 125 ////////////////////////////////////////////////////////////////////////////////
///////// |
126 | 126 |
127 SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage, | 127 SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage, |
128 const SkPictureShader& shader, const ContextRec& rec, SkShade
r* bitmapShader) { | 128 const SkPictureShader& shader, const ContextRec& rec, SkShade
r* bitmapShader) { |
129 PictureShaderContext* ctx = SkNEW_PLACEMENT_ARGS(storage, PictureShaderConte
xt, | 129 PictureShaderContext* ctx = SkNEW_PLACEMENT_ARGS(storage, PictureShaderConte
xt, |
130 (shader, rec, bitmapShader)
); | 130 (shader, rec, bitmapShader)
); |
131 if (NULL == ctx->fBitmapShaderContext) { | 131 if (NULL == ctx->fBitmapShaderContext) { |
132 ctx->~PictureShaderContext(); | 132 ctx->~PictureShaderContext(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 #if SK_SUPPORT_GPU | 191 #if SK_SUPPORT_GPU |
192 GrEffectRef* SkPictureShader::asNewEffect(GrContext* context, const SkPaint& pai
nt) const { | 192 GrEffectRef* SkPictureShader::asNewEffect(GrContext* context, const SkPaint& pai
nt) const { |
193 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(context->getMatrix
())); | 193 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(context->getMatrix
())); |
194 if (!bitmapShader) { | 194 if (!bitmapShader) { |
195 return NULL; | 195 return NULL; |
196 } | 196 } |
197 return bitmapShader->asNewEffect(context, paint); | 197 return bitmapShader->asNewEffect(context, paint); |
198 } | 198 } |
199 #endif | 199 #endif |
OLD | NEW |