| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "app/gfx/canvas.h" | 5 #include "app/gfx/canvas.h" |
| 6 | 6 |
| 7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <pango/pango.h> | 9 #include <pango/pango.h> |
| 10 #include <pango/pangocairo.h> | 10 #include <pango/pangocairo.h> |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 g_object_unref(layout); | 199 g_object_unref(layout); |
| 200 cairo_destroy(cr); | 200 cairo_destroy(cr); |
| 201 cairo_surface_destroy(surface); | 201 cairo_surface_destroy(surface); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void Canvas::DrawStringInt(const std::wstring& text, | 204 void Canvas::DrawStringInt(const std::wstring& text, |
| 205 const gfx::Font& font, | 205 const gfx::Font& font, |
| 206 const SkColor& color, | 206 const SkColor& color, |
| 207 int x, int y, int w, int h, | 207 int x, int y, int w, int h, |
| 208 int flags) { | 208 int flags) { |
| 209 if (w <= 0 || h <= 0) |
| 210 return; |
| 211 |
| 209 cairo_t* cr = beginPlatformPaint(); | 212 cairo_t* cr = beginPlatformPaint(); |
| 210 PangoLayout* layout = pango_cairo_create_layout(cr); | 213 PangoLayout* layout = pango_cairo_create_layout(cr); |
| 211 | 214 |
| 212 SetupPangoLayout(layout, font, w, flags); | 215 SetupPangoLayout(layout, font, w, flags); |
| 213 | 216 |
| 214 pango_layout_set_height(layout, h * PANGO_SCALE); | 217 pango_layout_set_height(layout, h * PANGO_SCALE); |
| 215 | 218 |
| 216 cairo_save(cr); | 219 cairo_save(cr); |
| 217 cairo_set_source_rgb(cr, | 220 cairo_set_source_rgb(cr, |
| 218 SkColorGetR(color) / 255.0, | 221 SkColorGetR(color) / 255.0, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 NOTREACHED(); | 261 NOTREACHED(); |
| 259 return; | 262 return; |
| 260 } | 263 } |
| 261 | 264 |
| 262 cairo_t* cr = beginPlatformPaint(); | 265 cairo_t* cr = beginPlatformPaint(); |
| 263 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); | 266 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); |
| 264 cairo_paint(cr); | 267 cairo_paint(cr); |
| 265 } | 268 } |
| 266 | 269 |
| 267 } // namespace gfx | 270 } // namespace gfx |
| OLD | NEW |