OLD | NEW |
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 Loading... |
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( | 50 return wrapUnique(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, |
51 ImageDecoder::AlphaNotPremultiplied, | 51 ImageDecoder::ColorSpaceApplied, |
52 ImageDecoder::GammaAndColorProfileApplied, maxDecodedBytes)); | 52 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does | 293 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does |
294 // not break JPEG decoding at a critical point: in between a call to decode the | 294 // not break JPEG decoding at a critical point: in between a call to decode the |
295 // size (when JPEGImageDecoder stops while it may still have input data to | 295 // size (when JPEGImageDecoder stops while it may still have input data to |
296 // read) and a call to do a full decode. | 296 // read) and a call to do a full decode. |
297 TEST(JPEGImageDecoderTest, mergeBuffer) { | 297 TEST(JPEGImageDecoderTest, mergeBuffer) { |
298 const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; | 298 const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; |
299 testMergeBuffer(&createDecoder, jpegFile); | 299 testMergeBuffer(&createDecoder, jpegFile); |
300 } | 300 } |
301 | 301 |
302 } // namespace blink | 302 } // namespace blink |
OLD | NEW |