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/views/controls/table/table_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/table/table_view_views.h" 5 #include "ui/views/controls/table/table_view_views.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "ui/base/events/event.h" 8 #include "ui/base/events/event.h"
9 #include "ui/base/models/table_model.h" 9 #include "ui/base/models/table_model.h"
10 #include "ui/base/native_theme/native_theme.h" 10 #include "ui/base/native_theme/native_theme.h"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/image/image_skia.h" 12 #include "ui/gfx/image/image_skia.h"
13 #include "ui/gfx/rect_conversions.h"
13 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
14 #include "ui/views/border.h" 15 #include "ui/views/border.h"
15 #include "ui/views/controls/scroll_view.h" 16 #include "ui/views/controls/scroll_view.h"
16 #include "ui/views/controls/table/table_view_observer.h" 17 #include "ui/views/controls/table/table_view_observer.h"
17 18
18 // Padding around the text (on each side). 19 // Padding around the text (on each side).
19 static const int kTextVerticalPadding = 3; 20 static const int kTextVerticalPadding = 3;
20 static const int kTextHorizontalPadding = 2; 21 static const int kTextHorizontalPadding = 2;
21 22
22 // TODO: these should come from native theme or something. 23 // TODO: these should come from native theme or something.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Don't invoke View::OnPaint so that we can render our own focus border. 220 // Don't invoke View::OnPaint so that we can render our own focus border.
220 OnPaintBackground(canvas); 221 OnPaintBackground(canvas);
221 222
222 if (!RowCount()) 223 if (!RowCount())
223 return; 224 return;
224 225
225 int min_y, max_y; 226 int min_y, max_y;
226 { 227 {
227 SkRect sk_clip_rect; 228 SkRect sk_clip_rect;
228 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) { 229 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) {
229 gfx::Rect clip_rect = gfx::SkRectToRect(sk_clip_rect); 230 gfx::Rect clip_rect = gfx::ToFlooredRectDeprecated(
danakj 2012/11/01 17:38:27 This is iterating over rows that are contained in
231 gfx::SkRectToRectF(sk_clip_rect));
230 min_y = clip_rect.y(); 232 min_y = clip_rect.y();
231 max_y = clip_rect.bottom(); 233 max_y = clip_rect.bottom();
232 } else { 234 } else {
233 gfx::Rect vis_bounds = GetVisibleBounds(); 235 gfx::Rect vis_bounds = GetVisibleBounds();
234 min_y = vis_bounds.y(); 236 min_y = vis_bounds.y();
235 max_y = vis_bounds.bottom(); 237 max_y = vis_bounds.bottom();
236 } 238 }
237 } 239 }
238 240
239 int min_row = std::min(RowCount() - 1, std::max(0, min_y / row_height_)); 241 int min_row = std::min(RowCount() - 1, std::max(0, min_y / row_height_));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void TableView::NumRowsChanged() { 284 void TableView::NumRowsChanged() {
283 PreferredSizeChanged(); 285 PreferredSizeChanged();
284 SchedulePaint(); 286 SchedulePaint();
285 } 287 }
286 288
287 gfx::Rect TableView::GetRowBounds(int row) { 289 gfx::Rect TableView::GetRowBounds(int row) {
288 return gfx::Rect(0, row * row_height_, width(), row_height_); 290 return gfx::Rect(0, row * row_height_, width(), row_height_);
289 } 291 }
290 292
291 } // namespace views 293 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698