diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 00:56:50 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 00:56:50 +0000 |
commit | 6ebcc35add48c0aeac7aa7bb417d7d819fbf11ba (patch) | |
tree | 5eb72e99bbc16a9d01dec62fcfe9c40954a41f4c /webkit/tools/test_shell/test_shell_win.cc | |
parent | 55cc33475ae6c10cd0c29b77ff9f322f70e5b507 (diff) | |
download | chromium_src-6ebcc35add48c0aeac7aa7bb417d7d819fbf11ba.zip chromium_src-6ebcc35add48c0aeac7aa7bb417d7d819fbf11ba.tar.gz chromium_src-6ebcc35add48c0aeac7aa7bb417d7d819fbf11ba.tar.bz2 |
Add pixel layout test support for Linux
Tracking down this error turned out to be a total pain. Image dumping is
the first bit of code that we have run into on Linux that copies bitmap
platform devices. Previously we didn't reference count them like Windows
does.
Review URL: http://codereview.chromium.org/11459
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5657 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_shell_win.cc')
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index eb52dc9..12c2c47 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -12,8 +12,6 @@ #include "webkit/tools/test_shell/test_shell.h" #include "base/gfx/bitmap_platform_device.h" -#include "base/gfx/png_encoder.h" -#include "base/md5.h" #include "base/memory_debug.h" #include "base/message_loop.h" #include "base/path_service.h" @@ -113,40 +111,6 @@ ATOM TestShell::RegisterWindowClass() { return RegisterClassEx(&wcex); } -// static -std::string TestShell::DumpImage(WebFrame* web_frame, - const std::wstring& file_name) { - scoped_ptr<gfx::BitmapPlatformDevice> device; - if (!web_frame->CaptureImage(&device, true)) - return std::string(); - - const SkBitmap& src_bmp = device->accessBitmap(false); - - // Encode image. - std::vector<unsigned char> png; - SkAutoLockPixels src_bmp_lock(src_bmp); - PNGEncoder::Encode( - reinterpret_cast<const unsigned char*>(src_bmp.getPixels()), - PNGEncoder::FORMAT_BGRA, src_bmp.width(), src_bmp.height(), - static_cast<int>(src_bmp.rowBytes()), true, &png); - - // Write to disk. - FILE* file = NULL; - if (_wfopen_s(&file, file_name.c_str(), L"wb") == 0) { - fwrite(&png[0], 1, png.size(), file); - fclose(file); - } - - // Compute MD5 sum. - MD5Context ctx; - MD5Init(&ctx); - MD5Update(&ctx, src_bmp.getPixels(), src_bmp.getSize()); - - MD5Digest digest; - MD5Final(&digest, &ctx); - return MD5DigestToBase16(digest); -} - void TestShell::DumpBackForwardList(std::wstring* result) { result->clear(); for (WindowList::iterator iter = TestShell::windowList()->begin(); |