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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp

Issue 2523943002: Explicitly specify target color space to ImageDecoder at creation (Closed)
Patch Set: Rebase Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 #include "wtf/typed_arrays/ArrayBuffer.h" 40 #include "wtf/typed_arrays/ArrayBuffer.h"
41 #include <memory> 41 #include <memory>
42 42
43 namespace blink { 43 namespace blink {
44 44
45 static const size_t LargeEnoughSize = 1000 * 1000; 45 static const size_t LargeEnoughSize = 1000 * 1000;
46 46
47 namespace { 47 namespace {
48 48
49 std::unique_ptr<ImageDecoder> createDecoder(size_t maxDecodedBytes) { 49 std::unique_ptr<ImageDecoder> createDecoder(size_t maxDecodedBytes) {
50 return wrapUnique(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, 50 return wrapUnique(new JPEGImageDecoder(
51 ImageDecoder::ColorSpaceApplied, 51 ImageDecoder::AlphaNotPremultiplied, ImageDecoder::ColorSpaceTransformed,
52 maxDecodedBytes)); 52 ImageDecoder::targetColorSpaceForTesting(), maxDecodedBytes));
53 } 53 }
54 54
55 std::unique_ptr<ImageDecoder> createDecoder() { 55 std::unique_ptr<ImageDecoder> createDecoder() {
56 return createDecoder(ImageDecoder::noDecodedImageByteLimit); 56 return createDecoder(ImageDecoder::noDecodedImageByteLimit);
57 } 57 }
58 58
59 } // anonymous namespace 59 } // anonymous namespace
60 60
61 void downsample(size_t maxDecodedBytes, 61 void downsample(size_t maxDecodedBytes,
62 unsigned* outputWidth, 62 unsigned* outputWidth,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 ASSERT_TRUE(testData.get()); 305 ASSERT_TRUE(testData.get());
306 306
307 std::unique_ptr<ImageDecoder> testDecoder = createDecoder(); 307 std::unique_ptr<ImageDecoder> testDecoder = createDecoder();
308 testDecoder->setData(testData.get(), true); 308 testDecoder->setData(testData.get(), true);
309 EXPECT_EQ(1u, testDecoder->frameCount()); 309 EXPECT_EQ(1u, testDecoder->frameCount());
310 ASSERT_TRUE(testDecoder->frameBufferAtIndex(0)); 310 ASSERT_TRUE(testDecoder->frameBufferAtIndex(0));
311 EXPECT_TRUE(testDecoder->failed()); 311 EXPECT_TRUE(testDecoder->failed());
312 } 312 }
313 313
314 } // namespace blink 314 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698