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

Unified Diff: dm/DMSrcSink.cpp

Issue 1918813002: Fix kSubset_Mode tests on non-native swizzles (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index dcbd2202755b200553855dcaa0180eb7a4ab0378..18ac6b420a70a0661af55c7a2a3fb15255072ea1 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -585,11 +585,12 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
// And scale
// FIXME: Should we have a version of getScaledDimensions that takes a subset
msarett 2016/04/25 13:25:50 This may be worth fixing in a follow-up. We do ha
// into account?
- decodeInfo = decodeInfo.makeWH(
- SkTMax(1, SkScalarRoundToInt(preScaleW * fScale)),
- SkTMax(1, SkScalarRoundToInt(preScaleH * fScale)));
- size_t rowBytes = decodeInfo.minRowBytes();
- if (!subsetBm.installPixels(decodeInfo, pixels, rowBytes, colorTable.get(),
+ const int scaledW = SkTMax(1, SkScalarRoundToInt(preScaleW * fScale));
+ const int scaledH = SkTMax(1, SkScalarRoundToInt(preScaleH * fScale));
+ decodeInfo = decodeInfo.makeWH(scaledW, scaledH);
+ SkImageInfo subsetBitmapInfo = bitmapInfo.makeWH(scaledW, scaledH);
+ size_t rowBytes = subsetBitmapInfo.minRowBytes();
+ if (!subsetBm.installPixels(subsetBitmapInfo, pixels, rowBytes, colorTable.get(),
nullptr, nullptr)) {
return SkStringPrintf("could not install pixels for %s.", fPath.c_str());
}
@@ -606,7 +607,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
fPath.c_str(), W, H, result);
}
premultiply_if_necessary(subsetBm);
- swap_rb_if_necessary(bitmap, fDstColorType);
+ swap_rb_if_necessary(subsetBm, fDstColorType);
canvas->drawBitmap(subsetBm, SkIntToScalar(left), SkIntToScalar(top));
// translate by the scaled height.
top += decodeInfo.height();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698