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

Side by Side Diff: chrome/views/table_view.cc

Issue 14079: Move skia_utils into the skia namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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 | « chrome/views/single_split_view.cc ('k') | chrome/views/text_field.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <algorithm> 5 #include <algorithm>
6 #include <windowsx.h> 6 #include <windowsx.h>
7 7
8 #include "chrome/views/table_view.h" 8 #include "chrome/views/table_view.h"
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 &background, 1199 &background,
1200 &logfont)) { 1200 &logfont)) {
1201 // TODO(tc): Creating/deleting a font for every cell seems like a 1201 // TODO(tc): Creating/deleting a font for every cell seems like a
1202 // waste if the font hasn't changed. Maybe we should use a struct 1202 // waste if the font hasn't changed. Maybe we should use a struct
1203 // with a bool like we do with colors? 1203 // with a bool like we do with colors?
1204 if (custom_cell_font_) 1204 if (custom_cell_font_)
1205 DeleteObject(custom_cell_font_); 1205 DeleteObject(custom_cell_font_);
1206 custom_cell_font_ = CreateFontIndirect(&logfont); 1206 custom_cell_font_ = CreateFontIndirect(&logfont);
1207 SelectObject(draw_info->nmcd.hdc, custom_cell_font_); 1207 SelectObject(draw_info->nmcd.hdc, custom_cell_font_);
1208 draw_info->clrText = foreground.color_is_set 1208 draw_info->clrText = foreground.color_is_set
1209 ? gfx::SkColorToCOLORREF(foreground.color) 1209 ? skia::SkColorToCOLORREF(foreground.color)
1210 : CLR_DEFAULT; 1210 : CLR_DEFAULT;
1211 draw_info->clrTextBk = background.color_is_set 1211 draw_info->clrTextBk = background.color_is_set
1212 ? gfx::SkColorToCOLORREF(background.color) 1212 ? skia::SkColorToCOLORREF(background.color)
1213 : CLR_DEFAULT; 1213 : CLR_DEFAULT;
1214 return CDRF_NEWFONT; 1214 return CDRF_NEWFONT;
1215 } 1215 }
1216 } 1216 }
1217 return CDRF_DODEFAULT; 1217 return CDRF_DODEFAULT;
1218 } 1218 }
1219 case CDDS_ITEMPOSTPAINT: { 1219 case CDDS_ITEMPOSTPAINT: {
1220 DCHECK((table_type_ == ICON_AND_TEXT) || (ImplementPostPaint())); 1220 DCHECK((table_type_ == ICON_AND_TEXT) || (ImplementPostPaint()));
1221 int view_index = static_cast<int>(draw_info->nmcd.dwItemSpec); 1221 int view_index = static_cast<int>(draw_info->nmcd.dwItemSpec);
1222 // We get notifications for empty items, just ignore them. 1222 // We get notifications for empty items, just ignore them.
(...skipping 29 matching lines...) Expand all
1252 else if (drop_highlight) 1252 else if (drop_highlight)
1253 bg_color_index = COLOR_HIGHLIGHT; 1253 bg_color_index = COLOR_HIGHLIGHT;
1254 else if (selected) 1254 else if (selected)
1255 bg_color_index = HasFocus() ? COLOR_HIGHLIGHT : COLOR_3DFACE; 1255 bg_color_index = HasFocus() ? COLOR_HIGHLIGHT : COLOR_3DFACE;
1256 else 1256 else
1257 bg_color_index = COLOR_WINDOW; 1257 bg_color_index = COLOR_WINDOW;
1258 // NOTE: This may be invoked without the ListView filling in the 1258 // NOTE: This may be invoked without the ListView filling in the
1259 // background (or rather windows paints background, then invokes 1259 // background (or rather windows paints background, then invokes
1260 // this twice). As such, we always fill in the background. 1260 // this twice). As such, we always fill in the background.
1261 canvas.drawColor( 1261 canvas.drawColor(
1262 gfx::COLORREFToSkColor(GetSysColor(bg_color_index)), 1262 skia::COLORREFToSkColor(GetSysColor(bg_color_index)),
1263 SkPorterDuff::kSrc_Mode); 1263 SkPorterDuff::kSrc_Mode);
1264 // + 1 for padding (we declared the image as 18x18 in the list- 1264 // + 1 for padding (we declared the image as 18x18 in the list-
1265 // view when they are 16x16 so we get an extra pixel of padding). 1265 // view when they are 16x16 so we get an extra pixel of padding).
1266 canvas.DrawBitmapInt(image, 0, 0, 1266 canvas.DrawBitmapInt(image, 0, 0,
1267 image.width(), image.height(), 1267 image.width(), image.height(),
1268 1, 1, kFavIconSize, kFavIconSize, true); 1268 1, 1, kFavIconSize, kFavIconSize, true);
1269 1269
1270 // Only paint the visible region of the icon. 1270 // Only paint the visible region of the icon.
1271 RECT to_draw = { intersection.left - icon_rect.left, 1271 RECT to_draw = { intersection.left - icon_rect.left,
1272 intersection.top - icon_rect.top, 1272 intersection.top - icon_rect.top,
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 } 1559 }
1560 1560
1561 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { 1561 void TableSelectionIterator::UpdateModelIndexFromViewIndex() {
1562 if (view_index_ == -1) 1562 if (view_index_ == -1)
1563 model_index_ = -1; 1563 model_index_ = -1;
1564 else 1564 else
1565 model_index_ = table_view_->view_to_model(view_index_); 1565 model_index_ = table_view_->view_to_model(view_index_);
1566 } 1566 }
1567 1567
1568 } // namespace views 1568 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/single_split_view.cc ('k') | chrome/views/text_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698