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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 2000783002: Exit before reaching some Nonfatal errors (Closed) Base URL: https://skia.googlesource.com/skia.git@opaque
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « dm/DM.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SkAndroidCodec.h" 9 #include "SkAndroidCodec.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (nullptr == brd.get()) { 116 if (nullptr == brd.get()) {
117 return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fP ath.c_str())); 117 return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fP ath.c_str()));
118 } 118 }
119 119
120 if (!brd->conversionSupported(colorType)) { 120 if (!brd->conversionSupported(colorType)) {
121 return Error::Nonfatal("Cannot convert to color type."); 121 return Error::Nonfatal("Cannot convert to color type.");
122 } 122 }
123 123
124 const uint32_t width = brd->width(); 124 const uint32_t width = brd->width();
125 const uint32_t height = brd->height(); 125 const uint32_t height = brd->height();
126 // Visually inspecting very small output images is not necessary. 126
127 if ((width / fSampleSize <= 10 || height / fSampleSize <= 10) && 1 != fSampl eSize) {
128 return Error::Nonfatal("Scaling very small images is uninteresting.");
129 }
130 switch (fMode) { 127 switch (fMode) {
131 case kFullImage_Mode: { 128 case kFullImage_Mode: {
132 SkBitmap bitmap; 129 SkBitmap bitmap;
133 if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(0, 0, wid th, height), 130 if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(0, 0, wid th, height),
134 fSampleSize, colorType, false)) { 131 fSampleSize, colorType, false)) {
135 return "Cannot decode (full) region."; 132 return "Cannot decode (full) region.";
136 } 133 }
137 if (colorType != bitmap.colorType()) { 134 if (colorType != bitmap.colorType()) {
138 return Error::Nonfatal("Cannot convert to color type."); 135 return Error::Nonfatal("Cannot convert to color type.");
139 } 136 }
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 skr.visit(i, drawsAsSingletonPictures); 1456 skr.visit(i, drawsAsSingletonPictures);
1460 } 1457 }
1461 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); 1458 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture());
1462 1459
1463 canvas->drawPicture(macroPic); 1460 canvas->drawPicture(macroPic);
1464 return check_against_reference(bitmap, src, fSink); 1461 return check_against_reference(bitmap, src, fSink);
1465 }); 1462 });
1466 } 1463 }
1467 1464
1468 } // namespace DM 1465 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698