 Chromium Code Reviews
 Chromium Code Reviews Issue 1390213002:
  Add subsetting to SkScanlineDecoder  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@fill-refactor
    
  
    Issue 1390213002:
  Add subsetting to SkScanlineDecoder  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@fill-refactor| 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 SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED | 
| 9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED | 
| 10 | 10 | 
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 * | 171 * | 
| 172 * Must be within the bounds returned by getInfo(). | 172 * Must be within the bounds returned by getInfo(). | 
| 173 * | 173 * | 
| 174 * If the EncodedFormat is kWEBP_SkEncodedFormat (the only one which | 174 * If the EncodedFormat is kWEBP_SkEncodedFormat (the only one which | 
| 175 * currently supports subsets), the top and left values must be even. | 175 * currently supports subsets), the top and left values must be even. | 
| 176 * | |
| 177 * The above description applies to getPixels() but the usage is | |
| 
scroggo
2015/10/12 16:11:20
I think it would be better to say something like:
 
msarett
2015/10/12 17:13:55
Done.
 | |
| 178 * slightly different when we want to startScanlineDecode(). It | |
| 179 * does not make a lot of sense to specify a fSubsetTop or | |
| 180 * fSubsetHeight when scanline decoding, since the client already | |
| 181 * controls which rows to get and which rows to skip. During scanline | |
| 182 * decodes, we will require that fSubsetTop be zero and fSubsetHeight | |
| 183 * be the full height. We will, however, use the values of | |
| 184 * fSubsetLeft and fSubsetWidth to decode partial scanlines on calls | |
| 185 * to getScanlines(). | |
| 176 */ | 186 */ | 
| 177 SkIRect* fSubset; | 187 SkIRect* fSubset; | 
| 178 }; | 188 }; | 
| 179 | 189 | 
| 180 /** | 190 /** | 
| 181 * Decode into the given pixels, a block of memory of size at | 191 * Decode into the given pixels, a block of memory of size at | 
| 182 * least (info.fHeight - 1) * rowBytes + (info.fWidth * | 192 * least (info.fHeight - 1) * rowBytes + (info.fWidth * | 
| 183 * bytesPerPixel) | 193 * bytesPerPixel) | 
| 184 * | 194 * | 
| 185 * Repeated calls to this function should give the same results, | 195 * Repeated calls to this function should give the same results, | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 * @param ctable A pointer to a color table. When dstInfo.colorType() is | 262 * @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 | 263 * 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. | 264 * 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 | 265 * @param ctableCount A pointer to the size of the color table. When | 
| 256 * dstInfo.colorType() is kIndex8, this should be non-NULL. It will | 266 * dstInfo.colorType() is kIndex8, this should be non-NULL. It will | 
| 257 * be modified to the true size of the color table (<= 256) after | 267 * be modified to the true size of the color table (<= 256) after | 
| 258 * decoding the palette. | 268 * decoding the palette. | 
| 259 * @return Enum representing success or reason for failure. | 269 * @return Enum representing success or reason for failure. | 
| 260 */ | 270 */ | 
| 261 Result startScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Option s* options, | 271 Result startScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Option s* options, | 
| 262 SkPMColor ctable[], int* ctableCount); | 272 SkPMColor ctable[], int* ctableCount); | 
| 263 | 273 | 
| 264 /** | 274 /** | 
| 265 * Simplified version of startScanlineDecode() that asserts that info is NO T | 275 * Simplified version of startScanlineDecode() that asserts that info is NO T | 
| 266 * kIndex8_SkColorType and uses the default Options. | 276 * kIndex8_SkColorType and uses the default options. | 
| 
scroggo
2015/10/12 16:11:20
Why this change?
 
msarett
2015/10/12 17:13:55
I changed this comment when I changed the API, and
 | |
| 267 */ | 277 */ | 
| 268 Result startScanlineDecode(const SkImageInfo& dstInfo); | 278 Result startScanlineDecode(const SkImageInfo& dstInfo); | 
| 269 | 279 | 
| 270 /** | 280 /** | 
| 271 * Write the next countLines scanlines into dst. | 281 * Write the next countLines scanlines into dst. | 
| 272 * | 282 * | 
| 273 * Not valid to call before calling startScanlineDecode(). | 283 * Not valid to call before calling startScanlineDecode(). | 
| 274 * | 284 * | 
| 275 * @param dst Must be non-null, and large enough to hold countLines | 285 * @param dst Must be non-null, and large enough to hold countLines | 
| 276 * scanlines of size rowBytes. | 286 * scanlines of size rowBytes. | 
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 * May create a sampler, if one is not currently being used. Otherwise, doe s | 581 * May create a sampler, if one is not currently being used. Otherwise, doe s | 
| 572 * not affect ownership. | 582 * not affect ownership. | 
| 573 * | 583 * | 
| 574 * Only valid during scanline decoding. | 584 * Only valid during scanline decoding. | 
| 575 */ | 585 */ | 
| 576 virtual SkSampler* getSampler(bool createIfNecessary) { return nullptr; } | 586 virtual SkSampler* getSampler(bool createIfNecessary) { return nullptr; } | 
| 577 | 587 | 
| 578 friend class SkScaledCodec; | 588 friend class SkScaledCodec; | 
| 579 }; | 589 }; | 
| 580 #endif // SkCodec_DEFINED | 590 #endif // SkCodec_DEFINED | 
| OLD | NEW |