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 #ifndef SkWebpCodec_DEFINED | 8 #ifndef SkWebpCodec_DEFINED |
9 #define SkWebpCodec_DEFINED | 9 #define SkWebpCodec_DEFINED |
10 | 10 |
11 #include "SkCodec.h" | 11 #include "SkCodec.h" |
| 12 #include "SkColorSpace.h" |
12 #include "SkEncodedFormat.h" | 13 #include "SkEncodedFormat.h" |
13 #include "SkImageInfo.h" | 14 #include "SkImageInfo.h" |
14 #include "SkTypes.h" | 15 #include "SkTypes.h" |
15 | 16 |
16 class SkStream; | 17 class SkStream; |
17 | 18 |
18 static const size_t WEBP_VP8_HEADER_SIZE = 30; | 19 static const size_t WEBP_VP8_HEADER_SIZE = 30; |
19 | 20 |
20 class SkWebpCodec final : public SkCodec { | 21 class SkWebpCodec final : public SkCodec { |
21 public: | 22 public: |
22 // Assumes IsWebp was called and returned true. | 23 // Assumes IsWebp was called and returned true. |
23 static SkCodec* NewFromStream(SkStream*); | 24 static SkCodec* NewFromStream(SkStream*); |
24 static bool IsWebp(const void*, size_t); | 25 static bool IsWebp(const void*, size_t); |
25 protected: | 26 protected: |
26 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) | 27 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) |
27 override; | 28 override; |
28 SkEncodedFormat onGetEncodedFormat() const override { return kWEBP_SkEncoded
Format; } | 29 SkEncodedFormat onGetEncodedFormat() const override { return kWEBP_SkEncoded
Format; } |
29 | 30 |
30 SkISize onGetScaledDimensions(float desiredScale) const override; | 31 SkISize onGetScaledDimensions(float desiredScale) const override; |
31 | 32 |
32 bool onDimensionsSupported(const SkISize&) override; | 33 bool onDimensionsSupported(const SkISize&) override; |
33 | 34 |
34 bool onGetValidSubset(SkIRect* /* desiredSubset */) const override; | 35 bool onGetValidSubset(SkIRect* /* desiredSubset */) const override; |
35 private: | 36 private: |
36 SkWebpCodec(const SkImageInfo&, SkStream*); | 37 SkWebpCodec(const SkImageInfo&, SkStream*); |
37 | 38 |
38 typedef SkCodec INHERITED; | 39 typedef SkCodec INHERITED; |
39 }; | 40 }; |
40 #endif // SkWebpCodec_DEFINED | 41 #endif // SkWebpCodec_DEFINED |
OLD | NEW |