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

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

Issue 941523002: Rename: background_is_transparent -> subpixel_rendering_enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 199
200 SkiaTextRenderer::~SkiaTextRenderer() { 200 SkiaTextRenderer::~SkiaTextRenderer() {
201 } 201 }
202 202
203 void SkiaTextRenderer::SetDrawLooper(SkDrawLooper* draw_looper) { 203 void SkiaTextRenderer::SetDrawLooper(SkDrawLooper* draw_looper) {
204 paint_.setLooper(draw_looper); 204 paint_.setLooper(draw_looper);
205 } 205 }
206 206
207 void SkiaTextRenderer::SetFontRenderParams(const FontRenderParams& params, 207 void SkiaTextRenderer::SetFontRenderParams(const FontRenderParams& params,
208 bool background_is_transparent) { 208 bool subpixel_rendering_enabled) {
209 ApplyRenderParams(params, background_is_transparent, &paint_); 209 ApplyRenderParams(params, subpixel_rendering_enabled, &paint_);
210 } 210 }
211 211
212 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) { 212 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) {
213 paint_.setTypeface(typeface); 213 paint_.setTypeface(typeface);
214 } 214 }
215 215
216 void SkiaTextRenderer::SetTextSize(SkScalar size) { 216 void SkiaTextRenderer::SetTextSize(SkScalar size) {
217 paint_.setTextSize(size); 217 paint_.setTextSize(size);
218 } 218 }
219 219
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 Line::~Line() {} 382 Line::~Line() {}
383 383
384 skia::RefPtr<SkTypeface> CreateSkiaTypeface(const std::string& family, 384 skia::RefPtr<SkTypeface> CreateSkiaTypeface(const std::string& family,
385 int style) { 385 int style) {
386 SkTypeface::Style skia_style = ConvertFontStyleToSkiaTypefaceStyle(style); 386 SkTypeface::Style skia_style = ConvertFontStyleToSkiaTypefaceStyle(style);
387 return skia::AdoptRef(SkTypeface::CreateFromName(family.c_str(), skia_style)); 387 return skia::AdoptRef(SkTypeface::CreateFromName(family.c_str(), skia_style));
388 } 388 }
389 389
390 void ApplyRenderParams(const FontRenderParams& params, 390 void ApplyRenderParams(const FontRenderParams& params,
391 bool background_is_transparent, 391 bool subpixel_rendering_enabled,
392 SkPaint* paint) { 392 SkPaint* paint) {
393 paint->setAntiAlias(params.antialiasing); 393 paint->setAntiAlias(params.antialiasing);
394 paint->setLCDRenderText(!background_is_transparent && 394 paint->setLCDRenderText(subpixel_rendering_enabled &&
395 params.subpixel_rendering != FontRenderParams::SUBPIXEL_RENDERING_NONE); 395 params.subpixel_rendering != FontRenderParams::SUBPIXEL_RENDERING_NONE);
396 paint->setSubpixelText(params.subpixel_positioning); 396 paint->setSubpixelText(params.subpixel_positioning);
397 paint->setAutohinted(params.autohinter); 397 paint->setAutohinted(params.autohinter);
398 paint->setHinting(FontRenderParamsHintingToSkPaintHinting(params.hinting)); 398 paint->setHinting(FontRenderParamsHintingToSkPaintHinting(params.hinting));
399 } 399 }
400 400
401 } // namespace internal 401 } // namespace internal
402 402
403 RenderText::~RenderText() { 403 RenderText::~RenderText() {
404 } 404 }
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 colors_(kDefaultColor), 913 colors_(kDefaultColor),
914 styles_(NUM_TEXT_STYLES), 914 styles_(NUM_TEXT_STYLES),
915 composition_and_selection_styles_applied_(false), 915 composition_and_selection_styles_applied_(false),
916 obscured_(false), 916 obscured_(false),
917 obscured_reveal_index_(-1), 917 obscured_reveal_index_(-1),
918 truncate_length_(0), 918 truncate_length_(0),
919 elide_behavior_(NO_ELIDE), 919 elide_behavior_(NO_ELIDE),
920 text_elided_(false), 920 text_elided_(false),
921 min_line_height_(0), 921 min_line_height_(0),
922 multiline_(false), 922 multiline_(false),
923 background_is_transparent_(false), 923 subpixel_rendering_enabled_(true),
924 clip_to_display_rect_(true), 924 clip_to_display_rect_(true),
925 baseline_(kInvalidBaseline), 925 baseline_(kInvalidBaseline),
926 cached_bounds_and_offset_valid_(false) { 926 cached_bounds_and_offset_valid_(false) {
927 } 927 }
928 928
929 SelectionModel RenderText::GetAdjacentSelectionModel( 929 SelectionModel RenderText::GetAdjacentSelectionModel(
930 const SelectionModel& current, 930 const SelectionModel& current,
931 BreakType break_type, 931 BreakType break_type,
932 VisualCursorDirection direction) { 932 VisualCursorDirection direction) {
933 EnsureLayout(); 933 EnsureLayout();
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 1457
1458 SetDisplayOffset(display_offset_.x() + delta_x); 1458 SetDisplayOffset(display_offset_.x() + delta_x);
1459 } 1459 }
1460 1460
1461 void RenderText::DrawSelection(Canvas* canvas) { 1461 void RenderText::DrawSelection(Canvas* canvas) {
1462 for (const Rect& s : GetSubstringBounds(selection())) 1462 for (const Rect& s : GetSubstringBounds(selection()))
1463 canvas->FillRect(s, selection_background_focused_color_); 1463 canvas->FillRect(s, selection_background_focused_color_);
1464 } 1464 }
1465 1465
1466 } // namespace gfx 1466 } // namespace gfx
OLDNEW
« ui/gfx/render_text.h ('K') | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698