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 #include "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkScaledCodec.h" | 10 #include "SkScaledCodec.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 if (NULL == proc) { | 682 if (NULL == proc) { |
683 return NULL; | 683 return NULL; |
684 } | 684 } |
685 | 685 |
686 // Store deltaSrc in bytes if it is an even multiple, otherwise use bits | 686 // Store deltaSrc in bytes if it is an even multiple, otherwise use bits |
687 int deltaSrc = SkIsAlign8(BitsPerPixel(sc)) ? BytesPerPixel(sc) : BitsPerPix
el(sc); | 687 int deltaSrc = SkIsAlign8(BitsPerPixel(sc)) ? BytesPerPixel(sc) : BitsPerPix
el(sc); |
688 | 688 |
689 // get sampleX based on srcInfo and dstInfo dimensions | 689 // get sampleX based on srcInfo and dstInfo dimensions |
690 int sampleX; | 690 int sampleX; |
691 SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, NULL); | 691 SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, NULL); |
692 | 692 |
693 return SkNEW_ARGS(SkSwizzler, (proc, ctable, deltaSrc, dstInfo, sampleX)); | 693 return new SkSwizzler(proc, ctable, deltaSrc, dstInfo, sampleX); |
694 } | 694 } |
695 | 695 |
696 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, | 696 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, |
697 int deltaSrc, const SkImageInfo& info, int sampleX) | 697 int deltaSrc, const SkImageInfo& info, int sampleX) |
698 : fRowProc(proc) | 698 : fRowProc(proc) |
699 , fColorTable(ctable) | 699 , fColorTable(ctable) |
700 , fDeltaSrc(deltaSrc) | 700 , fDeltaSrc(deltaSrc) |
701 , fDstInfo(info) | 701 , fDstInfo(info) |
702 , fSampleX(sampleX) | 702 , fSampleX(sampleX) |
703 , fX0(sampleX == 1 ? 0 : sampleX >> 1) | 703 , fX0(sampleX == 1 ? 0 : sampleX >> 1) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 // bits of SK_ColorBLACK are identical to the 565 representation | 770 // bits of SK_ColorBLACK are identical to the 565 representation |
771 // for black. | 771 // for black. |
772 memset(dstStartRow, (uint16_t) colorOrIndex, bytesToFill); | 772 memset(dstStartRow, (uint16_t) colorOrIndex, bytesToFill); |
773 break; | 773 break; |
774 default: | 774 default: |
775 SkCodecPrintf("Error: Unsupported dst color type for fill(). Doing
nothing.\n"); | 775 SkCodecPrintf("Error: Unsupported dst color type for fill(). Doing
nothing.\n"); |
776 SkASSERT(false); | 776 SkASSERT(false); |
777 break; | 777 break; |
778 } | 778 } |
779 } | 779 } |
OLD | NEW |