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

Unified Diff: dm/DMSrcSink.cpp

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: Rebase - it compiles but I'm sure everything is broken 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 | « dm/DM.cpp ('k') | gyp/tools.gyp » ('j') | 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 88371a8e28fdf68e1e0e5e041588a3a475e4adc1..23f42af133942d29608819584c32c2f344f38401 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -86,7 +86,7 @@ static SkBitmapRegionDecoderInterface* create_brd(Path path,
SkBitmapRegionDecoderInterface::Strategy strategy) {
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
if (!encoded) {
- return NULL;
+ return nullptr;
}
return SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(new SkMemoryStream(encoded),
strategy);
@@ -114,6 +114,10 @@ Error BRDSrc::draw(SkCanvas* canvas) const {
return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fPath.c_str()));
}
+ if (!brd->conversionSupported(colorType)) {
+ return Error::Nonfatal("Cannot convert to color type.\n");
+ }
+
const uint32_t width = brd->width();
const uint32_t height = brd->height();
// Visually inspecting very small output images is not necessary.
@@ -244,7 +248,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
if (!encoded) {
return SkStringPrintf("Couldn't read %s.", fPath.c_str());
}
- SkAutoTDelete<SkCodec> codec(NULL);
+ SkAutoTDelete<SkCodec> codec(nullptr);
if (kScaledCodec_Mode == fMode) {
codec.reset(SkScaledCodec::NewFromData(encoded));
// TODO (msarett): This should fall through to a fatal error once we support scaled
« no previous file with comments | « dm/DM.cpp ('k') | gyp/tools.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698