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

Unified Diff: ash/launcher/launcher_button.cc

Issue 11644033: Rotated Images (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/launcher/launcher.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_button.cc
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc
index 77546f8e3e194808203984291bda204467ab1ff6..dee32e3fb8cdebdb9275444f28e7adfebc86a3c4 100644
--- a/ash/launcher/launcher_button.cc
+++ b/ash/launcher/launcher_button.cc
@@ -20,6 +20,7 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_operations.h"
+#include "ui/gfx/skbitmap_operations.h"
#include "ui/views/controls/image_view.h"
namespace {
@@ -362,23 +363,22 @@ void LauncherButton::UpdateState() {
} else {
int bar_id;
if (state_ & STATE_ACTIVE) {
- bar_id = shelf_layout_manager_->SelectValueForShelfAlignment(
- IDR_AURA_LAUNCHER_UNDERLINE_BOTTOM_ACTIVE,
- IDR_AURA_LAUNCHER_UNDERLINE_LEFT_ACTIVE,
- IDR_AURA_LAUNCHER_UNDERLINE_RIGHT_ACTIVE);
+ bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE;
} else if (state_ & (STATE_HOVERED | STATE_FOCUSED | STATE_ATTENTION)) {
- bar_id = shelf_layout_manager_->SelectValueForShelfAlignment(
- IDR_AURA_LAUNCHER_UNDERLINE_BOTTOM_HOVER,
- IDR_AURA_LAUNCHER_UNDERLINE_LEFT_HOVER,
- IDR_AURA_LAUNCHER_UNDERLINE_RIGHT_HOVER);
+ bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER;
} else {
- bar_id = shelf_layout_manager_->SelectValueForShelfAlignment(
- IDR_AURA_LAUNCHER_UNDERLINE_BOTTOM_RUNNING,
- IDR_AURA_LAUNCHER_UNDERLINE_LEFT_RUNNING,
- IDR_AURA_LAUNCHER_UNDERLINE_RIGHT_RUNNING);
+ bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING;
}
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- bar_->SetImage(rb.GetImageNamed(bar_id).ToImageSkia());
+ const gfx::ImageSkia* image = rb.GetImageNamed(bar_id).ToImageSkia();
+ if(SHELF_ALIGNMENT_BOTTOM == shelf_layout_manager_->GetAlignment())
+ bar_->SetImage(*image);
+ else
+ bar_->SetImage(gfx::ImageSkiaOperations::CreateRotatedImage(*image,
+ shelf_layout_manager_->SelectValueForShelfAlignment(
+ SkBitmapOperations::ROTATION_270_CW,
+ SkBitmapOperations::ROTATION_270_CW,
+ SkBitmapOperations::ROTATION_90_CW)));
bar_->SetVisible(true);
}
bool rtl = base::i18n::IsRTL();
« no previous file with comments | « ash/launcher/launcher.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698