OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <cmath> | 6 #include <cmath> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/libpng/png.h" | 10 #include "third_party/libpng/png.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "third_party/skia/include/core/SkColorPriv.h" | 12 #include "third_party/skia/include/core/SkColorPriv.h" |
13 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 13 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
14 #include "third_party/zlib/zlib.h" | 14 #include "third_party/zlib/zlib.h" |
15 #include "ui/gfx/codec/png_codec.h" | 15 #include "ui/gfx/codec/png_codec.h" |
16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 #include "ui/gfx/skia_util.h" | 17 #include "ui/gfx/skia_util.h" |
18 | 18 |
19 namespace gfx { | 19 namespace gfx { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 void MakeRGBImage(int w, int h, std::vector<unsigned char>* data) { | 23 void MakeRGBImage(int w, int h, std::vector<unsigned char>* data) { |
24 data->resize(w * h * 3); | 24 data->resize(w * h * 3); |
25 for (int y = 0; y < h; y++) { | 25 for (int y = 0; y < h; y++) { |
26 for (int x = 0; x < w; x++) { | 26 for (int x = 0; x < w; x++) { |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 PNGCodec::Decode(&encoded_normal[0], encoded_normal.size(), &decoded)); | 1179 PNGCodec::Decode(&encoded_normal[0], encoded_normal.size(), &decoded)); |
1180 EXPECT_TRUE(BitmapsAreEqual(decoded, original_bitmap)); | 1180 EXPECT_TRUE(BitmapsAreEqual(decoded, original_bitmap)); |
1181 | 1181 |
1182 EXPECT_TRUE( | 1182 EXPECT_TRUE( |
1183 PNGCodec::Decode(&encoded_fast[0], encoded_fast.size(), &decoded)); | 1183 PNGCodec::Decode(&encoded_fast[0], encoded_fast.size(), &decoded)); |
1184 EXPECT_TRUE(BitmapsAreEqual(decoded, original_bitmap)); | 1184 EXPECT_TRUE(BitmapsAreEqual(decoded, original_bitmap)); |
1185 } | 1185 } |
1186 | 1186 |
1187 | 1187 |
1188 } // namespace gfx | 1188 } // namespace gfx |
OLD | NEW |