OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "LazyDecodeBitmap.h" | 8 #include "LazyDecodeBitmap.h" |
9 | 9 |
10 #include "PictureRenderingFlags.h" // --deferImageDecoding is defined here. | 10 #include "PictureRenderingFlags.h" // --deferImageDecoding is defined here. |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 public: | 34 public: |
35 CacheSelector() { | 35 CacheSelector() { |
36 fPurgeableImageCache = SkPurgeableImageCache::Create(); | 36 fPurgeableImageCache = SkPurgeableImageCache::Create(); |
37 } | 37 } |
38 | 38 |
39 ~CacheSelector() { | 39 ~CacheSelector() { |
40 SkSafeUnref(fPurgeableImageCache); | 40 SkSafeUnref(fPurgeableImageCache); |
41 } | 41 } |
42 | 42 |
43 virtual SkImageCache* selectCache(const SkImage::Info& info) SK_OVERRIDE { | 43 virtual SkImageCache* selectCache(const SkImageInfo& info) SK_OVERRIDE { |
44 if (info.fWidth * info.fHeight > 32 * 1024 && fPurgeableImageCache != NU
LL) { | 44 if (info.fWidth * info.fHeight > 32 * 1024 && fPurgeableImageCache != NU
LL) { |
45 return fPurgeableImageCache; | 45 return fPurgeableImageCache; |
46 } | 46 } |
47 return &gLruImageCache; | 47 return &gLruImageCache; |
48 } | 48 } |
49 private: | 49 private: |
50 SkImageCache* fPurgeableImageCache; | 50 SkImageCache* fPurgeableImageCache; |
51 }; | 51 }; |
52 | 52 |
53 static CacheSelector gCacheSelector; | 53 static CacheSelector gCacheSelector; |
(...skipping 13 matching lines...) Expand all Loading... |
67 gFactory.setCacheSelector(&gCacheSelector); | 67 gFactory.setCacheSelector(&gCacheSelector); |
68 } else { | 68 } else { |
69 gFactory.setImageCache(&gLruImageCache); | 69 gFactory.setImageCache(&gLruImageCache); |
70 } | 70 } |
71 gOnce = true; | 71 gOnce = true; |
72 } | 72 } |
73 return gFactory.installPixelRef(data, bitmap); | 73 return gFactory.installPixelRef(data, bitmap); |
74 } | 74 } |
75 | 75 |
76 } // namespace sk_tools | 76 } // namespace sk_tools |
OLD | NEW |