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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1395383002: SkBitmapRegionDecoder clean-up (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/SkBitmapRegionCanvas.h » ('j') | 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 "SamplePipeControllers.h" 9 #include "SamplePipeControllers.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 case CodecSrc::kGrayscale_Always_DstColorType: 107 case CodecSrc::kGrayscale_Always_DstColorType:
108 colorType = kGray_8_SkColorType; 108 colorType = kGray_8_SkColorType;
109 break; 109 break;
110 } 110 }
111 111
112 SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(create_brd(fPath, fStrateg y)); 112 SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(create_brd(fPath, fStrateg y));
113 if (nullptr == brd.get()) { 113 if (nullptr == brd.get()) {
114 return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fP ath.c_str())); 114 return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fP ath.c_str()));
115 } 115 }
116 116
117 if (!brd->conversionSupported(colorType)) {
118 return Error::Nonfatal("Cannot convert to color type.\n");
119 }
120
117 const uint32_t width = brd->width(); 121 const uint32_t width = brd->width();
118 const uint32_t height = brd->height(); 122 const uint32_t height = brd->height();
119 // Visually inspecting very small output images is not necessary. 123 // Visually inspecting very small output images is not necessary.
120 if ((width / fSampleSize <= 10 || height / fSampleSize <= 10) && 1 != fSampl eSize) { 124 if ((width / fSampleSize <= 10 || height / fSampleSize <= 10) && 1 != fSampl eSize) {
121 return Error::Nonfatal("Scaling very small images is uninteresting."); 125 return Error::Nonfatal("Scaling very small images is uninteresting.");
122 } 126 }
123 switch (fMode) { 127 switch (fMode) {
124 case kFullImage_Mode: { 128 case kFullImage_Mode: {
125 SkAutoTDelete<SkBitmap> bitmap(brd->decodeRegion(0, 0, width, height , fSampleSize, 129 SkAutoTDelete<SkBitmap> bitmap(brd->decodeRegion(0, 0, width, height , fSampleSize,
126 colorType)); 130 colorType));
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 skr.visit<void>(i, drawsAsSingletonPictures); 1208 skr.visit<void>(i, drawsAsSingletonPictures);
1205 } 1209 }
1206 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1210 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1207 1211
1208 canvas->drawPicture(macroPic); 1212 canvas->drawPicture(macroPic);
1209 return ""; 1213 return "";
1210 }); 1214 });
1211 } 1215 }
1212 1216
1213 } // namespace DM 1217 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | tools/SkBitmapRegionCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698