summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 09:00:19 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 09:00:19 +0000
commit74484851bb8f9f1954014a08c81305e74f9b0bda (patch)
tree6787acc82a2b50f10b1d0b50feeb736604625a19
parent1a528c185cca100c4122b46d691adda44f774893 (diff)
downloadchromium_src-74484851bb8f9f1954014a08c81305e74f9b0bda.zip
chromium_src-74484851bb8f9f1954014a08c81305e74f9b0bda.tar.gz
chromium_src-74484851bb8f9f1954014a08c81305e74f9b0bda.tar.bz2
A few small improvements to ChromeCanvasPaint.
- Don't triple buffer, we are already effectively double buffering by drawing onto a ChromeCanvas (bitmap), and then blitting. We don't need the extra GDK double buffering. - Don't translate the origin, and just blit the dirty rectangle. Review URL: http://codereview.chromium.org/63057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13344 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--skia/ext/platform_canvas_linux.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/skia/ext/platform_canvas_linux.h b/skia/ext/platform_canvas_linux.h
index 818b70c..7981f57 100644
--- a/skia/ext/platform_canvas_linux.h
+++ b/skia/ext/platform_canvas_linux.h
@@ -93,12 +93,13 @@ class CanvasPaintT : public T {
if (!isEmpty()) {
T::restoreToCount(1);
- cairo_t* cairo_drawable = gdk_cairo_create(window_);
- cairo_set_source_surface(cairo_drawable, surface_, 0, 0);
- cairo_paint(cairo_drawable);
- cairo_destroy(cairo_drawable);
-
- gdk_window_end_paint(window_);
+ // Blit the dirty rect to the window.
+ cairo_t* cr = gdk_cairo_create(window_);
+ cairo_set_source_surface(cr, surface_, 0.0, 0.0);
+ cairo_rectangle(cr, rectangle_.x, rectangle_.y,
+ rectangle_.width, rectangle_.height);
+ cairo_fill(cr);
+ cairo_destroy(cr);
}
}
@@ -114,19 +115,12 @@ class CanvasPaintT : public T {
private:
void init(bool opaque) {
- gdk_window_begin_paint_rect(window_, &rectangle_);
-
if (!T::initialize(rectangle_.width, rectangle_.height, opaque, NULL)) {
// Cause a deliberate crash;
*(char*) 0 = 0;
}
surface_ = T::getTopPlatformDevice().beginPlatformPaint();
-
- // This will bring the canvas into the screen coordinate system for the
- // dirty rect
- T::translate(SkIntToScalar(-rectangle_.x),
- SkIntToScalar(-rectangle_.y));
}
cairo_surface_t* surface_;