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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 DCHECK(italic == styles()[ITALIC].breaks().end()); | 369 DCHECK(italic == styles()[ITALIC].breaks().end()); |
370 | 370 |
371 pango_layout_set_attributes(layout, attrs); | 371 pango_layout_set_attributes(layout, attrs); |
372 pango_attr_list_unref(attrs); | 372 pango_attr_list_unref(attrs); |
373 } | 373 } |
374 | 374 |
375 void RenderTextLinux::DrawVisualText(Canvas* canvas) { | 375 void RenderTextLinux::DrawVisualText(Canvas* canvas) { |
376 DCHECK(layout_); | 376 DCHECK(layout_); |
377 | 377 |
378 // Skia will draw glyphs with respect to the baseline. | 378 // Skia will draw glyphs with respect to the baseline. |
379 Vector2d offset(GetTextOffset() + Vector2d(0, GetBaseline())); | 379 Vector2d offset(GetLineOffset(0) + Vector2d(0, GetBaseline())); |
380 | 380 |
381 SkScalar x = SkIntToScalar(offset.x()); | 381 SkScalar x = SkIntToScalar(offset.x()); |
382 SkScalar y = SkIntToScalar(offset.y()); | 382 SkScalar y = SkIntToScalar(offset.y()); |
383 | 383 |
384 std::vector<SkPoint> pos; | 384 std::vector<SkPoint> pos; |
385 std::vector<uint16> glyphs; | 385 std::vector<uint16> glyphs; |
386 | 386 |
387 internal::SkiaTextRenderer renderer(canvas); | 387 internal::SkiaTextRenderer renderer(canvas); |
388 ApplyFadeEffects(&renderer); | 388 ApplyFadeEffects(&renderer); |
389 ApplyTextShadows(&renderer); | 389 ApplyTextShadows(&renderer); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 int glyph_index) const { | 504 int glyph_index) const { |
505 return LayoutIndexToTextIndex(run->item->offset + | 505 return LayoutIndexToTextIndex(run->item->offset + |
506 run->glyphs->log_clusters[glyph_index]); | 506 run->glyphs->log_clusters[glyph_index]); |
507 } | 507 } |
508 | 508 |
509 RenderText* RenderText::CreateInstance() { | 509 RenderText* RenderText::CreateInstance() { |
510 return new RenderTextLinux; | 510 return new RenderTextLinux; |
511 } | 511 } |
512 | 512 |
513 } // namespace gfx | 513 } // namespace gfx |
OLD | NEW |