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: chrome/views/table_view.cc

Issue 12842: Move convolver, image_operations, and skia_utils from base/gfx to skia/ext.... (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/tabbed_pane.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"
11 #include "base/win_util.h" 11 #include "base/win_util.h"
12 #include "base/gfx/skia_utils.h"
13 #include "chrome/common/gfx/chrome_canvas.h" 12 #include "chrome/common/gfx/chrome_canvas.h"
14 #include "chrome/common/gfx/favicon_size.h" 13 #include "chrome/common/gfx/favicon_size.h"
15 #include "chrome/common/gfx/icon_util.h" 14 #include "chrome/common/gfx/icon_util.h"
16 #include "chrome/common/resource_bundle.h" 15 #include "chrome/common/resource_bundle.h"
17 #include "chrome/common/win_util.h" 16 #include "chrome/common/win_util.h"
18 #include "chrome/views/hwnd_view.h" 17 #include "chrome/views/hwnd_view.h"
19 #include "SkBitmap.h" 18 #include "SkBitmap.h"
20 #include "SkColorFilter.h" 19 #include "SkColorFilter.h"
20 #include "skia/ext/skia_utils_win.h"
21 21
22 namespace views { 22 namespace views {
23 23
24 // Added to column width to prevent truncation. 24 // Added to column width to prevent truncation.
25 const int kListViewTextPadding = 15; 25 const int kListViewTextPadding = 15;
26 // Additional column width necessary if column has icons. 26 // Additional column width necessary if column has icons.
27 const int kListViewIconWidthAndPadding = 18; 27 const int kListViewIconWidthAndPadding = 18;
28 28
29 const int kImageSize = 18; 29 const int kImageSize = 18;
30 30
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 &background, 1168 &background,
1169 &logfont)) { 1169 &logfont)) {
1170 // TODO(tc): Creating/deleting a font for every cell seems like a 1170 // TODO(tc): Creating/deleting a font for every cell seems like a
1171 // waste if the font hasn't changed. Maybe we should use a struct 1171 // waste if the font hasn't changed. Maybe we should use a struct
1172 // with a bool like we do with colors? 1172 // with a bool like we do with colors?
1173 if (custom_cell_font_) 1173 if (custom_cell_font_)
1174 DeleteObject(custom_cell_font_); 1174 DeleteObject(custom_cell_font_);
1175 custom_cell_font_ = CreateFontIndirect(&logfont); 1175 custom_cell_font_ = CreateFontIndirect(&logfont);
1176 SelectObject(draw_info->nmcd.hdc, custom_cell_font_); 1176 SelectObject(draw_info->nmcd.hdc, custom_cell_font_);
1177 draw_info->clrText = foreground.color_is_set 1177 draw_info->clrText = foreground.color_is_set
1178 ? gfx::SkColorToCOLORREF(foreground.color) 1178 ? skia::SkColorToCOLORREF(foreground.color)
1179 : CLR_DEFAULT; 1179 : CLR_DEFAULT;
1180 draw_info->clrTextBk = background.color_is_set 1180 draw_info->clrTextBk = background.color_is_set
1181 ? gfx::SkColorToCOLORREF(background.color) 1181 ? skia::SkColorToCOLORREF(background.color)
1182 : CLR_DEFAULT; 1182 : CLR_DEFAULT;
1183 return CDRF_NEWFONT; 1183 return CDRF_NEWFONT;
1184 } 1184 }
1185 } 1185 }
1186 return CDRF_DODEFAULT; 1186 return CDRF_DODEFAULT;
1187 } 1187 }
1188 case CDDS_ITEMPOSTPAINT: { 1188 case CDDS_ITEMPOSTPAINT: {
1189 DCHECK((table_type_ == ICON_AND_TEXT) || (ImplementPostPaint())); 1189 DCHECK((table_type_ == ICON_AND_TEXT) || (ImplementPostPaint()));
1190 int view_index = static_cast<int>(draw_info->nmcd.dwItemSpec); 1190 int view_index = static_cast<int>(draw_info->nmcd.dwItemSpec);
1191 // We get notifications for empty items, just ignore them. 1191 // We get notifications for empty items, just ignore them.
(...skipping 29 matching lines...) Expand all
1221 else if (drop_highlight) 1221 else if (drop_highlight)
1222 bg_color_index = COLOR_HIGHLIGHT; 1222 bg_color_index = COLOR_HIGHLIGHT;
1223 else if (selected) 1223 else if (selected)
1224 bg_color_index = HasFocus() ? COLOR_HIGHLIGHT : COLOR_3DFACE; 1224 bg_color_index = HasFocus() ? COLOR_HIGHLIGHT : COLOR_3DFACE;
1225 else 1225 else
1226 bg_color_index = COLOR_WINDOW; 1226 bg_color_index = COLOR_WINDOW;
1227 // NOTE: This may be invoked without the ListView filling in the 1227 // NOTE: This may be invoked without the ListView filling in the
1228 // background (or rather windows paints background, then invokes 1228 // background (or rather windows paints background, then invokes
1229 // this twice). As such, we always fill in the background. 1229 // this twice). As such, we always fill in the background.
1230 canvas.drawColor( 1230 canvas.drawColor(
1231 gfx::COLORREFToSkColor(GetSysColor(bg_color_index)), 1231 skia::COLORREFToSkColor(GetSysColor(bg_color_index)),
1232 SkPorterDuff::kSrc_Mode); 1232 SkPorterDuff::kSrc_Mode);
1233 // + 1 for padding (we declared the image as 18x18 in the list- 1233 // + 1 for padding (we declared the image as 18x18 in the list-
1234 // view when they are 16x16 so we get an extra pixel of padding). 1234 // view when they are 16x16 so we get an extra pixel of padding).
1235 canvas.DrawBitmapInt(image, 0, 0, 1235 canvas.DrawBitmapInt(image, 0, 0,
1236 image.width(), image.height(), 1236 image.width(), image.height(),
1237 1, 1, kFavIconSize, kFavIconSize, true); 1237 1, 1, kFavIconSize, kFavIconSize, true);
1238 1238
1239 // Only paint the visible region of the icon. 1239 // Only paint the visible region of the icon.
1240 RECT to_draw = { intersection.left - icon_rect.left, 1240 RECT to_draw = { intersection.left - icon_rect.left,
1241 intersection.top - icon_rect.top, 1241 intersection.top - icon_rect.top,
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 } 1528 }
1529 1529
1530 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { 1530 void TableSelectionIterator::UpdateModelIndexFromViewIndex() {
1531 if (view_index_ == -1) 1531 if (view_index_ == -1)
1532 model_index_ = -1; 1532 model_index_ = -1;
1533 else 1533 else
1534 model_index_ = table_view_->view_to_model(view_index_); 1534 model_index_ = table_view_->view_to_model(view_index_);
1535 } 1535 }
1536 1536
1537 } // namespace views 1537 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/tabbed_pane.cc ('k') | chrome/views/text_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698