Chromium Code Reviews| 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 "SkOpts.h" | 10 #include "SkOpts.h" |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 , fSrcWidth(srcWidth) | 922 , fSrcWidth(srcWidth) |
| 923 , fDstWidth(dstWidth) | 923 , fDstWidth(dstWidth) |
| 924 , fSwizzleWidth(srcWidth) | 924 , fSwizzleWidth(srcWidth) |
| 925 , fAllocatedWidth(dstWidth) | 925 , fAllocatedWidth(dstWidth) |
| 926 , fSampleX(1) | 926 , fSampleX(1) |
| 927 , fSrcBPP(srcBPP) | 927 , fSrcBPP(srcBPP) |
| 928 , fDstBPP(dstBPP) | 928 , fDstBPP(dstBPP) |
| 929 {} | 929 {} |
| 930 | 930 |
| 931 int SkSwizzler::onSetSampleX(int sampleX) { | 931 int SkSwizzler::onSetSampleX(int sampleX) { |
| 932 SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be | 932 SkASSERT(sampleX > 0); |
|
msarett
2016/02/10 13:42:59
I don't think there is an upper limit. If they as
scroggo
2016/02/10 16:06:09
sgtm
| |
| 933 // way to report failure? | 933 |
| 934 fSampleX = sampleX; | 934 fSampleX = sampleX; |
| 935 fSrcOffsetUnits = (get_start_coord(sampleX) + fSrcOffset) * fSrcBPP; | 935 fSrcOffsetUnits = (get_start_coord(sampleX) + fSrcOffset) * fSrcBPP; |
| 936 fDstOffsetBytes = (fDstOffset / sampleX) * fDstBPP; | 936 fDstOffsetBytes = (fDstOffset / sampleX) * fDstBPP; |
| 937 fSwizzleWidth = get_scaled_dimension(fSrcWidth, sampleX); | 937 fSwizzleWidth = get_scaled_dimension(fSrcWidth, sampleX); |
| 938 fAllocatedWidth = get_scaled_dimension(fDstWidth, sampleX); | 938 fAllocatedWidth = get_scaled_dimension(fDstWidth, sampleX); |
| 939 | 939 |
| 940 // The optimized swizzler routines do not (yet) support sampling. | 940 // The optimized swizzler functions do not support sampling. Sampled swizzl es |
| 941 // are already fast because they skip pixels. We haven't seen a situation | |
| 942 // where speeding up sampling has a significant impact on total decode time. | |
| 941 if (1 == fSampleX && fFastProc) { | 943 if (1 == fSampleX && fFastProc) { |
| 942 fActualProc = fFastProc; | 944 fActualProc = fFastProc; |
| 943 } else { | 945 } else { |
| 944 fActualProc = fSlowProc; | 946 fActualProc = fSlowProc; |
| 945 } | 947 } |
| 946 | 948 |
| 947 return fAllocatedWidth; | 949 return fAllocatedWidth; |
| 948 } | 950 } |
| 949 | 951 |
| 950 void SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) { | 952 void SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) { |
| 951 SkASSERT(nullptr != dst && nullptr != src); | 953 SkASSERT(nullptr != dst && nullptr != src); |
| 952 fActualProc(SkTAddOffset<void>(dst, fDstOffsetBytes), src, fSwizzleWidth, fS rcBPP, | 954 fActualProc(SkTAddOffset<void>(dst, fDstOffsetBytes), src, fSwizzleWidth, fS rcBPP, |
| 953 fSampleX * fSrcBPP, fSrcOffsetUnits, fColorTable); | 955 fSampleX * fSrcBPP, fSrcOffsetUnits, fColorTable); |
| 954 } | 956 } |
| OLD | NEW |