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 SkBmpCodec_DEFINED | 7 #ifndef SkBmpCodec_DEFINED |
8 #define SkBmpCodec_DEFINED | 8 #define SkBmpCodec_DEFINED |
9 | 9 |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 * | 74 * |
75 * @param y Iterates from 0 to height, indicating the current row. | 75 * @param y Iterates from 0 to height, indicating the current row. |
76 * @param height The height of the current subset of the image that we are | 76 * @param height The height of the current subset of the image that we are |
77 * decoding. This is generally equal to the full height | 77 * decoding. This is generally equal to the full height |
78 * when we want to decode the full or one when we are | 78 * when we want to decode the full or one when we are |
79 * sampling. | 79 * sampling. |
80 */ | 80 */ |
81 int32_t getDstRow(int32_t y, int32_t height) const; | 81 int32_t getDstRow(int32_t y, int32_t height) const; |
82 | 82 |
83 /* | 83 /* |
84 * Get the destination row to start filling from | |
85 * Used to fill the remainder of the image on incomplete input for bmps | |
86 * This is tricky since bmps may be kTopDown or kBottomUp. For kTopDown, | |
87 * we start filling from where we left off, but for kBottomUp we start | |
88 * filling at the top of the image. | |
89 */ | |
90 void* getDstStartRow(void* dst, size_t dstRowBytes, int32_t y) const; | |
91 | |
92 /* | |
93 * Compute the number of colors in the color table | 84 * Compute the number of colors in the color table |
94 */ | 85 */ |
95 uint32_t computeNumColors(uint32_t numColors); | 86 uint32_t computeNumColors(uint32_t numColors); |
96 | 87 |
97 /* | 88 /* |
98 * Accessors used by subclasses | 89 * Accessors used by subclasses |
99 */ | 90 */ |
100 uint16_t bitsPerPixel() const { return fBitsPerPixel; } | 91 uint16_t bitsPerPixel() const { return fBitsPerPixel; } |
101 SkScanlineOrder onGetScanlineOrder() const override { return fRowOrder; } | 92 SkScanlineOrder onGetScanlineOrder() const override { return fRowOrder; } |
102 | 93 |
(...skipping 30 matching lines...) Expand all Loading... |
133 * onGetPixels() uses this for full image decodes. | 124 * onGetPixels() uses this for full image decodes. |
134 * SkScaledCodec::onGetPixels() uses the scanline decoder to call this with | 125 * SkScaledCodec::onGetPixels() uses the scanline decoder to call this with |
135 * dstInfo.height() = 1, in order to implement sampling. | 126 * dstInfo.height() = 1, in order to implement sampling. |
136 * A potential future use is to allow the caller to decode a subset of the | 127 * A potential future use is to allow the caller to decode a subset of the |
137 * lines in the image. | 128 * lines in the image. |
138 * | 129 * |
139 * @param dstInfo Contains output information. Height specifies the | 130 * @param dstInfo Contains output information. Height specifies the |
140 * number of rows to decode at this time. | 131 * number of rows to decode at this time. |
141 * @param dst Memory location to store output pixels | 132 * @param dst Memory location to store output pixels |
142 * @param dstRowBytes Bytes in a row of the destination | 133 * @param dstRowBytes Bytes in a row of the destination |
| 134 * @return Number of rows successfully decoded |
143 */ | 135 */ |
144 virtual Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstR
owBytes, | 136 virtual int decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowB
ytes, |
145 const Options& opts) = 0; | 137 const Options& opts) = 0; |
146 | 138 |
147 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Opti
ons&, | 139 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Opti
ons&, |
148 SkPMColor inputColorPtr[], int* inputColorCount) override; | 140 SkPMColor inputColorPtr[], int* inputColorCount) override; |
149 | 141 |
150 Result onGetScanlines(void* dst, int count, size_t rowBytes) override; | 142 int onGetScanlines(void* dst, int count, size_t rowBytes) override; |
151 | |
152 int onNextScanline() const override; | |
153 | 143 |
154 // TODO(msarett): Override default skipping with something more clever. | 144 // TODO(msarett): Override default skipping with something more clever. |
155 | 145 |
156 const uint16_t fBitsPerPixel; | 146 const uint16_t fBitsPerPixel; |
157 const SkScanlineOrder fRowOrder; | 147 const SkScanlineOrder fRowOrder; |
158 | 148 |
159 typedef SkCodec INHERITED; | 149 typedef SkCodec INHERITED; |
160 }; | 150 }; |
161 | 151 |
162 #endif | 152 #endif |
OLD | NEW |