OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkAtomics.h" | 8 #include "SkAtomics.h" |
9 #include "SkBitmapProcShader.h" | 9 #include "SkBitmapProcShader.h" |
10 #include "SkColorShader.h" | 10 #include "SkColorShader.h" |
11 #include "SkEmptyShader.h" | 11 #include "SkEmptyShader.h" |
12 #include "SkMallocPixelRef.h" | 12 #include "SkMallocPixelRef.h" |
13 #include "SkPaint.h" | 13 #include "SkPaint.h" |
14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
15 #include "SkPictureShader.h" | 15 #include "SkPictureShader.h" |
16 #include "SkReadBuffer.h" | 16 #include "SkReadBuffer.h" |
17 #include "SkScalar.h" | 17 #include "SkScalar.h" |
18 #include "SkShader.h" | 18 #include "SkShader.h" |
19 #include "SkWriteBuffer.h" | 19 #include "SkWriteBuffer.h" |
20 | 20 |
| 21 #if SK_SUPPORT_GPU |
| 22 #include "GrFragmentProcessor.h" |
| 23 #endif |
| 24 |
21 //#define SK_TRACK_SHADER_LIFETIME | 25 //#define SK_TRACK_SHADER_LIFETIME |
22 | 26 |
23 #ifdef SK_TRACK_SHADER_LIFETIME | 27 #ifdef SK_TRACK_SHADER_LIFETIME |
24 static int32_t gShaderCounter; | 28 static int32_t gShaderCounter; |
25 #endif | 29 #endif |
26 | 30 |
27 static inline void inc_shader_counter() { | 31 static inline void inc_shader_counter() { |
28 #ifdef SK_TRACK_SHADER_LIFETIME | 32 #ifdef SK_TRACK_SHADER_LIFETIME |
29 int32_t prev = sk_atomic_inc(&gShaderCounter); | 33 int32_t prev = sk_atomic_inc(&gShaderCounter); |
30 SkDebugf("+++ shader counter %d\n", prev + 1); | 34 SkDebugf("+++ shader counter %d\n", prev + 1); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 217 } |
214 return mc; | 218 return mc; |
215 } | 219 } |
216 | 220 |
217 ////////////////////////////////////////////////////////////////////////////// | 221 ////////////////////////////////////////////////////////////////////////////// |
218 | 222 |
219 SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const { | 223 SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const { |
220 return kNone_GradientType; | 224 return kNone_GradientType; |
221 } | 225 } |
222 | 226 |
223 const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMat
rix&, | 227 #if SK_SUPPORT_GPU |
| 228 sk_sp<GrFragmentProcessor> SkShader::asFragmentProcessor(GrContext*, const SkMat
rix&, |
224 const SkMatrix*, SkFilt
erQuality, | 229 const SkMatrix*, SkFilt
erQuality, |
225 SkSourceGammaTreatment)
const { | 230 SkSourceGammaTreatment)
const { |
226 return nullptr; | 231 return nullptr; |
227 } | 232 } |
| 233 #endif |
228 | 234 |
229 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { | 235 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { |
230 return nullptr; | 236 return nullptr; |
231 } | 237 } |
232 | 238 |
233 sk_sp<SkShader> SkShader::MakeEmptyShader() { return sk_make_sp<SkEmptyShader>()
; } | 239 sk_sp<SkShader> SkShader::MakeEmptyShader() { return sk_make_sp<SkEmptyShader>()
; } |
234 | 240 |
235 sk_sp<SkShader> SkShader::MakeColorShader(SkColor color) { return sk_make_sp<SkC
olorShader>(color); } | 241 sk_sp<SkShader> SkShader::MakeColorShader(SkColor color) { return sk_make_sp<SkC
olorShader>(color); } |
236 | 242 |
237 sk_sp<SkShader> SkShader::MakeBitmapShader(const SkBitmap& src, TileMode tmx, Ti
leMode tmy, | 243 sk_sp<SkShader> SkShader::MakeBitmapShader(const SkBitmap& src, TileMode tmx, Ti
leMode tmy, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 296 } |
291 #endif | 297 #endif |
292 | 298 |
293 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR | 299 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR |
294 #include "SkXfermode.h" | 300 #include "SkXfermode.h" |
295 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader>
src, | 301 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader>
src, |
296 SkXfermode* xfer) { | 302 SkXfermode* xfer) { |
297 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer)); | 303 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer)); |
298 } | 304 } |
299 #endif | 305 #endif |
OLD | NEW |