| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "v8_proxy.h" | 5 #include "v8_proxy.h" |
| 6 #undef LOG | 6 #undef LOG |
| 7 | 7 |
| 8 #include "webkit/tools/test_shell/test_shell.h" | 8 #include "webkit/tools/test_shell/test_shell.h" |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 MD5Context ctx; | 270 MD5Context ctx; |
| 271 MD5Init(&ctx); | 271 MD5Init(&ctx); |
| 272 MD5Update(&ctx, src_bmp.getPixels(), src_bmp.getSize()); | 272 MD5Update(&ctx, src_bmp.getPixels(), src_bmp.getSize()); |
| 273 | 273 |
| 274 MD5Digest digest; | 274 MD5Digest digest; |
| 275 MD5Final(&digest, &ctx); | 275 MD5Final(&digest, &ctx); |
| 276 std::string md5hash = MD5DigestToBase16(digest); | 276 std::string md5hash = MD5DigestToBase16(digest); |
| 277 | 277 |
| 278 // Only encode and dump the png if the hashes don't match. Encoding the image | 278 // Only encode and dump the png if the hashes don't match. Encoding the image |
| 279 // is really expensive. | 279 // is really expensive. |
| 280 if (md5hash.compare(0, pixel_hash.length(), pixel_hash) != 0) { | 280 if (md5hash.compare(pixel_hash) != 0) { |
| 281 PNGEncoder::Encode( | 281 PNGEncoder::Encode( |
| 282 reinterpret_cast<const unsigned char*>(src_bmp.getPixels()), | 282 reinterpret_cast<const unsigned char*>(src_bmp.getPixels()), |
| 283 color_format, src_bmp.width(), src_bmp.height(), | 283 color_format, src_bmp.width(), src_bmp.height(), |
| 284 static_cast<int>(src_bmp.rowBytes()), discard_transparency, &png); | 284 static_cast<int>(src_bmp.rowBytes()), discard_transparency, &png); |
| 285 | 285 |
| 286 // Write to disk. | 286 // Write to disk. |
| 287 file_util::WriteFile(file_name, reinterpret_cast<const char *>(&png[0]), | 287 file_util::WriteFile(file_name, reinterpret_cast<const char *>(&png[0]), |
| 288 png.size()); | 288 png.size()); |
| 289 } | 289 } |
| 290 | 290 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 } | 626 } |
| 627 #endif // OS_WIN | 627 #endif // OS_WIN |
| 628 return false; | 628 return false; |
| 629 } | 629 } |
| 630 | 630 |
| 631 std::wstring GetWebKitLocale() { | 631 std::wstring GetWebKitLocale() { |
| 632 return L"en-US"; | 632 return L"en-US"; |
| 633 } | 633 } |
| 634 | 634 |
| 635 } // namespace webkit_glue | 635 } // namespace webkit_glue |
| OLD | NEW |