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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 9582003: Support browser side thumbnailing for GPU composited pages on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 9 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: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 27c6b1811067c059028ad7c20f79f793aa07b18e..47a400653053c657750018cf29b065a2d947b81a 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -32,6 +32,7 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
+#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "webkit/glue/webcursor.h"
@@ -492,10 +493,35 @@ bool RenderWidgetHostImpl::CopyFromBackingStore(skia::PlatformCanvas* output) {
if (!backing_store)
return false;
+ TRACE_EVENT0("browser", "RenderWidgetHostImpl::CopyFromBackingStore");
return backing_store->CopyFromBackingStore(
gfx::Rect(backing_store->size()), output);
}
+bool RenderWidgetHostImpl::CopyFromCompositingSurface(
+ const gfx::Size& size,
+ skia::PlatformCanvas* output) {
+ if (!is_accelerated_compositing_active_)
+ return false;
+
+ TRACE_EVENT0("browser", "RenderWidgetHostImpl::CopyFromCompositingSurface");
+ std::vector<unsigned char> pixels(4 * size.GetArea());
+ if(!GpuSurfaceTracker::Get()->CopySurface(surface_id_,
+ size,
+ &pixels))
apatrick_chromium 2012/03/07 20:39:37 Is it possible to copy the pixels directly into th
mazda 2012/03/08 13:14:28 Actually SkBitmap::setPixels does not copy the dat
apatrick_chromium 2012/03/08 20:15:47 I think you could call SkBitmap::allocPixels befor
mazda 2012/03/10 07:51:37 Thanks. I changed the AcceleratedSurface::CopyTo t
+ return false;
+
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
+ bitmap.allocPixels();
+ bitmap.setPixels(&pixels[0]);
apatrick_chromium 2012/03/07 20:39:37 This won't work if the area of the surface is zero
mazda 2012/03/08 13:14:28 I added a check for |size| and also made Accelerat
+
+ if (!output->initialize(size.width(), size.height(), true))
+ return false;
+ output->writePixels(bitmap, 0, 0);
+ return true;
+}
+
#if defined(TOOLKIT_GTK)
bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow(
const gfx::Rect& dest_rect, GdkWindow* target) {

Powered by Google App Engine
This is Rietveld 408576698