summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 20:39:38 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 20:39:38 +0000
commit777f996eab1610f9676ee62ee478cc97687c56cd (patch)
tree0b5df00b507bf0d0de8ba292541d7b0987f7f3ab /app
parent6e9f27f9b6839b7a07e44a6299bfa48579fe5ba2 (diff)
downloadchromium_src-777f996eab1610f9676ee62ee478cc97687c56cd.zip
chromium_src-777f996eab1610f9676ee62ee478cc97687c56cd.tar.gz
chromium_src-777f996eab1610f9676ee62ee478cc97687c56cd.tar.bz2
Reverting 20516 by re-landing this previous patch.
Keep the cairo clipping region in sync with the Skia one. The PlatformCanvas now tracks this, so we don't need to have the similar code in gfx::Canvas. I moved most references of cairo_surface_t to cairo_t since the cairo_t has a transform and clip but the surface does not. Review URL: http://codereview.chromium.org/149409 Review URL: http://codereview.chromium.org/155700 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/gfx/canvas_linux.cc21
1 files changed, 1 insertions, 20 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc
index 7e561c6..cf7352d 100644
--- a/app/gfx/canvas_linux.cc
+++ b/app/gfx/canvas_linux.cc
@@ -95,29 +95,11 @@ 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_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);
+ cairo_t* cr = beginPlatformPaint();
PangoLayout* layout = pango_cairo_create_layout(cr);
cairo_set_source_rgb(cr,
@@ -169,7 +151,6 @@ 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.
}