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/DM.cpp

Issue 1240143002: Add the ability to decode a subset to SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix line endings Created 5 years, 5 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 | dm/DMSrcSink.h » ('j') | dm/DMSrcSink.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "CrashHandler.h" 8 #include "CrashHandler.h"
9 #include "DMJsonWriter.h" 9 #include "DMJsonWriter.h"
10 #include "DMSrcSink.h" 10 #include "DMSrcSink.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const float scales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f , 1.0f }; 212 const float scales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f , 1.0f };
213 213
214 for (float scale : scales) { 214 for (float scale : scales) {
215 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) { 215 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
216 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/ 216 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/
217 // compute their colors based on uninitialized values. 217 // compute their colors based on uninitialized values.
218 continue; 218 continue;
219 } 219 }
220 // Build additional test cases for images that decode natively to non-ca nvas types 220 // Build additional test cases for images that decode natively to non-ca nvas types
221 switch(codec->getInfo().colorType()) { 221 switch(codec->getInfo().colorType()) {
222 case kGray_8_SkColorType: 222 case kGray_8_SkColorType:
emmaleer 2015/07/17 22:31:05 Should run the Codec Subset test for Gray8 to Gray
scroggo 2015/07/20 14:25:42 Good question. Currently WEBP is the only codec th
223 push_src("image", "codec_kGray8", new CodecSrc(path, CodecSrc::k Normal_Mode, 223 push_src("image", "codec_kGray8", new CodecSrc(path, CodecSrc::k Normal_Mode,
224 CodecSrc::kGrayscale_Always_DstColorType, scale)); 224 CodecSrc::kGrayscale_Always_DstColorType, scale));
225 push_src("image", "scanline_kGray8", new CodecSrc(path, CodecSrc ::kScanline_Mode, 225 push_src("image", "scanline_kGray8", new CodecSrc(path, CodecSrc ::kScanline_Mode,
226 CodecSrc::kGrayscale_Always_DstColorType, scale)); 226 CodecSrc::kGrayscale_Always_DstColorType, scale));
227 push_src("image", "scanline_subset_kGray8", new CodecSrc(path, 227 push_src("image", "scanline_subset_kGray8", new CodecSrc(path,
228 CodecSrc::kScanline_Subset_Mode, CodecSrc::kGrayscale_Al ways_DstColorType, 228 CodecSrc::kScanline_Subset_Mode, CodecSrc::kGrayscale_Al ways_DstColorType,
229 scale)); 229 scale));
230 push_src("image", "stripe_kGray8", new CodecSrc(path, CodecSrc:: kStripe_Mode, 230 push_src("image", "stripe_kGray8", new CodecSrc(path, CodecSrc:: kStripe_Mode,
231 CodecSrc::kGrayscale_Always_DstColorType, scale)); 231 CodecSrc::kGrayscale_Always_DstColorType, scale));
232 // Intentional fall through 232 // Intentional fall through
(...skipping 17 matching lines...) Expand all
250 250
251 // Decode all images to the canvas color type 251 // Decode all images to the canvas color type
252 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode, 252 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode,
253 CodecSrc::kGetFromCanvas_DstColorType, scale)); 253 CodecSrc::kGetFromCanvas_DstColorType, scale));
254 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mod e, 254 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mod e,
255 CodecSrc::kGetFromCanvas_DstColorType, scale)); 255 CodecSrc::kGetFromCanvas_DstColorType, scale));
256 push_src("image", "scanline_subset", new CodecSrc(path, CodecSrc::kScanl ine_Subset_Mode, 256 push_src("image", "scanline_subset", new CodecSrc(path, CodecSrc::kScanl ine_Subset_Mode,
257 CodecSrc::kGetFromCanvas_DstColorType, scale)); 257 CodecSrc::kGetFromCanvas_DstColorType, scale));
258 push_src("image", "stripe", new CodecSrc(path, CodecSrc::kStripe_Mode, 258 push_src("image", "stripe", new CodecSrc(path, CodecSrc::kStripe_Mode,
259 CodecSrc::kGetFromCanvas_DstColorType, scale)); 259 CodecSrc::kGetFromCanvas_DstColorType, scale));
260 push_src("image", "codec_subset", new CodecSrc(path, CodecSrc::kSubset_M ode,
261 CodecSrc::kGetFromCanvas_DstColorType, scale));
260 } 262 }
261 } 263 }
262 264
263 static bool codec_supported(const char* ext) { 265 static bool codec_supported(const char* ext) {
264 // FIXME: Once other versions of SkCodec are available, we can add them to t his 266 // FIXME: Once other versions of SkCodec are available, we can add them to t his
265 // list (and eventually we can remove this check once they are all supported ). 267 // list (and eventually we can remove this check once they are all supported ).
266 static const char* const exts[] = { 268 static const char* const exts[] = {
267 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp", 269 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp",
268 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP", 270 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP",
269 }; 271 };
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 828 }
827 return 0; 829 return 0;
828 } 830 }
829 831
830 #if !defined(SK_BUILD_FOR_IOS) 832 #if !defined(SK_BUILD_FOR_IOS)
831 int main(int argc, char** argv) { 833 int main(int argc, char** argv) {
832 SkCommandLineFlags::Parse(argc, argv); 834 SkCommandLineFlags::Parse(argc, argv);
833 return dm_main(); 835 return dm_main();
834 } 836 }
835 #endif 837 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DMSrcSink.h » ('j') | dm/DMSrcSink.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698