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

Unified Diff: src/codec/SkMaskSwizzler.cpp

Issue 1372973002: Move all knowledge of X sampling into SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Attempt to fix RLE overflow Created 5 years, 2 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/SkMaskSwizzler.h ('k') | src/codec/SkSampler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkMaskSwizzler.cpp
diff --git a/src/codec/SkMaskSwizzler.cpp b/src/codec/SkMaskSwizzler.cpp
index 6ca9b58f4ed7e16e27490188aa6077412c1ed6dc..9772d87e38e67c31acf41faad788fe0a1567c19c 100644
--- a/src/codec/SkMaskSwizzler.cpp
+++ b/src/codec/SkMaskSwizzler.cpp
@@ -352,11 +352,7 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
return nullptr;
}
- // Get the sample size
- int sampleX;
- SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, NULL);
-
- return new SkMaskSwizzler(dstInfo, masks, proc, sampleX);
+ return new SkMaskSwizzler(dstInfo.width(), masks, proc);
}
/*
@@ -364,15 +360,28 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
* Constructor for mask swizzler
*
*/
-SkMaskSwizzler::SkMaskSwizzler(const SkImageInfo& dstInfo, SkMasks* masks,
- RowProc proc, uint32_t sampleX)
- : fDstInfo(dstInfo)
- , fMasks(masks)
+SkMaskSwizzler::SkMaskSwizzler(int width, SkMasks* masks, RowProc proc)
+ : fMasks(masks)
, fRowProc(proc)
- , fSampleX(sampleX)
- , fStartX(get_start_coord(sampleX))
+ , fSrcWidth(width)
+ , fDstWidth(width)
+ , fSampleX(1)
+ , fX0(0)
{}
+int SkMaskSwizzler::onSetSampleX(int sampleX) {
+ // FIXME: Share this function with SkSwizzler?
+ SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be
+ // way to report failure?
+ fSampleX = sampleX;
+ fX0 = get_start_coord(sampleX);
+ fDstWidth = get_scaled_dimension(fSrcWidth, sampleX);
+
+ // check that fX0 is less than original width
+ SkASSERT(fX0 >= 0 && fX0 < fSrcWidth);
+ return fDstWidth;
+}
+
/*
*
* Swizzle the specified row
@@ -380,5 +389,5 @@ SkMaskSwizzler::SkMaskSwizzler(const SkImageInfo& dstInfo, SkMasks* masks,
*/
SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
SkASSERT(nullptr != dst && nullptr != src);
- return fRowProc(dst, src, fDstInfo.width(), fMasks, fStartX, fSampleX);
+ return fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX);
}
« no previous file with comments | « src/codec/SkMaskSwizzler.h ('k') | src/codec/SkSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698