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-03-27 18:34:13 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-27 18:34:13 +0000
commite72feebc700e7eaff8476d18a2e64981410cfc40 (patch)
tree8dc672f69a7df84348e75e2faafa104b4c9bc172 /ash/wm/frame_painter.cc
parent6df627bfd39feff4932853559e766e9a2f7ff013 (diff)
downloadchromium_src-e72feebc700e7eaff8476d18a2e64981410cfc40.zip
chromium_src-e72feebc700e7eaff8476d18a2e64981410cfc40.tar.gz
chromium_src-e72feebc700e7eaff8476d18a2e64981410cfc40.tar.bz2
Revert 129220 - M20 Ash: Animate window header transition from active to inactive
BUG=116583 TEST=Manual Review URL: http://codereview.chromium.org/9720043 TBR=pkotwicz@chromium.org Review URL: https://chromiumcodereview.appspot.com/9791025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/frame_painter.cc')
-rw-r--r--ash/wm/frame_painter.cc53
1 files changed, 6 insertions, 47 deletions
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index cd779a3..db83e88 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -14,7 +14,6 @@
#include "third_party/skia/include/core/SkShader.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
-#include "ui/base/animation/slide_animation.h"
#include "ui/base/hit_test.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
@@ -69,14 +68,11 @@ const int kCloseButtonOffsetY = 0;
// 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;
-// Duration of crossfade animation for activating and deactivating frame.
-const int kActivationCrossfadeDurationMs = 200;
// Tiles an image into an area, rounding the top corners. Samples the |bitmap|
// starting |bitmap_offset_x| pixels from the left of the image.
void TileRoundRect(gfx::Canvas* canvas,
int x, int y, int w, int h,
- SkPaint* paint,
const SkBitmap& bitmap,
int corner_radius,
int bitmap_offset_x) {
@@ -94,17 +90,19 @@ void TileRoundRect(gfx::Canvas* canvas,
SkPath path;
path.addRoundRect(rect, radii, SkPath::kCW_Direction);
+ SkPaint paint;
SkShader* shader = SkShader::CreateBitmapShader(bitmap,
SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
- paint->setShader(shader);
+ paint.setShader(shader);
+ paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
// CreateBitmapShader returns a Shader with a reference count of one, we
// need to unref after paint takes ownership of the shader.
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()->drawPath(path, *paint);
+ canvas->sk_canvas()->drawPath(path, paint);
canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0);
}
@@ -126,10 +124,7 @@ FramePainter::FramePainter()
top_edge_(NULL),
top_right_corner_(NULL),
header_left_edge_(NULL),
- header_right_edge_(NULL),
- previous_theme_frame_(NULL),
- crossfade_theme_frame_(NULL),
- crossfade_animation_(NULL) {
+ header_right_edge_(NULL) {
}
FramePainter::~FramePainter() {
@@ -266,43 +261,14 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view,
const SkBitmap* theme_frame,
const SkBitmap* theme_frame_overlay) {
- if (previous_theme_frame_ && previous_theme_frame_ != theme_frame) {
- crossfade_animation_.reset(new ui::SlideAnimation(this));
- crossfade_theme_frame_ = previous_theme_frame_;
- crossfade_animation_->SetSlideDuration(kActivationCrossfadeDurationMs);
- crossfade_animation_->Show();
- }
-
- 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()) {
- uint8 theme_alpha = crossfade_animation_->GetCurrentValue() * 255;
-
- // Draw the old header background, clipping the corners to be rounded.
- paint.setAlpha(255 - theme_alpha);
- paint.setXfermodeMode(SkXfermode::kPlus_Mode);
- TileRoundRect(canvas,
- 0, 0, view->width(), theme_frame->height(),
- &paint,
- *crossfade_theme_frame_,
- kCornerRadius,
- kThemeFrameBitmapOffsetX);
-
- paint.setAlpha(theme_alpha);
- }
-
// Draw the header background, clipping the corners to be rounded.
+ const int kCornerRadius = 2;
TileRoundRect(canvas,
0, 0, view->width(), theme_frame->height(),
- &paint,
*theme_frame,
kCornerRadius,
kThemeFrameBitmapOffsetX);
- previous_theme_frame_ = theme_frame;
-
// Draw the theme frame overlay, if available.
if (theme_frame_overlay)
canvas->DrawBitmapInt(*theme_frame_overlay, 0, 0);
@@ -464,13 +430,6 @@ void FramePainter::OnWindowDestroying(aura::Window* window) {
}
///////////////////////////////////////////////////////////////////////////////
-// ui::AnimationDelegate overrides:
-
-void FramePainter::AnimationProgressed(const ui::Animation* animation) {
- frame_->SchedulePaintInRect(gfx::Rect(header_frame_bounds_));
-}
-
-///////////////////////////////////////////////////////////////////////////////
// FramePainter, private:
void FramePainter::SetButtonImages(views::ImageButton* button,