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 SkBitmapRegionDecoder_DEFINED | 8 #ifndef SkBitmapRegionDecoder_DEFINED |
9 #define SkBitmapRegionDecoder_DEFINED | 9 #define SkBitmapRegionDecoder_DEFINED |
10 | 10 |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkBRDAllocator.h" |
12 #include "SkEncodedFormat.h" | 13 #include "SkEncodedFormat.h" |
13 #include "SkStream.h" | 14 #include "SkStream.h" |
14 | 15 |
15 /* | 16 /* |
16 * This class aims to provide an interface to test multiple implementations of | 17 * This class aims to provide an interface to test multiple implementations of |
17 * SkBitmapRegionDecoder. | 18 * SkBitmapRegionDecoder. |
18 */ | 19 */ |
19 class SkBitmapRegionDecoder { | 20 class SkBitmapRegionDecoder { |
20 public: | 21 public: |
21 | 22 |
(...skipping 29 matching lines...) Expand all Loading... |
51 * @param sampleSize An integer downscaling factor for the decode. | 52 * @param sampleSize An integer downscaling factor for the decode. |
52 * @param colorType Preferred output colorType. | 53 * @param colorType Preferred output colorType. |
53 * New implementations should return NULL if they do
not support | 54 * New implementations should return NULL if they do
not support |
54 * decoding to this color type. | 55 * decoding to this color type. |
55 * The old kOriginal_Strategy will decode to a defaul
t color type | 56 * The old kOriginal_Strategy will decode to a defaul
t color type |
56 * if this color type is unsupported. | 57 * if this color type is unsupported. |
57 * @param requireUnpremul If the image is not opaque, we will use this to de
termine the | 58 * @param requireUnpremul If the image is not opaque, we will use this to de
termine the |
58 * alpha type to use. | 59 * alpha type to use. |
59 * | 60 * |
60 */ | 61 */ |
61 virtual bool decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator, | 62 virtual bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator, |
62 const SkIRect& desiredSubset, int sampleSize, | 63 const SkIRect& desiredSubset, int sampleSize, |
63 SkColorType colorType, bool requireUnpremul) = 0; | 64 SkColorType colorType, bool requireUnpremul) = 0; |
64 /* | 65 /* |
65 * @param Requested destination color type | 66 * @param Requested destination color type |
66 * @return true if we support the requested color type and false otherwise | 67 * @return true if we support the requested color type and false otherwise |
67 */ | 68 */ |
68 virtual bool conversionSupported(SkColorType colorType) = 0; | 69 virtual bool conversionSupported(SkColorType colorType) = 0; |
69 | 70 |
70 virtual SkEncodedFormat getEncodedFormat() = 0; | 71 virtual SkEncodedFormat getEncodedFormat() = 0; |
71 | 72 |
72 int width() const { return fWidth; } | 73 int width() const { return fWidth; } |
73 int height() const { return fHeight; } | 74 int height() const { return fHeight; } |
74 | 75 |
75 virtual ~SkBitmapRegionDecoder() {} | 76 virtual ~SkBitmapRegionDecoder() {} |
76 | 77 |
77 protected: | 78 protected: |
78 | 79 |
79 SkBitmapRegionDecoder(int width, int height) | 80 SkBitmapRegionDecoder(int width, int height) |
80 : fWidth(width) | 81 : fWidth(width) |
81 , fHeight(height) | 82 , fHeight(height) |
82 {} | 83 {} |
83 | 84 |
84 private: | 85 private: |
85 const int fWidth; | 86 const int fWidth; |
86 const int fHeight; | 87 const int fHeight; |
87 }; | 88 }; |
88 | 89 |
89 #endif | 90 #endif |
OLD | NEW |