summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 20:02:10 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 20:02:10 +0000
commit3d2da9c08491d46c0b3f8dcdccbb6d1c84bfbc40 (patch)
tree69a5b20223783d3ba79a2d0652bdc2cb756020f3 /app
parent4ed4ec64a3ac63c865f7ccfeed4abb64e251bd62 (diff)
downloadchromium_src-3d2da9c08491d46c0b3f8dcdccbb6d1c84bfbc40.zip
chromium_src-3d2da9c08491d46c0b3f8dcdccbb6d1c84bfbc40.tar.gz
chromium_src-3d2da9c08491d46c0b3f8dcdccbb6d1c84bfbc40.tar.bz2
Revert previous clipping rect change for Cairo to see if it fixes the build.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/gfx/canvas_linux.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc
index cf7352d..7e561c6 100644
--- a/app/gfx/canvas_linux.cc
+++ b/app/gfx/canvas_linux.cc
@@ -95,11 +95,29 @@ void Canvas::SizeStringInt(const std::wstring& text,
cairo_surface_destroy(surface);
}
+void Canvas::ApplySkiaMatrixToCairoContext(cairo_t* cr) {
+ const SkMatrix& skia_matrix = getTotalMatrix();
+ cairo_matrix_t cairo_matrix;
+ cairo_matrix_init(&cairo_matrix,
+ SkScalarToFloat(skia_matrix.getScaleX()),
+ SkScalarToFloat(skia_matrix.getSkewY()),
+ SkScalarToFloat(skia_matrix.getSkewX()),
+ SkScalarToFloat(skia_matrix.getScaleY()),
+ SkScalarToFloat(skia_matrix.getTranslateX()),
+ SkScalarToFloat(skia_matrix.getTranslateY()));
+ cairo_set_matrix(cr, &cairo_matrix);
+}
+
void Canvas::DrawStringInt(const std::wstring& text,
const gfx::Font& font,
const SkColor& color, int x, int y, int w, int h,
int flags) {
- cairo_t* cr = beginPlatformPaint();
+ cairo_surface_t* surface = beginPlatformPaint();
+ cairo_t* cr = cairo_create(surface);
+ // We're going to draw onto the surface directly. This circumvents the matrix
+ // installed by Skia. Apply the matrix from skia to cairo so they align and
+ // we draw at the right place.
+ ApplySkiaMatrixToCairoContext(cr);
PangoLayout* layout = pango_cairo_create_layout(cr);
cairo_set_source_rgb(cr,
@@ -151,6 +169,7 @@ void Canvas::DrawStringInt(const std::wstring& text,
pango_cairo_show_layout(cr, layout);
g_object_unref(layout);
+ cairo_destroy(cr);
// NOTE: beginPlatformPaint returned its surface, we shouldn't destroy it.
}