Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/codec/SkBmpCodec.h

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase on merged SkCodec and SkScanlineDecoder Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 * 75 *
76 * @param y Iterates from 0 to height, indicating the current row. 76 * @param y Iterates from 0 to height, indicating the current row.
77 * @param height The height of the current subset of the image that we are 77 * @param height The height of the current subset of the image that we are
78 * decoding. This is generally equal to the full height 78 * decoding. This is generally equal to the full height
79 * when we want to decode the full or one when we are 79 * when we want to decode the full or one when we are
80 * sampling. 80 * sampling.
81 */ 81 */
82 int32_t getDstRow(int32_t y, int32_t height) const; 82 int32_t getDstRow(int32_t y, int32_t height) const;
83 83
84 /* 84 /*
85 * Get the destination row to start filling from
86 * Used to fill the remainder of the image on incomplete input for bmps
87 * This is tricky since bmps may be kTopDown or kBottomUp. For kTopDown,
88 * we start filling from where we left off, but for kBottomUp we start
89 * filling at the top of the image.
90 */
91 void* getDstStartRow(void* dst, size_t dstRowBytes, int32_t y) const;
92
93 /*
94 * Compute the number of colors in the color table 85 * Compute the number of colors in the color table
95 */ 86 */
96 uint32_t computeNumColors(uint32_t numColors); 87 uint32_t computeNumColors(uint32_t numColors);
97 88
98 /* 89 /*
99 * Accessors used by subclasses 90 * Accessors used by subclasses
100 */ 91 */
101 uint16_t bitsPerPixel() const { return fBitsPerPixel; } 92 uint16_t bitsPerPixel() const { return fBitsPerPixel; }
102 SkScanlineOrder onGetScanlineOrder() const override { return fRowOrder; } 93 SkScanlineOrder onGetScanlineOrder() const override { return fRowOrder; }
103 94
(...skipping 30 matching lines...) Expand all
134 * onGetPixels() uses this for full image decodes. 125 * onGetPixels() uses this for full image decodes.
135 * SkScaledCodec::onGetPixels() uses the scanline decoder to call this with 126 * SkScaledCodec::onGetPixels() uses the scanline decoder to call this with
136 * dstInfo.height() = 1, in order to implement sampling. 127 * dstInfo.height() = 1, in order to implement sampling.
137 * A potential future use is to allow the caller to decode a subset of the 128 * A potential future use is to allow the caller to decode a subset of the
138 * lines in the image. 129 * lines in the image.
139 * 130 *
140 * @param dstInfo Contains output information. Height specifies the 131 * @param dstInfo Contains output information. Height specifies the
141 * number of rows to decode at this time. 132 * number of rows to decode at this time.
142 * @param dst Memory location to store output pixels 133 * @param dst Memory location to store output pixels
143 * @param dstRowBytes Bytes in a row of the destination 134 * @param dstRowBytes Bytes in a row of the destination
135 * @return Number of rows successfully decoded
144 */ 136 */
145 virtual Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstR owBytes, 137 virtual uint32_t decodeRows(const SkImageInfo& dstInfo, void* dst, size_t ds tRowBytes,
146 const Options& opts) = 0; 138 const Options& opts) = 0;
147 139
148 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Opti ons&, 140 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Opti ons&,
149 SkPMColor inputColorPtr[], int* inputColorCount) override; 141 SkPMColor inputColorPtr[], int* inputColorCount) override;
150 142
151 Result onGetScanlines(void* dst, int count, size_t rowBytes) override; 143 uint32_t onGetScanlines(void* dst, int count, size_t rowBytes) override;
152
153 int onNextScanline() const override;
154 144
155 // TODO(msarett): Override default skipping with something more clever. 145 // TODO(msarett): Override default skipping with something more clever.
156 146
157 const uint16_t fBitsPerPixel; 147 const uint16_t fBitsPerPixel;
158 const SkScanlineOrder fRowOrder; 148 const SkScanlineOrder fRowOrder;
159 149
160 typedef SkCodec INHERITED; 150 typedef SkCodec INHERITED;
161 }; 151 };
162 152
163 #endif 153 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698