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

Side by Side Diff: include/codec/SkCodec.h

Issue 1390213002: Add subsetting to SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@fill-refactor
Patch Set: Response to comments 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
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/codec/SkBmpCodec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #ifndef SkCodec_DEFINED 8 #ifndef SkCodec_DEFINED
9 #define SkCodec_DEFINED 9 #define SkCodec_DEFINED
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 */ 161 */
162 struct Options { 162 struct Options {
163 Options() 163 Options()
164 : fZeroInitialized(kNo_ZeroInitialized) 164 : fZeroInitialized(kNo_ZeroInitialized)
165 , fSubset(NULL) 165 , fSubset(NULL)
166 {} 166 {}
167 167
168 ZeroInitialized fZeroInitialized; 168 ZeroInitialized fZeroInitialized;
169 /** 169 /**
170 * If not NULL, represents a subset of the original image to decode. 170 * If not NULL, represents a subset of the original image to decode.
171 *
172 * Must be within the bounds returned by getInfo(). 171 * Must be within the bounds returned by getInfo().
173 *
174 * If the EncodedFormat is kWEBP_SkEncodedFormat (the only one which 172 * If the EncodedFormat is kWEBP_SkEncodedFormat (the only one which
175 * currently supports subsets), the top and left values must be even. 173 * currently supports subsets), the top and left values must be even.
174 *
175 * In getPixels, we will attempt to decode the exact rectangular
176 * subset specified by fSubset.
177 *
178 * In a scanline decode, it does not make sense to specify a subset
179 * top or subset height, since the client already controls which rows
180 * to get and which rows to skip. During scanline decodes, we will
181 * require that the subset top be zero and the subset height be equal
182 * to the full height. We will, however, use the values of
183 * subset left and subset width to decode partial scanlines on calls
184 * to getScanlines().
176 */ 185 */
177 SkIRect* fSubset; 186 SkIRect* fSubset;
178 }; 187 };
179 188
180 /** 189 /**
181 * Decode into the given pixels, a block of memory of size at 190 * Decode into the given pixels, a block of memory of size at
182 * least (info.fHeight - 1) * rowBytes + (info.fWidth * 191 * least (info.fHeight - 1) * rowBytes + (info.fWidth *
183 * bytesPerPixel) 192 * bytesPerPixel)
184 * 193 *
185 * Repeated calls to this function should give the same results, 194 * Repeated calls to this function should give the same results,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 * @param ctable A pointer to a color table. When dstInfo.colorType() is 261 * @param ctable A pointer to a color table. When dstInfo.colorType() is
253 * kIndex8, this should be non-NULL and have enough storage for 256 262 * kIndex8, this should be non-NULL and have enough storage for 256
254 * colors. The color table will be populated after decoding the palett e. 263 * colors. The color table will be populated after decoding the palett e.
255 * @param ctableCount A pointer to the size of the color table. When 264 * @param ctableCount A pointer to the size of the color table. When
256 * dstInfo.colorType() is kIndex8, this should be non-NULL. It will 265 * dstInfo.colorType() is kIndex8, this should be non-NULL. It will
257 * be modified to the true size of the color table (<= 256) after 266 * be modified to the true size of the color table (<= 256) after
258 * decoding the palette. 267 * decoding the palette.
259 * @return Enum representing success or reason for failure. 268 * @return Enum representing success or reason for failure.
260 */ 269 */
261 Result startScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Option s* options, 270 Result startScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Option s* options,
262 SkPMColor ctable[], int* ctableCount); 271 SkPMColor ctable[], int* ctableCount);
263 272
264 /** 273 /**
265 * Simplified version of startScanlineDecode() that asserts that info is NO T 274 * Simplified version of startScanlineDecode() that asserts that info is NO T
266 * kIndex8_SkColorType and uses the default Options. 275 * kIndex8_SkColorType and uses the default Options.
267 */ 276 */
268 Result startScanlineDecode(const SkImageInfo& dstInfo); 277 Result startScanlineDecode(const SkImageInfo& dstInfo);
269 278
270 /** 279 /**
271 * Write the next countLines scanlines into dst. 280 * Write the next countLines scanlines into dst.
272 * 281 *
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 * May create a sampler, if one is not currently being used. Otherwise, doe s 580 * May create a sampler, if one is not currently being used. Otherwise, doe s
572 * not affect ownership. 581 * not affect ownership.
573 * 582 *
574 * Only valid during scanline decoding. 583 * Only valid during scanline decoding.
575 */ 584 */
576 virtual SkSampler* getSampler(bool createIfNecessary) { return nullptr; } 585 virtual SkSampler* getSampler(bool createIfNecessary) { return nullptr; }
577 586
578 friend class SkScaledCodec; 587 friend class SkScaledCodec;
579 }; 588 };
580 #endif // SkCodec_DEFINED 589 #endif // SkCodec_DEFINED
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/codec/SkBmpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698