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.h" | 5 #include "ui/gfx/render_text.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/break_iterator.h" | 10 #include "base/i18n/break_iterator.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 paint_.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 178 paint_.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
179 paint_.setStyle(SkPaint::kFill_Style); | 179 paint_.setStyle(SkPaint::kFill_Style); |
180 paint_.setAntiAlias(true); | 180 paint_.setAntiAlias(true); |
181 paint_.setSubpixelText(true); | 181 paint_.setSubpixelText(true); |
182 paint_.setLCDRenderText(true); | 182 paint_.setLCDRenderText(true); |
183 } | 183 } |
184 | 184 |
185 SkiaTextRenderer::~SkiaTextRenderer() { | 185 SkiaTextRenderer::~SkiaTextRenderer() { |
186 } | 186 } |
187 | 187 |
| 188 void SkiaTextRenderer::SetFontSmoothingSettings(bool enable_smoothing, |
| 189 bool enable_lcd_text) { |
| 190 paint_.setAntiAlias(enable_smoothing); |
| 191 paint_.setSubpixelText(enable_smoothing); |
| 192 paint_.setLCDRenderText(enable_lcd_text); |
| 193 } |
| 194 |
188 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) { | 195 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) { |
189 paint_.setTypeface(typeface); | 196 paint_.setTypeface(typeface); |
190 } | 197 } |
191 | 198 |
192 void SkiaTextRenderer::SetTextSize(int size) { | 199 void SkiaTextRenderer::SetTextSize(int size) { |
193 paint_.setTextSize(size); | 200 paint_.setTextSize(size); |
194 } | 201 } |
195 | 202 |
196 void SkiaTextRenderer::SetFontStyle(int style) { | 203 void SkiaTextRenderer::SetFontStyle(int style) { |
197 SkTypeface::Style skia_style = ConvertFontStyleToSkiaTypefaceStyle(style); | 204 SkTypeface::Style skia_style = ConvertFontStyleToSkiaTypefaceStyle(style); |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 if (cursor_enabled() && cursor_visible() && focused()) { | 859 if (cursor_enabled() && cursor_visible() && focused()) { |
853 const Rect& bounds = GetUpdatedCursorBounds(); | 860 const Rect& bounds = GetUpdatedCursorBounds(); |
854 if (bounds.width() != 0) | 861 if (bounds.width() != 0) |
855 canvas->FillRect(bounds, kCursorColor); | 862 canvas->FillRect(bounds, kCursorColor); |
856 else | 863 else |
857 canvas->DrawRect(bounds, kCursorColor); | 864 canvas->DrawRect(bounds, kCursorColor); |
858 } | 865 } |
859 } | 866 } |
860 | 867 |
861 } // namespace gfx | 868 } // namespace gfx |
OLD | NEW |