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

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

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 years, 1 month 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/gfx/render_text_win.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 canvas->ClipRect(display_rect_); 344 canvas->ClipRect(display_rect_);
345 345
346 // Draw the selection. 346 // Draw the selection.
347 std::vector<Rect> selection(GetSubstringBounds(GetSelectionStart(), 347 std::vector<Rect> selection(GetSubstringBounds(GetSelectionStart(),
348 GetCursorPosition())); 348 GetCursorPosition()));
349 SkColor selection_color = 349 SkColor selection_color =
350 focused() ? kFocusedSelectionColor : kUnfocusedSelectionColor; 350 focused() ? kFocusedSelectionColor : kUnfocusedSelectionColor;
351 for (std::vector<Rect>::const_iterator i = selection.begin(); 351 for (std::vector<Rect>::const_iterator i = selection.begin();
352 i < selection.end(); ++i) { 352 i < selection.end(); ++i) {
353 Rect r(*i); 353 Rect r(*i);
354 canvas->FillRectInt(selection_color, r.x(), r.y(), r.width(), r.height()); 354 canvas->FillRect(selection_color, r);
355 } 355 }
356 356
357 // Create a temporary copy of the style ranges for composition and selection. 357 // Create a temporary copy of the style ranges for composition and selection.
358 StyleRanges style_ranges(style_ranges_); 358 StyleRanges style_ranges(style_ranges_);
359 ApplyCompositionAndSelectionStyles(&style_ranges); 359 ApplyCompositionAndSelectionStyles(&style_ranges);
360 360
361 // Draw the text. 361 // Draw the text.
362 Rect bounds(display_rect_); 362 Rect bounds(display_rect_);
363 bounds.Offset(GetUpdatedDisplayOffset()); 363 bounds.Offset(GetUpdatedDisplayOffset());
364 for (StyleRanges::const_iterator i = style_ranges.begin(); 364 for (StyleRanges::const_iterator i = style_ranges.begin();
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 // LTR character. 653 // LTR character.
654 // 654 //
655 // Pan to show the cursor when it overflows to the left. 655 // Pan to show the cursor when it overflows to the left.
656 delta_offset = display_rect_.x() - cursor_bounds_.x(); 656 delta_offset = display_rect_.x() - cursor_bounds_.x();
657 } 657 }
658 display_offset_.Offset(delta_offset, 0); 658 display_offset_.Offset(delta_offset, 0);
659 cursor_bounds_.Offset(delta_offset, 0); 659 cursor_bounds_.Offset(delta_offset, 0);
660 } 660 }
661 661
662 } // namespace gfx 662 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/compositor/layer_unittest.cc ('k') | ui/gfx/render_text_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698