| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmapProvider.h" | 8 #include "SkBitmapProvider.h" |
| 9 #include "SkImage_Base.h" | 9 #include "SkImage_Base.h" |
| 10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const { | 55 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const { |
| 56 return fImage ? SkBitmapCacheDesc::Make(fImage, w, h) : SkBitmapCacheDesc::M
ake(fBitmap, w, h); | 56 return fImage ? SkBitmapCacheDesc::Make(fImage, w, h) : SkBitmapCacheDesc::M
ake(fBitmap, w, h); |
| 57 } | 57 } |
| 58 | 58 |
| 59 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const { | 59 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const { |
| 60 return fImage ? SkBitmapCacheDesc::Make(fImage) : SkBitmapCacheDesc::Make(fB
itmap); | 60 return fImage ? SkBitmapCacheDesc::Make(fImage) : SkBitmapCacheDesc::Make(fB
itmap); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void SkBitmapProvider::notifyAddedToCache() const { | 63 void SkBitmapProvider::notifyAddedToCache() const { |
| 64 if (fImage) { | 64 if (fImage) { |
| 65 // TODO | 65 as_IB(fImage)->notifyAddedToCache(); |
| 66 } else { | 66 } else { |
| 67 fBitmap.pixelRef()->notifyAddedToCache(); | 67 fBitmap.pixelRef()->notifyAddedToCache(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool SkBitmapProvider::asBitmap(SkBitmap* bm) const { | 71 bool SkBitmapProvider::asBitmap(SkBitmap* bm) const { |
| 72 if (fImage) { | 72 if (fImage) { |
| 73 return as_IB(fImage)->getROPixels(bm); | 73 return as_IB(fImage)->getROPixels(bm); |
| 74 } else { | 74 } else { |
| 75 *bm = fBitmap; | 75 *bm = fBitmap; |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| OLD | NEW |