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

Unified Diff: app/gfx/canvas_linux.cc

Issue 149409: Keep the cairo clipping region in sync with the Skia one. (Closed)
Patch Set: git try 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 | « no previous file | base/gfx/native_widget_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/gfx/canvas_linux.cc
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc
index 7e561c61ec31170f931455f3c2bc7596caacc5df..cf7352d371a92b669b4263999879bec723b96f68 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.
}
« no previous file with comments | « no previous file | base/gfx/native_widget_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698