| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/canvas_skia.h" | 5 #include "ui/gfx/canvas_skia.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include <cairo/cairo.h> | 9 #include <cairo/cairo.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 pango_layout_get_context(layout), cairo_font_options); | 122 pango_layout_get_context(layout), cairo_font_options); |
| 123 | 123 |
| 124 // Callers of DrawStringInt handle RTL layout themselves, so tell pango to not | 124 // Callers of DrawStringInt handle RTL layout themselves, so tell pango to not |
| 125 // scope out RTL characters. | 125 // scope out RTL characters. |
| 126 pango_layout_set_auto_dir(layout, FALSE); | 126 pango_layout_set_auto_dir(layout, FALSE); |
| 127 | 127 |
| 128 if (width > 0) | 128 if (width > 0) |
| 129 pango_layout_set_width(layout, width * PANGO_SCALE); | 129 pango_layout_set_width(layout, width * PANGO_SCALE); |
| 130 | 130 |
| 131 if (flags & gfx::Canvas::TEXT_ALIGN_CENTER) { | 131 if (flags & gfx::Canvas::TEXT_ALIGN_CENTER) { |
| 132 // We don't support center aligned w/ eliding. |
| 133 DCHECK(gfx::Canvas::NO_ELLIPSIS); |
| 132 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); | 134 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); |
| 133 } else if (flags & gfx::Canvas::TEXT_ALIGN_RIGHT) { | 135 } else if (flags & gfx::Canvas::TEXT_ALIGN_RIGHT) { |
| 134 pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); | 136 pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); |
| 135 } | 137 } |
| 136 | 138 |
| 137 if (flags & gfx::Canvas::NO_ELLIPSIS) { | 139 if (flags & gfx::Canvas::NO_ELLIPSIS) { |
| 138 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); | 140 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); |
| 139 if (flags & gfx::Canvas::MULTI_LINE) { | 141 if (flags & gfx::Canvas::MULTI_LINE) { |
| 140 pango_layout_set_wrap(layout, | 142 pango_layout_set_wrap(layout, |
| 141 (flags & gfx::Canvas::CHARACTER_BREAK) ? | 143 (flags & gfx::Canvas::CHARACTER_BREAK) ? |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); | 495 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); |
| 494 cairo_paint(cr); | 496 cairo_paint(cr); |
| 495 } | 497 } |
| 496 | 498 |
| 497 ui::TextureID CanvasSkia::GetTextureID() { | 499 ui::TextureID CanvasSkia::GetTextureID() { |
| 498 // TODO(wjmaclean) | 500 // TODO(wjmaclean) |
| 499 return 0; | 501 return 0; |
| 500 } | 502 } |
| 501 | 503 |
| 502 } // namespace gfx | 504 } // namespace gfx |
| OLD | NEW |