| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_text_linux.h" | 5 #include "ui/gfx/render_text_linux.h" |
| 6 | 6 |
| 7 #include <pango/pangocairo.h> | 7 #include <pango/pangocairo.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 EnsureLayout(); | 225 EnsureLayout(); |
| 226 int* ranges = NULL; | 226 int* ranges = NULL; |
| 227 int n_ranges = 0; | 227 int n_ranges = 0; |
| 228 pango_layout_line_get_x_ranges(current_line_, | 228 pango_layout_line_get_x_ranges(current_line_, |
| 229 TextIndexToLayoutIndex(range.GetMin()), | 229 TextIndexToLayoutIndex(range.GetMin()), |
| 230 TextIndexToLayoutIndex(range.GetMax()), | 230 TextIndexToLayoutIndex(range.GetMax()), |
| 231 &ranges, | 231 &ranges, |
| 232 &n_ranges); | 232 &n_ranges); |
| 233 | 233 |
| 234 int height = 0; | 234 const int height = GetStringSize().height(); |
| 235 pango_layout_get_pixel_size(layout_, NULL, &height); | |
| 236 | 235 |
| 237 std::vector<Rect> bounds; | 236 std::vector<Rect> bounds; |
| 238 for (int i = 0; i < n_ranges; ++i) { | 237 for (int i = 0; i < n_ranges; ++i) { |
| 239 // TODO(derat): Support fractional bounds for subpixel positioning? | 238 // TODO(derat): Support fractional bounds for subpixel positioning? |
| 240 int x = PANGO_PIXELS(ranges[2 * i]); | 239 int x = PANGO_PIXELS(ranges[2 * i]); |
| 241 int width = PANGO_PIXELS(ranges[2 * i + 1]) - x; | 240 int width = PANGO_PIXELS(ranges[2 * i + 1]) - x; |
| 242 Rect rect(x, 0, width, height); | 241 Rect rect(x, 0, width, height); |
| 243 rect.set_origin(ToViewPoint(rect.origin())); | 242 rect.set_origin(ToViewPoint(rect.origin())); |
| 244 bounds.push_back(rect); | 243 bounds.push_back(rect); |
| 245 } | 244 } |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 int glyph_index) const { | 500 int glyph_index) const { |
| 502 return LayoutIndexToTextIndex(run->item->offset + | 501 return LayoutIndexToTextIndex(run->item->offset + |
| 503 run->glyphs->log_clusters[glyph_index]); | 502 run->glyphs->log_clusters[glyph_index]); |
| 504 } | 503 } |
| 505 | 504 |
| 506 RenderText* RenderText::CreateInstance() { | 505 RenderText* RenderText::CreateInstance() { |
| 507 return new RenderTextLinux; | 506 return new RenderTextLinux; |
| 508 } | 507 } |
| 509 | 508 |
| 510 } // namespace gfx | 509 } // namespace gfx |
| OLD | NEW |