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

Side by Side Diff: ui/views/controls/table/table_view_views.cc

Issue 11359172: ui: Remove implicit flooring in skia rect conversion methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make root window transform in tests produce an integer result 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/transform.cc ('k') | ui/views/controls/tree/tree_view_views.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/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/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/image/image_skia.h" 11 #include "ui/gfx/image/image_skia.h"
12 #include "ui/gfx/rect_conversions.h"
12 #include "ui/gfx/skia_util.h" 13 #include "ui/gfx/skia_util.h"
13 #include "ui/views/controls/scroll_view.h" 14 #include "ui/views/controls/scroll_view.h"
14 #include "ui/views/controls/table/table_view_observer.h" 15 #include "ui/views/controls/table/table_view_observer.h"
15 16
16 // Padding around the text (on each side). 17 // Padding around the text (on each side).
17 static const int kTextVerticalPadding = 3; 18 static const int kTextVerticalPadding = 3;
18 static const int kTextHorizontalPadding = 2; 19 static const int kTextHorizontalPadding = 2;
19 20
20 // TODO: these should come from native theme or something. 21 // TODO: these should come from native theme or something.
21 static const SkColor kSelectedBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); 22 static const SkColor kSelectedBackgroundColor = SkColorSetRGB(0xEE, 0xEE, 0xEE);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Don't invoke View::OnPaint so that we can render our own focus border. 214 // Don't invoke View::OnPaint so that we can render our own focus border.
214 OnPaintBackground(canvas); 215 OnPaintBackground(canvas);
215 216
216 if (!RowCount()) 217 if (!RowCount())
217 return; 218 return;
218 219
219 int min_y, max_y; 220 int min_y, max_y;
220 { 221 {
221 SkRect sk_clip_rect; 222 SkRect sk_clip_rect;
222 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) { 223 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) {
223 gfx::Rect clip_rect = gfx::SkRectToRect(sk_clip_rect); 224 // Pixels partially inside the clip rect should be included.
225 gfx::Rect clip_rect = gfx::ToEnclosingRect(
226 gfx::SkRectToRectF(sk_clip_rect));
224 min_y = clip_rect.y(); 227 min_y = clip_rect.y();
225 max_y = clip_rect.bottom(); 228 max_y = clip_rect.bottom();
226 } else { 229 } else {
227 gfx::Rect vis_bounds = GetVisibleBounds(); 230 gfx::Rect vis_bounds = GetVisibleBounds();
228 min_y = vis_bounds.y(); 231 min_y = vis_bounds.y();
229 max_y = vis_bounds.bottom(); 232 max_y = vis_bounds.bottom();
230 } 233 }
231 } 234 }
232 235
233 int min_row = std::min(RowCount() - 1, std::max(0, min_y / row_height_)); 236 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
276 void TableView::NumRowsChanged() { 279 void TableView::NumRowsChanged() {
277 PreferredSizeChanged(); 280 PreferredSizeChanged();
278 SchedulePaint(); 281 SchedulePaint();
279 } 282 }
280 283
281 gfx::Rect TableView::GetRowBounds(int row) { 284 gfx::Rect TableView::GetRowBounds(int row) {
282 return gfx::Rect(0, row * row_height_, width(), row_height_); 285 return gfx::Rect(0, row * row_height_, width(), row_height_);
283 } 286 }
284 287
285 } // namespace views 288 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/transform.cc ('k') | ui/views/controls/tree/tree_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698