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

Unified Diff: chrome/browser/renderer_host/backing_store_x.cc

Issue 155321: Improve performance of dragged tab renderering.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « chrome/browser/renderer_host/backing_store.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/backing_store_x.cc
===================================================================
--- chrome/browser/renderer_host/backing_store_x.cc (revision 20318)
+++ chrome/browser/renderer_host/backing_store_x.cc (working copy)
@@ -7,6 +7,10 @@
#include <stdlib.h>
#include <sys/ipc.h>
#include <sys/shm.h>
+#if defined(TOOLKIT_GTK)
+#include <cairo-xlib.h>
+#include <gtk/gtk.h>
+#endif
#include <algorithm>
#include <utility>
@@ -336,6 +340,31 @@
rect.x(), rect.y());
}
+#if defined(TOOLKIT_GTK)
+void BackingStore::PaintToRect(const gfx::Rect& rect, GdkDrawable* target) {
+ cairo_surface_t* surface = cairo_xlib_surface_create(
+ display_, pixmap_, static_cast<Visual*>(visual_),
+ size_.width(), size_.height());
+ cairo_t* cr = gdk_cairo_create(target);
+
+ cairo_translate(cr, rect.x(), rect.y());
+ double x_scale = static_cast<double>(rect.width()) / size_.width();
+ double y_scale = static_cast<double>(rect.height()) / size_.height();
+ cairo_scale(cr, x_scale, y_scale);
+
+ cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface);
+ cairo_pattern_set_filter(pattern, CAIRO_FILTER_BEST);
+ cairo_set_source(cr, pattern);
+ cairo_pattern_destroy(pattern);
+
+ cairo_identity_matrix(cr);
+
+ cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
+ cairo_fill(cr);
+ cairo_destroy(cr);
+}
+#endif
+
SkBitmap BackingStore::PaintRectToBitmap(const gfx::Rect& rect) {
base::TimeTicks begin_time = base::TimeTicks::Now();
const int width = std::min(size_.width(), rect.width());
« no previous file with comments | « chrome/browser/renderer_host/backing_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698