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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 pango_layout_get_context(layout), cairo_font_options); | 119 pango_layout_get_context(layout), cairo_font_options); |
120 | 120 |
121 // Callers of DrawStringInt handle RTL layout themselves, so tell pango to not | 121 // Callers of DrawStringInt handle RTL layout themselves, so tell pango to not |
122 // scope out RTL characters. | 122 // scope out RTL characters. |
123 pango_layout_set_auto_dir(layout, FALSE); | 123 pango_layout_set_auto_dir(layout, FALSE); |
124 | 124 |
125 if (width > 0) | 125 if (width > 0) |
126 pango_layout_set_width(layout, width * PANGO_SCALE); | 126 pango_layout_set_width(layout, width * PANGO_SCALE); |
127 | 127 |
128 if (flags & gfx::Canvas::TEXT_ALIGN_CENTER) { | 128 if (flags & gfx::Canvas::TEXT_ALIGN_CENTER) { |
| 129 // We don't support center aligned w/ eliding. |
| 130 DCHECK(gfx::Canvas::NO_ELLIPSIS); |
129 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); | 131 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); |
130 } else if (flags & gfx::Canvas::TEXT_ALIGN_RIGHT) { | 132 } else if (flags & gfx::Canvas::TEXT_ALIGN_RIGHT) { |
131 pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); | 133 pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); |
132 } | 134 } |
133 | 135 |
134 if (flags & gfx::Canvas::NO_ELLIPSIS) { | 136 if (flags & gfx::Canvas::NO_ELLIPSIS) { |
135 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); | 137 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); |
136 if (flags & gfx::Canvas::MULTI_LINE) { | 138 if (flags & gfx::Canvas::MULTI_LINE) { |
137 pango_layout_set_wrap(layout, | 139 pango_layout_set_wrap(layout, |
138 (flags & gfx::Canvas::CHARACTER_BREAK) ? | 140 (flags & gfx::Canvas::CHARACTER_BREAK) ? |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); | 492 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); |
491 cairo_paint(cr); | 493 cairo_paint(cr); |
492 } | 494 } |
493 | 495 |
494 ui::TextureID CanvasSkia::GetTextureID() { | 496 ui::TextureID CanvasSkia::GetTextureID() { |
495 // TODO(wjmaclean) | 497 // TODO(wjmaclean) |
496 return 0; | 498 return 0; |
497 } | 499 } |
498 | 500 |
499 } // namespace gfx | 501 } // namespace gfx |
OLD | NEW |