Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: webkit/tools/test_shell/test_shell.cc

Issue 21192: Add support for the "repaint" layout tests (LayoutTests/fast/repaint/*), whic... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/tools/test_shell/test_shell.cc
===================================================================
--- webkit/tools/test_shell/test_shell.cc (revision 9433)
+++ webkit/tools/test_shell/test_shell.cc (working copy)
@@ -28,7 +28,7 @@
#include "net/base/mime_util.h"
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_filter.h"
-#include "skia/ext/bitmap_platform_device.h"
+#include "skia/ext/platform_device.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webframe.h"
@@ -226,7 +226,8 @@
// command line (for the dump pixels argument), and the MD5 sum to
// stdout.
dumped_anything = true;
- std::string md5sum = DumpImage(webFrame, params->pixel_file_name);
+ std::string md5sum = DumpImage(shell->webViewHost(),
+ params->pixel_file_name);
printf("#MD5:%s\n", md5sum.c_str());
}
if (dumped_anything)
@@ -236,14 +237,24 @@
}
// static
-std::string TestShell::DumpImage(WebFrame* web_frame,
+std::string TestShell::DumpImage(WebViewHost* web_view_host,
const std::wstring& file_name) {
- scoped_ptr<skia::BitmapPlatformDevice> device;
- if (!web_frame->CaptureImage(&device, true))
- return std::string();
- const SkBitmap& src_bmp = device->accessBitmap(false);
+ web_view_host->Paint();
+ skia::PlatformDevice& device =
+ web_view_host->canvas()->getTopPlatformDevice();
+#if defined(OS_WIN)
+ // On windows we need to fixup the alpha on the bitmap. Do the fixup in a
+ // copy of the bitmap so as not to modify the original.
+ SkBitmap src_bmp;
+ const SkBitmap& orig = device.accessBitmap(false);
+ orig.copyTo(&src_bmp, orig.config());
+ skia::BitmapPlatformDeviceWin::fixupAlpha(src_bmp);
+#else
+ const SkBitmap& src_bmp = device.accessBitmap(false);
+#endif
+
// Encode image.
std::vector<unsigned char> png;
SkAutoLockPixels src_bmp_lock(src_bmp);

Powered by Google App Engine
This is Rietveld 408576698