Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: src/codec/SkSwizzler.cpp

Issue 1616753003: Use fActualProc to choose fFastProc or fSlowProc in SkSwizzler (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkSwizzler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkSwizzler.cpp
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index 65e521050e7795cfc4be18b55745822308f52afa..24cb65fe28e8e027247179eee42c8f0808a05e33 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -769,7 +769,8 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
SkSwizzler::SkSwizzler(RowProc fastProc, RowProc proc, const SkPMColor* ctable, int srcOffset,
int srcWidth, int dstOffset, int dstWidth, int srcBPP, int dstBPP)
: fFastProc(fastProc)
- , fProc(proc)
+ , fSlowProc(proc)
+ , fActualProc(fFastProc ? fFastProc : fSlowProc)
, fColorTable(ctable)
, fSrcOffset(srcOffset)
, fDstOffset(dstOffset)
@@ -794,14 +795,17 @@ int SkSwizzler::onSetSampleX(int sampleX) {
fAllocatedWidth = get_scaled_dimension(fDstWidth, sampleX);
// The optimized swizzler routines do not (yet) support sampling.
- fFastProc = nullptr;
+ if (1 == fSampleX && fFastProc) {
+ fActualProc = fFastProc;
+ } else {
+ fActualProc = fSlowProc;
+ }
return fAllocatedWidth;
}
void SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
SkASSERT(nullptr != dst && nullptr != src);
- RowProc proc = fFastProc ? fFastProc : fProc;
- proc(SkTAddOffset<void>(dst, fDstOffsetBytes), src, fSwizzleWidth, fSrcBPP,
+ fActualProc(SkTAddOffset<void>(dst, fDstOffsetBytes), src, fSwizzleWidth, fSrcBPP,
fSampleX * fSrcBPP, fSrcOffsetUnits, fColorTable);
}
« no previous file with comments | « src/codec/SkSwizzler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698