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

Side by Side Diff: chrome/browser/views/bookmark_table_view.cc

Issue 113443: ChromeCanvas->gfx::Canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months 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
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 "chrome/browser/views/bookmark_table_view.h" 5 #include "chrome/browser/views/bookmark_table_view.h"
6 6
7 #include <commctrl.h> 7 #include <commctrl.h>
8 8
9 #include "app/drag_drop_types.h" 9 #include "app/drag_drop_types.h"
10 #include "app/gfx/chrome_canvas.h" 10 #include "app/gfx/canvas.h"
11 #include "app/gfx/chrome_font.h" 11 #include "app/gfx/font.h"
12 #include "app/os_exchange_data.h" 12 #include "app/os_exchange_data.h"
13 #include "app/resource_bundle.h" 13 #include "app/resource_bundle.h"
14 #include "base/base_drag_source.h" 14 #include "base/base_drag_source.h"
15 #include "chrome/browser/bookmarks/bookmark_utils.h" 15 #include "chrome/browser/bookmarks/bookmark_utils.h"
16 #include "chrome/browser/bookmarks/bookmark_model.h" 16 #include "chrome/browser/bookmarks/bookmark_model.h"
17 #include "chrome/browser/bookmarks/bookmark_table_model.h" 17 #include "chrome/browser/bookmarks/bookmark_table_model.h"
18 #include "chrome/browser/profile.h" 18 #include "chrome/browser/profile.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/pref_service.h" 20 #include "chrome/common/pref_service.h"
21 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 OnModelChanged(); 413 OnModelChanged();
414 } 414 }
415 415
416 void BookmarkTableView::PaintAltText() { 416 void BookmarkTableView::PaintAltText() {
417 if (alt_text_.empty()) 417 if (alt_text_.empty())
418 return; 418 return;
419 419
420 HDC dc = GetDC(GetNativeControlHWND()); 420 HDC dc = GetDC(GetNativeControlHWND());
421 gfx::Font font = GetAltTextFont(); 421 gfx::Font font = GetAltTextFont();
422 gfx::Rect bounds = GetAltTextBounds(); 422 gfx::Rect bounds = GetAltTextBounds();
423 ChromeCanvas canvas(bounds.width(), bounds.height(), false); 423 gfx::Canvas canvas(bounds.width(), bounds.height(), false);
424 // Pad by 1 for halo. 424 // Pad by 1 for halo.
425 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, 425 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1,
426 1, bounds.width() - 2, bounds.height() - 2, 426 1, bounds.width() - 2, bounds.height() - 2,
427 l10n_util::DefaultCanvasTextAlignment()); 427 l10n_util::DefaultCanvasTextAlignment());
428 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); 428 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL);
429 ReleaseDC(GetNativeControlHWND(), dc); 429 ReleaseDC(GetNativeControlHWND(), dc);
430 } 430 }
431 431
432 gfx::Rect BookmarkTableView::GetAltTextBounds() { 432 gfx::Rect BookmarkTableView::GetAltTextBounds() {
433 static const int kXOffset = 16; 433 static const int kXOffset = 16;
434 DCHECK(GetNativeControlHWND()); 434 DCHECK(GetNativeControlHWND());
435 RECT client_rect_rect; 435 RECT client_rect_rect;
436 GetClientRect(GetNativeControlHWND(), &client_rect_rect); 436 GetClientRect(GetNativeControlHWND(), &client_rect_rect);
437 gfx::Rect client_rect(client_rect_rect); 437 gfx::Rect client_rect(client_rect_rect);
438 gfx::Font font = GetAltTextFont(); 438 gfx::Font font = GetAltTextFont();
439 // Pad height by 2 for halo. 439 // Pad height by 2 for halo.
440 return gfx::Rect(kXOffset, content_offset(), client_rect.width() - kXOffset, 440 return gfx::Rect(kXOffset, content_offset(), client_rect.width() - kXOffset,
441 std::max(kImageSize, font.height() + 2)); 441 std::max(kImageSize, font.height() + 2));
442 } 442 }
443 443
444 gfx::Font BookmarkTableView::GetAltTextFont() { 444 gfx::Font BookmarkTableView::GetAltTextFont() {
445 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); 445 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
446 } 446 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_manager_view.cc ('k') | chrome/browser/views/constrained_window_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698