Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: ui/gfx/render_text_linux.cc

Issue 16867016: Windows implementation of multiline RenderText (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: min height/baseline; update tests Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698