summaryrefslogtreecommitdiffstats
path: root/skia/ext
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-04 16:21:25 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-04 16:21:25 +0000
commitd1f72ed6e0c95e8437de2d914a7a97183d4aa443 (patch)
tree14c2ccbd157ff6e373df274b63f9a02bce174721 /skia/ext
parent78117b9c3b21847aee5373b3d936bb7213216ce6 (diff)
downloadchromium_src-d1f72ed6e0c95e8437de2d914a7a97183d4aa443.zip
chromium_src-d1f72ed6e0c95e8437de2d914a7a97183d4aa443.tar.gz
chromium_src-d1f72ed6e0c95e8437de2d914a7a97183d4aa443.tar.bz2
Fixes two Linux canvas related bugs.
. The platform paint was allocating at a size bigger than necessary. . ChromeCanvas::DrawStringInt was not taking into account the matrix on the canvas, which means the text could be drawn at the wrong location. BUG=none TEST=none Review URL: http://codereview.chromium.org/99279 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext')
-rw-r--r--skia/ext/platform_canvas_linux.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/skia/ext/platform_canvas_linux.h b/skia/ext/platform_canvas_linux.h
index 686ad0a..1f237d7 100644
--- a/skia/ext/platform_canvas_linux.h
+++ b/skia/ext/platform_canvas_linux.h
@@ -95,7 +95,7 @@ class CanvasPaintT : public T {
// 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_set_source_surface(cr, surface_, rectangle_.x, rectangle_.y);
cairo_rectangle(cr, rectangle_.x, rectangle_.y,
rectangle_.width, rectangle_.height);
cairo_fill(cr);
@@ -115,16 +115,15 @@ class CanvasPaintT : public T {
private:
void init(bool opaque) {
- // In order to be most optimal, we could allocate just the damaged rect and
- // set a translation so it's at the origin. However, since that would be
- // ignored when we draw on the cairo surface, this currently won't work.
- // Allocate the minimal bitmap from the origin to damage rect.
- if (!T::initialize(rectangle_.x + rectangle_.width,
- rectangle_.y + rectangle_.height, opaque, NULL)) {
+ if (!T::initialize(rectangle_.width, rectangle_.height, opaque, NULL)) {
// Cause a deliberate crash;
*(char*) 0 = 0;
}
+ // Need to translate so that the dirty region appears at the origin of the
+ // surface.
+ T::translate(-SkIntToScalar(rectangle_.x), -SkIntToScalar(rectangle_.y));
+
surface_ = T::getTopPlatformDevice().beginPlatformPaint();
}