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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 return NULL; | 49 return NULL; |
50 } | 50 } |
51 | 51 |
52 /** | 52 /** |
53 * A simplified version of SkBitmapFactory | 53 * A simplified version of SkBitmapFactory |
54 */ | 54 */ |
55 static bool simple_bitmap_factory(SkBitmapFactory::DecodeProc proc, | 55 static bool simple_bitmap_factory(SkBitmapFactory::DecodeProc proc, |
56 SkData* data, | 56 SkData* data, |
57 SkBitmap* dst) { | 57 SkBitmap* dst) { |
58 SkImage::Info info; | 58 SkImageInfo info; |
59 if (!proc(data->data(), data->size(), &info, NULL)) { | 59 if (!proc(data->data(), data->size(), &info, NULL)) { |
60 return false; | 60 return false; |
61 } | 61 } |
62 dst->setConfig(SkImageInfoToBitmapConfig(info), info.fWidth, | 62 dst->setConfig(SkImageInfoToBitmapConfig(info), info.fWidth, |
63 info.fHeight, 0, info.fAlphaType); | 63 info.fHeight, 0, info.fAlphaType); |
64 SkAutoTUnref<SkLazyPixelRef> ref(SkNEW_ARGS(SkLazyPixelRef, | 64 SkAutoTUnref<SkLazyPixelRef> ref(SkNEW_ARGS(SkLazyPixelRef, |
65 (data, proc, NULL))); | 65 (data, proc, NULL))); |
66 dst->setPixelRef(ref); | 66 dst->setPixelRef(ref); |
67 return true; | 67 return true; |
68 } | 68 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // // verify that *different* pixels are used this time. | 194 // // verify that *different* pixels are used this time. |
195 // REPORTER_ASSERT(reporter, lazy.getPixels() != lazyPixels); | 195 // REPORTER_ASSERT(reporter, lazy.getPixels() != lazyPixels); |
196 // compare_bitmaps(reporter, original, lazy, comparePixels); | 196 // compare_bitmaps(reporter, original, lazy, comparePixels); |
197 // } | 197 // } |
198 // } | 198 // } |
199 | 199 |
200 // restore cache size | 200 // restore cache size |
201 SkScaledImageCache::SetByteLimit(oldByteLimit); | 201 SkScaledImageCache::SetByteLimit(oldByteLimit); |
202 } | 202 } |
203 } | 203 } |
OLD | NEW |