| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 return new SkSwizzler(proc, ctable, srcOffset, srcWidth, bpp); | 693 return new SkSwizzler(proc, ctable, srcOffset, srcWidth, bpp); |
| 694 } | 694 } |
| 695 | 695 |
| 696 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int
srcWidth, int bpp) | 696 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int
srcWidth, int bpp) |
| 697 : fRowProc(proc) | 697 : fRowProc(proc) |
| 698 , fColorTable(ctable) | 698 , fColorTable(ctable) |
| 699 , fSrcOffset(srcOffset) | 699 , fSrcOffset(srcOffset) |
| 700 , fX0(srcOffset) | 700 , fX0(srcOffset) |
| 701 , fSrcWidth(srcWidth) | 701 , fSrcWidth(srcWidth) |
| 702 , fDstWidth(srcWidth) | 702 , fDstWidth(srcWidth) |
| 703 , fSampleX(1) |
| 703 , fBPP(bpp) | 704 , fBPP(bpp) |
| 704 , fSampleX(1) | |
| 705 {} | 705 {} |
| 706 | 706 |
| 707 int SkSwizzler::onSetSampleX(int sampleX) { | 707 int SkSwizzler::onSetSampleX(int sampleX) { |
| 708 SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be | 708 SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be |
| 709 // way to report failure? | 709 // way to report failure? |
| 710 fSampleX = sampleX; | 710 fSampleX = sampleX; |
| 711 fX0 = get_start_coord(sampleX) + fSrcOffset; | 711 fX0 = get_start_coord(sampleX) + fSrcOffset; |
| 712 fDstWidth = get_scaled_dimension(fSrcWidth, sampleX); | 712 fDstWidth = get_scaled_dimension(fSrcWidth, sampleX); |
| 713 | 713 |
| 714 // check that fX0 is less than original width | 714 // check that fX0 is less than original width |
| 715 SkASSERT(fX0 >= 0 && fX0 < fSrcWidth); | 715 SkASSERT(fX0 >= 0 && fX0 < fSrcWidth); |
| 716 return fDstWidth; | 716 return fDstWidth; |
| 717 } | 717 } |
| 718 | 718 |
| 719 SkSwizzler::ResultAlpha SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRIC
T src) { | 719 SkSwizzler::ResultAlpha SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRIC
T src) { |
| 720 SkASSERT(nullptr != dst && nullptr != src); | 720 SkASSERT(nullptr != dst && nullptr != src); |
| 721 return fRowProc(dst, src, fDstWidth, fBPP, fSampleX * fBPP, fX0 * fBPP, fCol
orTable); | 721 return fRowProc(dst, src, fDstWidth, fBPP, fSampleX * fBPP, fX0 * fBPP, fCol
orTable); |
| 722 } | 722 } |
| OLD | NEW |