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

Unified Diff: chrome/browser/views/browser_actions_container.cc

Issue 2862025: Canvas refactoring part 2.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/browser_actions_container.cc
===================================================================
--- chrome/browser/views/browser_actions_container.cc (revision 50452)
+++ chrome/browser/views/browser_actions_container.cc (working copy)
@@ -31,6 +31,7 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -315,20 +316,22 @@
button_->Destroy();
}
-gfx::Canvas* BrowserActionView::GetIconWithBadge() {
+gfx::CanvasSkia* BrowserActionView::GetIconWithBadge() {
int tab_id = panel_->GetCurrentTabId();
SkBitmap icon = button_->extension()->browser_action()->GetIcon(tab_id);
if (icon.isNull())
icon = button_->default_icon();
- gfx::Canvas* canvas = new gfx::Canvas(icon.width(), icon.height(), false);
+ gfx::CanvasSkia* canvas =
+ new gfx::CanvasSkia(icon.width(), icon.height(), false);
canvas->DrawBitmapInt(icon, 0, 0);
if (tab_id >= 0) {
gfx::Rect bounds =
gfx::Rect(icon.width(), icon.height() + kControlVertOffset);
- button_->extension()->browser_action()->PaintBadge(canvas, bounds, tab_id);
+ button_->extension()->browser_action()->PaintBadge(canvas->AsCanvas(),
+ bounds, tab_id);
}
return canvas;
@@ -865,9 +868,9 @@
BrowserActionButton* button = browser_action_views_[i]->button();
if (button == sender) {
// Set the dragging image for the icon.
- scoped_ptr<gfx::Canvas> canvas(
+ scoped_ptr<gfx::CanvasSkia> canvas(
browser_action_views_[i]->GetIconWithBadge());
- drag_utils::SetDragImageOnDataObject(*canvas, button->size(), press_pt,
+ drag_utils::SetDragImageOnDataObject(*canvas->AsCanvas(), button->size(), press_pt,
data);
// Fill in the remaining info.

Powered by Google App Engine
This is Rietveld 408576698