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/i18n/break_iterator.h" | 9 #include "base/i18n/break_iterator.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // to a layer and restore it faded by drawing a rect in kDstIn_Mode mode. | 217 // to a layer and restore it faded by drawing a rect in kDstIn_Mode mode. |
218 // | 218 // |
219 // Skip this when there is a looper which seems not working well with | 219 // Skip this when there is a looper which seems not working well with |
220 // deferred paint. Currently a looper is only used for text shadows. | 220 // deferred paint. Currently a looper is only used for text shadows. |
221 // | 221 // |
222 // TODO(asvitkine): Remove this work-around once the Skia bug is fixed. | 222 // TODO(asvitkine): Remove this work-around once the Skia bug is fixed. |
223 // http://code.google.com/p/skia/issues/detail?id=590 | 223 // http://code.google.com/p/skia/issues/detail?id=590 |
224 if (!paint_.isLCDRenderText() && | 224 if (!paint_.isLCDRenderText() && |
225 paint_.getShader() && | 225 paint_.getShader() && |
226 !paint_.getLooper()) { | 226 !paint_.getLooper()) { |
227 deferred_fade_shader_ = paint_.getShader(); | 227 deferred_fade_shader_ = skia::SharePtr(paint_.getShader()); |
228 paint_.setShader(NULL); | 228 paint_.setShader(NULL); |
229 canvas_skia_->saveLayer(&bounds_, NULL); | 229 canvas_skia_->saveLayer(&bounds_, NULL); |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 const size_t byte_length = glyph_count * sizeof(glyphs[0]); | 233 const size_t byte_length = glyph_count * sizeof(glyphs[0]); |
234 canvas_skia_->drawPosText(&glyphs[0], byte_length, &pos[0], paint_); | 234 canvas_skia_->drawPosText(&glyphs[0], byte_length, &pos[0], paint_); |
235 } | 235 } |
236 | 236 |
237 void SkiaTextRenderer::DrawDecorations(int x, int y, int width, bool underline, | 237 void SkiaTextRenderer::DrawDecorations(int x, int y, int width, bool underline, |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 | 969 |
970 void RenderText::DrawSelection(Canvas* canvas) { | 970 void RenderText::DrawSelection(Canvas* canvas) { |
971 const SkColor color = focused() ? selection_background_focused_color_ : | 971 const SkColor color = focused() ? selection_background_focused_color_ : |
972 selection_background_unfocused_color_; | 972 selection_background_unfocused_color_; |
973 const std::vector<Rect> sel = GetSubstringBounds(selection()); | 973 const std::vector<Rect> sel = GetSubstringBounds(selection()); |
974 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) | 974 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) |
975 canvas->FillRect(*i, color); | 975 canvas->FillRect(*i, color); |
976 } | 976 } |
977 | 977 |
978 } // namespace gfx | 978 } // namespace gfx |
OLD | NEW |