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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 struct BitmapShaderRec : public SkResourceCache::Rec { | 63 struct BitmapShaderRec : public SkResourceCache::Rec { |
64 BitmapShaderRec(const BitmapShaderKey& key, SkShader* tileShader, size_t bit
mapBytes) | 64 BitmapShaderRec(const BitmapShaderKey& key, SkShader* tileShader, size_t bit
mapBytes) |
65 : fKey(key) | 65 : fKey(key) |
66 , fShader(SkRef(tileShader)) | 66 , fShader(SkRef(tileShader)) |
67 , fBitmapBytes(bitmapBytes) {} | 67 , fBitmapBytes(bitmapBytes) {} |
68 | 68 |
69 BitmapShaderKey fKey; | 69 BitmapShaderKey fKey; |
70 SkAutoTUnref<SkShader> fShader; | 70 SkAutoTUnref<SkShader> fShader; |
71 size_t fBitmapBytes; | 71 size_t fBitmapBytes; |
72 | 72 |
73 virtual const Key& getKey() const SK_OVERRIDE { return fKey; } | 73 const Key& getKey() const SK_OVERRIDE { return fKey; } |
74 virtual size_t bytesUsed() const SK_OVERRIDE { | 74 size_t bytesUsed() const SK_OVERRIDE { |
75 return sizeof(fKey) + sizeof(SkShader) + fBitmapBytes; | 75 return sizeof(fKey) + sizeof(SkShader) + fBitmapBytes; |
76 } | 76 } |
77 | 77 |
78 static bool Visitor(const SkResourceCache::Rec& baseRec, void* contextShader
) { | 78 static bool Visitor(const SkResourceCache::Rec& baseRec, void* contextShader
) { |
79 const BitmapShaderRec& rec = static_cast<const BitmapShaderRec&>(baseRec
); | 79 const BitmapShaderRec& rec = static_cast<const BitmapShaderRec&>(baseRec
); |
80 SkAutoTUnref<SkShader>* result = reinterpret_cast<SkAutoTUnref<SkShader>
*>(contextShader); | 80 SkAutoTUnref<SkShader>* result = reinterpret_cast<SkAutoTUnref<SkShader>
*>(contextShader); |
81 | 81 |
82 result->reset(SkRef(rec.fShader.get())); | 82 result->reset(SkRef(rec.fShader.get())); |
83 | 83 |
84 SkBitmap tile; | 84 SkBitmap tile; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); | 300 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); |
301 } | 301 } |
302 #else | 302 #else |
303 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, | 303 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, |
304 const SkMatrix*, GrColor*, | 304 const SkMatrix*, GrColor*, |
305 GrFragmentProcessor**) const { | 305 GrFragmentProcessor**) const { |
306 SkDEBUGFAIL("Should not call in GPU-less build"); | 306 SkDEBUGFAIL("Should not call in GPU-less build"); |
307 return false; | 307 return false; |
308 } | 308 } |
309 #endif | 309 #endif |
OLD | NEW |