| 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 #include <iomanip> | 7 #include <iomanip> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 if (!gfx::PNGCodec::Encode( | 197 if (!gfx::PNGCodec::Encode( |
| 198 reinterpret_cast<const unsigned char*>(bmp.getPixels()), | 198 reinterpret_cast<const unsigned char*>(bmp.getPixels()), |
| 199 color_format, gfx::Size(bmp.width(), bmp.height()), | 199 color_format, gfx::Size(bmp.width(), bmp.height()), |
| 200 static_cast<int>(bmp.rowBytes()), | 200 static_cast<int>(bmp.rowBytes()), |
| 201 false, std::vector<gfx::PNGCodec::Comment>(), &png)) { | 201 false, std::vector<gfx::PNGCodec::Comment>(), &png)) { |
| 202 FAIL() << "Failed to encode image"; | 202 FAIL() << "Failed to encode image"; |
| 203 } | 203 } |
| 204 | 204 |
| 205 const base::FilePath fpath(path); | 205 const base::FilePath fpath(path); |
| 206 const int num_written = | 206 const int num_written = |
| 207 file_util::WriteFile(fpath, reinterpret_cast<const char*>(&png[0]), | 207 base::WriteFile(fpath, reinterpret_cast<const char*>(&png[0]), |
| 208 png.size()); | 208 png.size()); |
| 209 if (num_written != static_cast<int>(png.size())) { | 209 if (num_written != static_cast<int>(png.size())) { |
| 210 FAIL() << "Failed to write dest \"" << path << '"'; | 210 FAIL() << "Failed to write dest \"" << path << '"'; |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 #endif // #if DEBUG_BITMAP_GENERATION | 213 #endif // #if DEBUG_BITMAP_GENERATION |
| 214 | 214 |
| 215 void CheckResampleToSame(skia::ImageOperations::ResizeMethod method) { | 215 void CheckResampleToSame(skia::ImageOperations::ResizeMethod method) { |
| 216 // Make our source bitmap. | 216 // Make our source bitmap. |
| 217 const int src_w = 16, src_h = 34; | 217 const int src_w = 16, src_h = 34; |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 EXPECT_LE(fabs(SkColorGetA(dst_color) - a), 1.5f); | 722 EXPECT_LE(fabs(SkColorGetA(dst_color) - a), 1.5f); |
| 723 EXPECT_LE(fabs(SkColorGetR(dst_color) - r), 1.5f); | 723 EXPECT_LE(fabs(SkColorGetR(dst_color) - r), 1.5f); |
| 724 EXPECT_LE(fabs(SkColorGetG(dst_color) - g), 1.5f); | 724 EXPECT_LE(fabs(SkColorGetG(dst_color) - g), 1.5f); |
| 725 EXPECT_LE(fabs(SkColorGetB(dst_color) - b), 1.5f); | 725 EXPECT_LE(fabs(SkColorGetB(dst_color) - b), 1.5f); |
| 726 if (HasFailure()) { | 726 if (HasFailure()) { |
| 727 return; | 727 return; |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 } | 730 } |
| 731 } | 731 } |
| OLD | NEW |