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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 /** | 476 /** |
477 * Some subclasses will override this function, but this is a useful default
for the color | 477 * Some subclasses will override this function, but this is a useful default
for the color |
478 * types that we support. Note that for color types that do not use the ful
l 32-bits, | 478 * types that we support. Note that for color types that do not use the ful
l 32-bits, |
479 * we will simply take the low bits of the fill value. | 479 * we will simply take the low bits of the fill value. |
480 * | 480 * |
481 * kN32_SkColorType: Transparent or Black | 481 * kN32_SkColorType: Transparent or Black |
482 * kRGB_565_SkColorType: Black | 482 * kRGB_565_SkColorType: Black |
483 * kGray_8_SkColorType: Black | 483 * kGray_8_SkColorType: Black |
484 * kIndex_8_SkColorType: First color in color table | 484 * kIndex_8_SkColorType: First color in color table |
485 */ | 485 */ |
486 virtual uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType
) const { | 486 virtual uint32_t onGetFillValue(SkColorType /*colorType*/, SkAlphaType alpha
Type) const { |
487 return kOpaque_SkAlphaType == alphaType ? SK_ColorBLACK : SK_ColorTRANSP
ARENT; | 487 return kOpaque_SkAlphaType == alphaType ? SK_ColorBLACK : SK_ColorTRANSP
ARENT; |
488 } | 488 } |
489 | 489 |
490 /** | 490 /** |
491 * Get method for the input stream | 491 * Get method for the input stream |
492 */ | 492 */ |
493 SkStream* stream() { | 493 SkStream* stream() { |
494 return fStream.get(); | 494 return fStream.get(); |
495 } | 495 } |
496 | 496 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 * Either way, the same information will be passed to onGetPixels/onStart | 530 * Either way, the same information will be passed to onGetPixels/onStart |
531 * on success. | 531 * on success. |
532 * | 532 * |
533 * This must return true for a size returned from getScaledDimensions. | 533 * This must return true for a size returned from getScaledDimensions. |
534 */ | 534 */ |
535 bool dimensionsSupported(const SkISize& dim) { | 535 bool dimensionsSupported(const SkISize& dim) { |
536 return dim == fSrcInfo.dimensions() || this->onDimensionsSupported(dim); | 536 return dim == fSrcInfo.dimensions() || this->onDimensionsSupported(dim); |
537 } | 537 } |
538 | 538 |
539 // Methods for scanline decoding. | 539 // Methods for scanline decoding. |
540 virtual SkCodec::Result onStartScanlineDecode(const SkImageInfo& dstInfo, | 540 virtual SkCodec::Result onStartScanlineDecode(const SkImageInfo& /*dstInfo*/
, |
541 const SkCodec::Options& options, SkPMColor ctable[], int* ctableCoun
t) { | 541 const SkCodec::Options& /*options*/, SkPMColor* /*ctable*/, int* /*c
tableCount*/) { |
542 return kUnimplemented; | 542 return kUnimplemented; |
543 } | 543 } |
544 | 544 |
545 // Naive default version just calls onGetScanlines on temp memory. | 545 // Naive default version just calls onGetScanlines on temp memory. |
546 virtual bool onSkipScanlines(int countLines) { | 546 virtual bool onSkipScanlines(int countLines) { |
547 // FIXME (msarett): Make this a pure virtual and always override this. | 547 // FIXME (msarett): Make this a pure virtual and always override this. |
548 SkAutoMalloc storage(fDstInfo.minRowBytes()); | 548 SkAutoMalloc storage(fDstInfo.minRowBytes()); |
549 | 549 |
550 // Note that we pass 0 to rowBytes so we continue to use the same memory
. | 550 // Note that we pass 0 to rowBytes so we continue to use the same memory
. |
551 // Also note that while getScanlines checks that rowBytes is big enough, | 551 // Also note that while getScanlines checks that rowBytes is big enough, |
552 // onGetScanlines bypasses that check. | 552 // onGetScanlines bypasses that check. |
553 // Calling the virtual method also means we do not double count | 553 // Calling the virtual method also means we do not double count |
554 // countLines. | 554 // countLines. |
555 return countLines == this->onGetScanlines(storage.get(), countLines, 0); | 555 return countLines == this->onGetScanlines(storage.get(), countLines, 0); |
556 } | 556 } |
557 | 557 |
558 virtual int onGetScanlines(void* dst, int countLines, size_t rowBytes) { ret
urn 0; } | 558 virtual int onGetScanlines(void* /*dst*/, int /*countLines*/, size_t /*rowBy
tes*/) { return 0; } |
559 | 559 |
560 /** | 560 /** |
561 * On an incomplete decode, getPixels() and getScanlines() will call this fu
nction | 561 * On an incomplete decode, getPixels() and getScanlines() will call this fu
nction |
562 * to fill any uinitialized memory. | 562 * to fill any uinitialized memory. |
563 * | 563 * |
564 * @param dstInfo Contains the destination color type | 564 * @param dstInfo Contains the destination color type |
565 * Contains the destination alpha type | 565 * Contains the destination alpha type |
566 * Contains the destination width | 566 * Contains the destination width |
567 * The height stored in this info is unused | 567 * The height stored in this info is unused |
568 * @param dst Pointer to the start of destination pixel memory | 568 * @param dst Pointer to the start of destination pixel memory |
569 * @param rowBytes Stride length in destination pixel memory | 569 * @param rowBytes Stride length in destination pixel memory |
570 * @param zeroInit Indicates if memory is zero initialized | 570 * @param zeroInit Indicates if memory is zero initialized |
571 * @param linesRequested Number of lines that the client requested | 571 * @param linesRequested Number of lines that the client requested |
572 * @param linesDecoded Number of lines that were successfully decoded | 572 * @param linesDecoded Number of lines that were successfully decoded |
573 */ | 573 */ |
574 void fillIncompleteImage(const SkImageInfo& dstInfo, void* dst, size_t rowBy
tes, | 574 void fillIncompleteImage(const SkImageInfo& dstInfo, void* dst, size_t rowBy
tes, |
575 ZeroInitialized zeroInit, int linesRequested, int linesDecoded); | 575 ZeroInitialized zeroInit, int linesRequested, int linesDecoded); |
576 | 576 |
577 /** | 577 /** |
578 * Return an object which will allow forcing scanline decodes to sample in
X. | 578 * Return an object which will allow forcing scanline decodes to sample in
X. |
579 * | 579 * |
580 * 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 |
581 * not affect ownership. | 581 * not affect ownership. |
582 * | 582 * |
583 * Only valid during scanline decoding. | 583 * Only valid during scanline decoding. |
584 */ | 584 */ |
585 virtual SkSampler* getSampler(bool createIfNecessary) { return nullptr; } | 585 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} |
586 | 586 |
587 friend class SkSampledCodec; | 587 friend class SkSampledCodec; |
588 }; | 588 }; |
589 #endif // SkCodec_DEFINED | 589 #endif // SkCodec_DEFINED |
OLD | NEW |