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

Side by Side Diff: ui/views/controls/tree/tree_view_views.cc

Issue 11275089: SkRect to gfx::Rect type conversions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove unnecessary lines Created 8 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
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/views/controls/tree/tree_view_views.h" 5 #include "ui/views/controls/tree/tree_view_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "ui/base/accessibility/accessible_view_state.h" 12 #include "ui/base/accessibility/accessible_view_state.h"
13 #include "ui/base/events/event.h" 13 #include "ui/base/events/event.h"
14 #include "ui/base/keycodes/keyboard_codes.h" 14 #include "ui/base/keycodes/keyboard_codes.h"
15 #include "ui/base/native_theme/native_theme.h" 15 #include "ui/base/native_theme/native_theme.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/canvas.h" 17 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/image/image.h" 18 #include "ui/gfx/image/image.h"
19 #include "ui/gfx/rect_conversions.h"
19 #include "ui/gfx/skia_util.h" 20 #include "ui/gfx/skia_util.h"
20 #include "ui/views/background.h" 21 #include "ui/views/background.h"
21 #include "ui/views/border.h" 22 #include "ui/views/border.h"
22 #include "ui/views/controls/scroll_view.h" 23 #include "ui/views/controls/scroll_view.h"
23 #include "ui/views/controls/textfield/textfield.h" 24 #include "ui/views/controls/textfield/textfield.h"
24 #include "ui/views/controls/tree/tree_view_controller.h" 25 #include "ui/views/controls/tree/tree_view_controller.h"
25 26
26 using ui::TreeModel; 27 using ui::TreeModel;
27 using ui::TreeModelNode; 28 using ui::TreeModelNode;
28 29
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 511 }
511 512
512 void TreeView::OnPaint(gfx::Canvas* canvas) { 513 void TreeView::OnPaint(gfx::Canvas* canvas) {
513 // Don't invoke View::OnPaint so that we can render our own focus border. 514 // Don't invoke View::OnPaint so that we can render our own focus border.
514 OnPaintBackground(canvas); 515 OnPaintBackground(canvas);
515 516
516 int min_y, max_y; 517 int min_y, max_y;
517 { 518 {
518 SkRect sk_clip_rect; 519 SkRect sk_clip_rect;
519 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) { 520 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) {
520 gfx::Rect clip_rect = gfx::SkRectToRect(sk_clip_rect); 521 gfx::Rect clip_rect = gfx::ToFlooredRectDeprecated(
522 gfx::SkRectToRectF(sk_clip_rect));
sky 2012/11/01 16:10:24 Why does this need to use RectF and then floor it?
danakj 2012/11/01 17:38:27 This is trying to paint everything touched by the
danakj 2012/11/01 17:48:28 The clip rect given by skia is a float rect, but w
danakj 2012/11/01 17:50:18 I guess my question is why we use getClipBounds()
521 min_y = clip_rect.y(); 523 min_y = clip_rect.y();
522 max_y = clip_rect.bottom(); 524 max_y = clip_rect.bottom();
523 } else { 525 } else {
524 gfx::Rect vis_bounds = GetVisibleBounds(); 526 gfx::Rect vis_bounds = GetVisibleBounds();
525 min_y = vis_bounds.y(); 527 min_y = vis_bounds.y();
526 max_y = vis_bounds.bottom(); 528 max_y = vis_bounds.bottom();
527 } 529 }
528 } 530 }
529 531
530 int min_row = std::max(0, (min_y - kVerticalInset) / row_height_); 532 int min_row = std::max(0, (min_y - kVerticalInset) / row_height_);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 if (!is_expanded_) 904 if (!is_expanded_)
903 return max_width; 905 return max_width;
904 for (int i = 0; i < child_count(); ++i) { 906 for (int i = 0; i < child_count(); ++i) {
905 max_width = std::max(max_width, 907 max_width = std::max(max_width,
906 GetChild(i)->GetMaxWidth(indent, depth + 1)); 908 GetChild(i)->GetMaxWidth(indent, depth + 1));
907 } 909 }
908 return max_width; 910 return max_width;
909 } 911 }
910 912
911 } // namespace views 913 } // namespace views
OLDNEW
« ui/views/controls/table/table_view_views.cc ('K') | « ui/views/controls/table/table_view_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698