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

Unified Diff: src/codec/SkMaskSwizzler.cpp

Issue 1390213002: Add subsetting to SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@fill-refactor
Patch Set: Response to comments 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/SkSwizzler.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 9772d87e38e67c31acf41faad788fe0a1567c19c..72dca28057ff5c82b13f6b6eaa883970011fee4d 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,
+ const SkCodec::Options& options) {
// Choose the appropriate row procedure
RowProc proc = nullptr;
@@ -352,7 +352,14 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
return nullptr;
}
- return new SkMaskSwizzler(dstInfo.width(), masks, proc);
+ int srcOffset = 0;
+ int srcWidth = dstInfo.width();
+ if (options.fSubset) {
+ srcOffset = options.fSubset->left();
+ srcWidth = options.fSubset->width();
+ }
+
+ return new SkMaskSwizzler(masks, proc, srcOffset, srcWidth);
}
/*
@@ -360,13 +367,14 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(
* Constructor for mask swizzler
*
*/
-SkMaskSwizzler::SkMaskSwizzler(int width, SkMasks* masks, RowProc proc)
+SkMaskSwizzler::SkMaskSwizzler(SkMasks* masks, RowProc proc, int srcOffset, int srcWidth)
: fMasks(masks)
, fRowProc(proc)
- , fSrcWidth(width)
- , fDstWidth(width)
+ , fSrcWidth(srcWidth)
+ , fDstWidth(srcWidth)
, fSampleX(1)
- , fX0(0)
+ , fSrcOffset(srcOffset)
+ , fX0(srcOffset)
{}
int SkMaskSwizzler::onSetSampleX(int sampleX) {
@@ -374,7 +382,7 @@ int SkMaskSwizzler::onSetSampleX(int sampleX) {
SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be
// way to report failure?
fSampleX = sampleX;
- fX0 = get_start_coord(sampleX);
+ fX0 = get_start_coord(sampleX) + fSrcOffset;
fDstWidth = get_scaled_dimension(fSrcWidth, sampleX);
// check that fX0 is less than original width
« no previous file with comments | « src/codec/SkMaskSwizzler.h ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698