| 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 #include <climits> | 8 #include <climits> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 paint_.setXfermodeMode(SkXfermode::kDstIn_Mode); | 191 paint_.setXfermodeMode(SkXfermode::kDstIn_Mode); |
| 192 canvas_skia_->drawRect(bounds_, paint_); | 192 canvas_skia_->drawRect(bounds_, paint_); |
| 193 canvas_skia_->restore(); | 193 canvas_skia_->restore(); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 void SkiaTextRenderer::SetDrawLooper(SkDrawLooper* draw_looper) { | 197 void SkiaTextRenderer::SetDrawLooper(SkDrawLooper* draw_looper) { |
| 198 paint_.setLooper(draw_looper); | 198 paint_.setLooper(draw_looper); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void SkiaTextRenderer::SetFontSmoothingSettings(bool antialiasing, | 201 void SkiaTextRenderer::SetFontRenderParams(const FontRenderParams& params, |
| 202 bool subpixel_rendering, | 202 bool background_is_transparent) { |
| 203 bool subpixel_positioning) { | 203 paint_.setAntiAlias(params.antialiasing); |
| 204 paint_.setAntiAlias(antialiasing); | 204 paint_.setLCDRenderText(!background_is_transparent && |
| 205 paint_.setLCDRenderText(subpixel_rendering); | 205 params.subpixel_rendering != FontRenderParams::SUBPIXEL_RENDERING_NONE); |
| 206 paint_.setSubpixelText(subpixel_positioning); | 206 paint_.setSubpixelText(params.subpixel_positioning); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void SkiaTextRenderer::SetFontHinting(SkPaint::Hinting hinting) { | 209 void SkiaTextRenderer::SetFontHinting(SkPaint::Hinting hinting) { |
| 210 paint_.setHinting(hinting); | 210 paint_.setHinting(hinting); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) { | 213 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) { |
| 214 paint_.setTypeface(typeface); | 214 paint_.setTypeface(typeface); |
| 215 } | 215 } |
| 216 | 216 |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 cursor_bounds_ += delta_offset; | 1315 cursor_bounds_ += delta_offset; |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 void RenderText::DrawSelection(Canvas* canvas) { | 1318 void RenderText::DrawSelection(Canvas* canvas) { |
| 1319 const std::vector<Rect> sel = GetSubstringBounds(selection()); | 1319 const std::vector<Rect> sel = GetSubstringBounds(selection()); |
| 1320 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) | 1320 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) |
| 1321 canvas->FillRect(*i, selection_background_focused_color_); | 1321 canvas->FillRect(*i, selection_background_focused_color_); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 } // namespace gfx | 1324 } // namespace gfx |
| OLD | NEW |