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

Unified Diff: src/codec/SkMaskSwizzler.cpp

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: 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
Index: src/codec/SkMaskSwizzler.cpp
diff --git a/src/codec/SkMaskSwizzler.cpp b/src/codec/SkMaskSwizzler.cpp
index 6ca9b58f4ed7e16e27490188aa6077412c1ed6dc..46f7898b1ffb3509000ddddc52618deb805714b5 100644
--- a/src/codec/SkMaskSwizzler.cpp
+++ b/src/codec/SkMaskSwizzler.cpp
@@ -250,9 +250,9 @@ static SkSwizzler::ResultAlpha swizzle_mask32_to_565(
* Create a new mask swizzler
*
*/
-SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
- const SkImageInfo& dstInfo, const SkImageInfo& srcInfo, SkMasks* masks,
- uint32_t bitsPerPixel) {
+SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(const SkImageInfo& dstInfo,
+ const SkImageInfo& srcInfo, SkMasks* masks, uint32_t bitsPerPixel, int subsetLeft,
+ int subsetWidth) {
// Choose the appropriate row procedure
RowProc proc = nullptr;
@@ -354,9 +354,10 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
// Get the sample size
int sampleX;
- SkScaledCodec::ComputeSampleSize(dstInfo, srcInfo, &sampleX, NULL);
+ SkScaledCodec::ComputeSampleSize(dstInfo.dimensions(), srcInfo.dimensions(), &sampleX, nullptr);
+ int startX = get_start_coord(sampleX) + subsetLeft;
- return new SkMaskSwizzler(dstInfo, masks, proc, sampleX);
+ return new SkMaskSwizzler(masks, proc, subsetWidth, sampleX, startX);
}
/*
@@ -364,13 +365,13 @@ 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(SkMasks* masks, RowProc proc, uint32_t width, uint32_t sampleX,
+ uint32_t startX)
+ : fMasks(masks)
, fRowProc(proc)
+ , fWidth(width)
, fSampleX(sampleX)
- , fStartX(get_start_coord(sampleX))
+ , fStartX(startX)
{}
/*
@@ -380,5 +381,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, fWidth, fMasks, fStartX, fSampleX);
}

Powered by Google App Engine
This is Rietveld 408576698