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

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

Issue 9021046: Pass const gfx::Rect& as the first parameter to FillRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more fix Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/compositor/layer_unittest.cc ('k') | ui/views/border.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.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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 } 836 }
837 837
838 void RenderText::DrawSelection(Canvas* canvas) { 838 void RenderText::DrawSelection(Canvas* canvas) {
839 std::vector<Rect> sel = GetSubstringBounds( 839 std::vector<Rect> sel = GetSubstringBounds(
840 GetSelectionStart(), GetCursorPosition()); 840 GetSelectionStart(), GetCursorPosition());
841 NativeTheme::ColorId color_id = focused() ? 841 NativeTheme::ColorId color_id = focused() ?
842 NativeTheme::kColorId_TextfieldSelectionBackgroundFocused : 842 NativeTheme::kColorId_TextfieldSelectionBackgroundFocused :
843 NativeTheme::kColorId_TextfieldSelectionBackgroundUnfocused; 843 NativeTheme::kColorId_TextfieldSelectionBackgroundUnfocused;
844 SkColor color = NativeTheme::instance()->GetSystemColor(color_id); 844 SkColor color = NativeTheme::instance()->GetSystemColor(color_id);
845 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) 845 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i)
846 canvas->FillRect(color, *i); 846 canvas->FillRect(*i, color);
847 } 847 }
848 848
849 void RenderText::DrawCursor(Canvas* canvas) { 849 void RenderText::DrawCursor(Canvas* canvas) {
850 // Paint cursor. Replace cursor is drawn as rectangle for now. 850 // Paint cursor. Replace cursor is drawn as rectangle for now.
851 // TODO(msw): Draw a better cursor with a better indication of association. 851 // TODO(msw): Draw a better cursor with a better indication of association.
852 if (cursor_enabled() && cursor_visible() && focused()) { 852 if (cursor_enabled() && cursor_visible() && focused()) {
853 const Rect& bounds = GetUpdatedCursorBounds(); 853 const Rect& bounds = GetUpdatedCursorBounds();
854 if (bounds.width() != 0) 854 if (bounds.width() != 0)
855 canvas->FillRect(kCursorColor, bounds); 855 canvas->FillRect(bounds, kCursorColor);
856 else 856 else
857 canvas->DrawRect(bounds, kCursorColor); 857 canvas->DrawRect(bounds, kCursorColor);
858 } 858 }
859 } 859 }
860 860
861 } // namespace gfx 861 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/compositor/layer_unittest.cc ('k') | ui/views/border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698