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 #ifndef SkScaledCodec_DEFINED | 7 #ifndef SkScaledCodec_DEFINED |
8 #define SkScaledCodec_DEFINED | 8 #define SkScaledCodec_DEFINED |
9 | 9 |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 if(dstInfo.width() > srcInfo.width()) { | 35 if(dstInfo.width() > srcInfo.width()) { |
36 return false; | 36 return false; |
37 } | 37 } |
38 return true; | 38 return true; |
39 } | 39 } |
40 | 40 |
41 static void ComputeSampleSize(const SkImageInfo& dstInfo, const SkImageInfo&
srcInfo, | 41 static void ComputeSampleSize(const SkImageInfo& dstInfo, const SkImageInfo&
srcInfo, |
42 int* sampleSizeX, int* sampleSizeY); | 42 int* sampleSizeX, int* sampleSizeY); |
43 | 43 |
44 protected: | 44 protected: |
| 45 bool onRewind() override; |
| 46 |
45 /** | 47 /** |
46 * Recommend a set of destination dimensions given a requested scale | 48 * Recommend a set of destination dimensions given a requested scale |
47 */ | 49 */ |
48 SkISize onGetScaledDimensions(float desiredScale) const override; | 50 SkISize onGetScaledDimensions(float desiredScale) const override; |
49 | 51 |
50 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*) | 52 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*) |
51 override; | 53 override; |
52 SkEncodedFormat onGetEncodedFormat() const override { | 54 SkEncodedFormat onGetEncodedFormat() const override { |
53 return fCodec->getEncodedFormat(); | 55 return fCodec->getEncodedFormat(); |
54 } | 56 } |
55 | 57 |
56 bool onReallyHasAlpha() const override { | 58 bool onReallyHasAlpha() const override { |
57 return fCodec->reallyHasAlpha(); | 59 return fCodec->reallyHasAlpha(); |
58 } | 60 } |
59 | 61 |
60 private: | 62 private: |
61 | 63 |
62 SkAutoTDelete<SkCodec> fCodec; | 64 SkAutoTDelete<SkCodec> fCodec; |
63 | 65 |
64 explicit SkScaledCodec(SkCodec*); | 66 explicit SkScaledCodec(SkCodec*); |
65 | 67 |
66 typedef SkCodec INHERITED; | 68 typedef SkCodec INHERITED; |
67 }; | 69 }; |
68 #endif // SkScaledCodec_DEFINED | 70 #endif // SkScaledCodec_DEFINED |
OLD | NEW |