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

Unified Diff: src/codec/SkSwizzler.cpp

Issue 1407603003: Fix SkSwizzler bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added test and rebase 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/SkSwizzler.h ('k') | tests/CodexTest.cpp » ('j') | 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 ce2c946f18a3d0f62b9111eb8c5a5e25f05b101b..de691243403c7d72f258e5d554391f9f81bd8282 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -693,13 +693,14 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
return new SkSwizzler(proc, ctable, srcOffset, srcWidth, bpp);
}
-SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidth, int bpp)
+SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int subsetWidth,
+ int bpp)
: fRowProc(proc)
, fColorTable(ctable)
, fSrcOffset(srcOffset)
, fX0(srcOffset)
- , fSrcWidth(srcWidth)
- , fDstWidth(srcWidth)
+ , fSubsetWidth(subsetWidth)
+ , fDstWidth(subsetWidth)
, fSampleX(1)
, fBPP(bpp)
{}
@@ -709,10 +710,10 @@ int SkSwizzler::onSetSampleX(int sampleX) {
// way to report failure?
fSampleX = sampleX;
fX0 = get_start_coord(sampleX) + fSrcOffset;
- fDstWidth = get_scaled_dimension(fSrcWidth, sampleX);
+ fDstWidth = get_scaled_dimension(fSubsetWidth, sampleX);
- // check that fX0 is less than original width
- SkASSERT(fX0 >= 0 && fX0 < fSrcWidth);
+ // check that fX0 is valid
+ SkASSERT(fX0 >= 0);
return fDstWidth;
}
« no previous file with comments | « src/codec/SkSwizzler.h ('k') | tests/CodexTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698