OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkImagePriv.h" | 10 #include "SkImagePriv.h" |
11 #include "SkImage_Base.h" | 11 #include "SkImage_Base.h" |
12 | 12 |
13 SK_DEFINE_INST_COUNT(SkImage) | |
14 | |
15 static SkImage_Base* as_IB(SkImage* image) { | 13 static SkImage_Base* as_IB(SkImage* image) { |
16 return static_cast<SkImage_Base*>(image); | 14 return static_cast<SkImage_Base*>(image); |
17 } | 15 } |
18 | 16 |
19 static const SkImage_Base* as_IB(const SkImage* image) { | 17 static const SkImage_Base* as_IB(const SkImage* image) { |
20 return static_cast<const SkImage_Base*>(image); | 18 return static_cast<const SkImage_Base*>(image); |
21 } | 19 } |
22 | 20 |
23 uint32_t SkImage::NextUniqueID() { | 21 uint32_t SkImage::NextUniqueID() { |
24 static int32_t gUniqueID; | 22 static int32_t gUniqueID; |
(...skipping 20 matching lines...) Expand all Loading... |
45 return as_IB(this)->onGetTexture(); | 43 return as_IB(this)->onGetTexture(); |
46 } | 44 } |
47 | 45 |
48 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { | 46 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { |
49 SkBitmap bm; | 47 SkBitmap bm; |
50 if (as_IB(this)->getROPixels(&bm)) { | 48 if (as_IB(this)->getROPixels(&bm)) { |
51 return SkImageEncoder::EncodeData(bm, type, quality); | 49 return SkImageEncoder::EncodeData(bm, type, quality); |
52 } | 50 } |
53 return NULL; | 51 return NULL; |
54 } | 52 } |
OLD | NEW |