summaryrefslogtreecommitdiffstats
path: root/ash/wm/frame_painter.cc
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 15:58:53 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 15:58:53 +0000
commit9ec0f456b01ce150a7982d1303bba3eb21e25bb8 (patch)
tree196fd3d9389d582f681010e7f28e4e915a55bcb0 /ash/wm/frame_painter.cc
parent4bf4d6305a94b63fb3637930d7c4f514c5adca2d (diff)
downloadchromium_src-9ec0f456b01ce150a7982d1303bba3eb21e25bb8.zip
chromium_src-9ec0f456b01ce150a7982d1303bba3eb21e25bb8.tar.gz
chromium_src-9ec0f456b01ce150a7982d1303bba3eb21e25bb8.tar.bz2
Convert ash and chromeos parts of chrome/ to ImageSkia
Used same conversion script as 10437006 Changed by hand afterwards: 1 ash/shell/app_list.cc 2 ash/shell/content_client/shell_content_browser_client.h 3 ash/shell/window_watcher.cc 4 ash/system/tray/tray_views.h 5 ash/system/user/tray_user.cc 6 ash/test/test_launcher_delegate.cc 7 ash/wm/frame_painter.cc 8 ash/wm/image_grid_unittest.cc 9 chrome/browser/chrome_content_browser_client.cc 10 chrome/browser/chrome_content_browser_client.h 11 chrome/browser/chromeos/extensions/file_manager_util.cc 12 chrome/browser/chromeos/login/message_bubble.h 13 chrome/browser/chromeos/login/take_photo_view.cc 14 chrome/browser/chromeos/login/take_photo_view.h 15 chrome/browser/chromeos/login/user.h 16 chrome/browser/chromeos/login/user_image_screen.cc 17 chrome/browser/chromeos/login/user_image_screen_actor.h 18 chrome/browser/chromeos/login/webui_login_view.cc 19 chrome/browser/chromeos/options/take_photo_dialog.cc 20 chrome/browser/chromeos/status/data_promo_notification.cc 21 chrome/browser/chromeos/status/network_menu_icon.cc 22 chrome/browser/chromeos/status/network_menu_icon.h 23 chrome/browser/chromeos/status/network_menu_icon_unittest.cc 24 chrome/browser/debugger/devtools_window.cc 25 chrome/browser/favicon/favicon_handler.cc 26 chrome/browser/favicon/favicon_tab_helper.cc 27 chrome/browser/instant/instant_loader.cc 28 chrome/browser/ui/toolbar/back_forward_menu_model.cc 29 chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc 30 chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc 31 chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h 32 chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc 33 chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.h 34 chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h 35 chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc 36 chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.cc 37 content/browser/mock_content_browser_client.cc 38 content/browser/mock_content_browser_client.h 39 content/public/browser/content_browser_client.h 40 content/public/browser/favicon_status.cc 41 content/public/browser/favicon_status.h 42 content/shell/shell_content_browser_client.cc 43 content/shell/shell_content_browser_client.h 44 ui/views/examples/content_client/examples_content_browser_client.cc 45 ui/views/examples/content_client/examples_content_browser_client.h Fixed headers and spacing 1 ash/desktop_background/desktop_background_controller.cc 2 ash/desktop_background/desktop_background_controller.h 3 ash/desktop_background/desktop_background_resources.cc 4 ash/desktop_background/desktop_background_resources.h 5 ash/shell.h 6 ash/shell_factory.h 7 ash/system/tray/system_tray_delegate.h 8 ash/wm/frame_painter.h 9 chrome/browser/chromeos/login/default_user_images.h 10 chrome/browser/chromeos/status/network_menu.cc Test=Compiles Bug=124566 Review URL: https://chromiumcodereview.appspot.com/10443062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/frame_painter.cc')
-rw-r--r--ash/wm/frame_painter.cc53
1 files changed, 27 insertions, 26 deletions
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index f35db43..076af87 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -76,7 +76,7 @@ const int kButtonOverlap = 1;
// we need to copy the theme image for the window header from a few pixels
// inset to preserve alignment with the NTP image, or else we'll break a bunch
// of existing themes. We do something similar on OS X for the same reason.
-const int kThemeFrameBitmapOffsetX = 5;
+const int kThemeFrameImageOffsetX = 5;
// Duration of crossfade animation for activating and deactivating frame.
const int kActivationCrossfadeDurationMs = 200;
// Alpha/opacity value for fully-opaque headers.
@@ -87,14 +87,14 @@ const int kFullyOpaque = 255;
void TileRoundRect(gfx::Canvas* canvas,
int x, int y, int w, int h,
SkPaint* paint,
- const SkBitmap& bitmap,
+ const gfx::ImageSkia& image,
int corner_radius,
- int bitmap_offset_x) {
+ int image_offset_x) {
// To get the shader to sample the image |inset_y| pixels in but tile across
// the whole image, we adjust the target rectangle for the shader to the right
// and translate the canvas left to compensate.
SkRect rect;
- rect.iset(x + bitmap_offset_x, y, x + bitmap_offset_x + w, y + h);
+ rect.iset(x + image_offset_x, y, x + image_offset_x + w, y + h);
const SkScalar kRadius = SkIntToScalar(corner_radius);
SkScalar radii[8] = {
kRadius, kRadius, // top-left
@@ -104,7 +104,7 @@ void TileRoundRect(gfx::Canvas* canvas,
SkPath path;
path.addRoundRect(rect, radii, SkPath::kCW_Direction);
- SkShader* shader = SkShader::CreateBitmapShader(bitmap,
+ SkShader* shader = SkShader::CreateBitmapShader(image,
SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
paint->setShader(shader);
@@ -113,9 +113,9 @@ void TileRoundRect(gfx::Canvas* canvas,
shader->unref();
// Adjust canvas to compensate for image sampling offset, draw, then adjust
// back. This is cheaper than pushing/popping the entire canvas state.
- canvas->sk_canvas()->translate(SkIntToScalar(-bitmap_offset_x), 0);
+ canvas->sk_canvas()->translate(SkIntToScalar(-image_offset_x), 0);
canvas->DrawPath(path, *paint);
- canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0);
+ canvas->sk_canvas()->translate(SkIntToScalar(image_offset_x), 0);
}
// Returns true if |window| is a visible, normal window.
@@ -189,17 +189,17 @@ void FramePainter::Init(views::Widget* frame,
// Window frame image parts.
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
button_separator_ =
- rb.GetImageNamed(IDR_AURA_WINDOW_BUTTON_SEPARATOR).ToSkBitmap();
+ rb.GetImageNamed(IDR_AURA_WINDOW_BUTTON_SEPARATOR).ToImageSkia();
top_left_corner_ =
- rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_LEFT).ToSkBitmap();
+ rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_LEFT).ToImageSkia();
top_edge_ =
- rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToSkBitmap();
+ rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToImageSkia();
top_right_corner_ =
- rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToSkBitmap();
+ rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToImageSkia();
header_left_edge_ =
- rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToSkBitmap();
+ rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToImageSkia();
header_right_edge_ =
- rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToSkBitmap();
+ rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToImageSkia();
window_ = frame->GetNativeWindow();
// Ensure we get resize cursors for a few pixels outside our bounds.
@@ -306,7 +306,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view,
gfx::Canvas* canvas,
HeaderMode header_mode,
int theme_frame_id,
- const SkBitmap* theme_frame_overlay) {
+ const gfx::ImageSkia* theme_frame_overlay) {
if (previous_theme_frame_id_ != 0 &&
previous_theme_frame_id_ != theme_frame_id) {
crossfade_animation_.reset(new ui::SlideAnimation(this));
@@ -319,15 +319,16 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view,
int opacity =
GetHeaderOpacity(header_mode, theme_frame_id, theme_frame_overlay);
ui::ThemeProvider* theme_provider = frame_->GetThemeProvider();
- SkBitmap* theme_frame = theme_provider->GetBitmapNamed(theme_frame_id);
+ gfx::ImageSkia* theme_frame = theme_provider->GetImageSkiaNamed(
+ theme_frame_id);
header_frame_bounds_ = gfx::Rect(0, 0, view->width(), theme_frame->height());
const int kCornerRadius = 2;
SkPaint paint;
if (crossfade_animation_.get() && crossfade_animation_->is_animating()) {
- SkBitmap* crossfade_theme_frame =
- theme_provider->GetBitmapNamed(crossfade_theme_frame_id_);
+ gfx::ImageSkia* crossfade_theme_frame =
+ theme_provider->GetImageSkiaNamed(crossfade_theme_frame_id_);
if (crossfade_theme_frame) {
double current_value = crossfade_animation_->GetCurrentValue();
int old_alpha = (1 - current_value) * crossfade_opacity_;
@@ -341,7 +342,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view,
&paint,
*crossfade_theme_frame,
kCornerRadius,
- kThemeFrameBitmapOffsetX);
+ kThemeFrameImageOffsetX);
paint.setAlpha(new_alpha);
} else {
@@ -358,7 +359,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view,
&paint,
*theme_frame,
kCornerRadius,
- kThemeFrameBitmapOffsetX);
+ kThemeFrameImageOffsetX);
previous_theme_frame_id_ = theme_frame_id;
previous_opacity_ = opacity;
@@ -564,16 +565,16 @@ void FramePainter::AnimationProgressed(const ui::Animation* animation) {
// FramePainter, private:
void FramePainter::SetButtonImages(views::ImageButton* button,
- int normal_bitmap_id,
- int hot_bitmap_id,
- int pushed_bitmap_id) {
+ int normal_image_id,
+ int hot_image_id,
+ int pushed_image_id) {
ui::ThemeProvider* theme_provider = frame_->GetThemeProvider();
button->SetImage(views::CustomButton::BS_NORMAL,
- theme_provider->GetImageSkiaNamed(normal_bitmap_id));
+ theme_provider->GetImageSkiaNamed(normal_image_id));
button->SetImage(views::CustomButton::BS_HOT,
- theme_provider->GetImageSkiaNamed(hot_bitmap_id));
+ theme_provider->GetImageSkiaNamed(hot_image_id));
button->SetImage(views::CustomButton::BS_PUSHED,
- theme_provider->GetImageSkiaNamed(pushed_bitmap_id));
+ theme_provider->GetImageSkiaNamed(pushed_image_id));
}
int FramePainter::GetTitleOffsetX() const {
@@ -584,7 +585,7 @@ int FramePainter::GetTitleOffsetX() const {
int FramePainter::GetHeaderOpacity(HeaderMode header_mode,
int theme_frame_id,
- const SkBitmap* theme_frame_overlay) {
+ const gfx::ImageSkia* theme_frame_overlay) {
// User-provided themes are painted fully opaque.
if (frame_->GetThemeProvider()->HasCustomImage(theme_frame_id))
return kFullyOpaque;