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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 OwnPtr<JPEGImageDecoder> decoder = createDecoder(maxDecodedBytes); | 87 OwnPtr<JPEGImageDecoder> decoder = createDecoder(maxDecodedBytes); |
88 decoder->setData(data.get(), true); | 88 decoder->setData(data.get(), true); |
89 | 89 |
90 OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes()); | 90 OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes()); |
91 decoder->setImagePlanes(imagePlanes.release()); | 91 decoder->setImagePlanes(imagePlanes.release()); |
92 bool sizeIsAvailable = decoder->isSizeAvailable(); | 92 bool sizeIsAvailable = decoder->isSizeAvailable(); |
93 ASSERT_TRUE(sizeIsAvailable); | 93 ASSERT_TRUE(sizeIsAvailable); |
94 | 94 |
95 IntSize size = decoder->decodedSize(); | 95 IntSize size = decoder->decodedSize(); |
96 IntSize ySize = decoder->decodedYUVSize(0); | 96 IntSize ySize = decoder->decodedYUVSize(0, ImageDecoder::ActualSize); |
97 IntSize uSize = decoder->decodedYUVSize(1); | 97 IntSize uSize = decoder->decodedYUVSize(1, ImageDecoder::ActualSize); |
98 IntSize vSize = decoder->decodedYUVSize(2); | 98 IntSize vSize = decoder->decodedYUVSize(2, ImageDecoder::ActualSize); |
99 | 99 |
100 ASSERT_TRUE(size.width() == ySize.width()); | 100 ASSERT_TRUE(size.width() == ySize.width()); |
101 ASSERT_TRUE(size.height() == ySize.height()); | 101 ASSERT_TRUE(size.height() == ySize.height()); |
102 ASSERT_TRUE(uSize.width() == vSize.width()); | 102 ASSERT_TRUE(uSize.width() == vSize.width()); |
103 ASSERT_TRUE(uSize.height() == vSize.height()); | 103 ASSERT_TRUE(uSize.height() == vSize.height()); |
104 | 104 |
105 *outputYWidth = ySize.width(); | 105 *outputYWidth = ySize.width(); |
106 *outputYHeight = ySize.height(); | 106 *outputYHeight = ySize.height(); |
107 *outputUVWidth = uSize.width(); | 107 *outputUVWidth = uSize.width(); |
108 *outputUVHeight = uSize.height(); | 108 *outputUVHeight = uSize.height(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 TEST(JPEGImageDecoderTest, yuv) | 216 TEST(JPEGImageDecoderTest, yuv) |
217 { | 217 { |
218 const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; // 25
6x256, YUV 4:2:0 | 218 const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; // 25
6x256, YUV 4:2:0 |
219 unsigned outputYWidth, outputYHeight, outputUVWidth, outputUVHeight; | 219 unsigned outputYWidth, outputYHeight, outputUVWidth, outputUVHeight; |
220 readYUV(LargeEnoughSize, &outputYWidth, &outputYHeight, &outputUVWidth, &out
putUVHeight, jpegFile); | 220 readYUV(LargeEnoughSize, &outputYWidth, &outputYHeight, &outputUVWidth, &out
putUVHeight, jpegFile); |
221 EXPECT_EQ(256u, outputYWidth); | 221 EXPECT_EQ(256u, outputYWidth); |
222 EXPECT_EQ(256u, outputYHeight); | 222 EXPECT_EQ(256u, outputYHeight); |
223 EXPECT_EQ(128u, outputUVWidth); | 223 EXPECT_EQ(128u, outputUVWidth); |
224 EXPECT_EQ(128u, outputUVHeight); | 224 EXPECT_EQ(128u, outputUVHeight); |
225 } | 225 } |
OLD | NEW |