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

Unified Diff: ash/wm/frame_painter.cc

Issue 9791025: Revert 129220 - M20 Ash: Animate window header transition from active to inactive (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « ash/wm/frame_painter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/frame_painter.cc
===================================================================
--- ash/wm/frame_painter.cc (revision 129226)
+++ ash/wm/frame_painter.cc (working copy)
@@ -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 @@
// 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 @@
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 @@
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 @@
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 @@
}
///////////////////////////////////////////////////////////////////////////////
-// 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,
« no previous file with comments | « ash/wm/frame_painter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698