Skip to content

Commit

Permalink
Migrate ui::Transform to gfx::Transform
Browse files Browse the repository at this point in the history
It is more appropriate for Transform class to belong with its fellow 
geometry classes in the gfx namespace.


Review URL: https://chromiumcodereview.appspot.com/11145005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161809 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
shawnsingh@chromium.org committed Oct 14, 2012
1 parent 4addcf3 commit 0f0453e
Show file tree
Hide file tree
Showing 54 changed files with 301 additions and 298 deletions.
2 changes: 1 addition & 1 deletion ash/launcher/app_list_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void AppListButton::StopLoadingAnimation() {
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kAnimationDurationInMs));
layer()->SetOpacity(1.0f);
layer()->SetTransform(ui::Transform());
layer()->SetTransform(gfx::Transform());
}

bool AppListButton::OnMousePressed(const ui::MouseEvent& event) {
Expand Down
6 changes: 3 additions & 3 deletions ash/launcher/overflow_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const int kButtonHoverSize = 28;

const int kBackgroundOffset = (48 - kButtonHoverSize) / 2;

void RotateCounterclockwise(ui::Transform* transform) {
void RotateCounterclockwise(gfx::Transform* transform) {
transform->matrix().set3x3(0, -1, 0,
1, 0, 0,
0, 0, 1);
}

void RotateClockwise(ui::Transform* transform) {
void RotateClockwise(gfx::Transform* transform) {
transform->matrix().set3x3( 0, 1, 0,
-1, 0, 0,
0, 0, 1);
Expand Down Expand Up @@ -107,7 +107,7 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) {
if (height() < kButtonHoverSize)
return;

ui::Transform transform;
gfx::Transform transform;

switch (alignment_) {
case SHELF_ALIGNMENT_BOTTOM:
Expand Down
2 changes: 1 addition & 1 deletion ash/magnifier/magnification_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ bool MagnificationControllerImpl::RedrawDIP(const gfx::Point& position_in_dip,
scale_ = scale;

// Creates transform matrix.
ui::Transform transform;
gfx::Transform transform;
// Flips the signs intentionally to convert them from the position of the
// magnification window.
transform.ConcatTranslate(-origin_.x(), -origin_.y());
Expand Down
2 changes: 1 addition & 1 deletion ash/rotator/screen_rotation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void ScreenRotation::OnStart(ui::LayerAnimationDelegate* delegate) {
if (degrees_ == 0)
return;

const ui::Transform& current_transform =
const gfx::Transform& current_transform =
delegate->GetTransformForAnimation();
const gfx::Rect& bounds = delegate->GetBoundsForAnimation();

Expand Down
6 changes: 3 additions & 3 deletions ash/system/tray/system_tray_bubble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void SystemTrayBubble::UpdateView(
settings.AddObserver(new AnimationObserverDeleteLayer(layer));
settings.SetTransitionDuration(swipe_duration);
settings.SetTweenType(ui::Tween::EASE_OUT);
ui::Transform transform;
gfx::Transform transform;
transform.SetTranslateX(layer->bounds().width());
layer->SetTransform(transform);
}
Expand Down Expand Up @@ -220,15 +220,15 @@ void SystemTrayBubble::UpdateView(
if (bubble_type == BUBBLE_TYPE_DETAILED) {
ui::Layer* new_layer = bubble_view_->layer();
gfx::Rect bounds = new_layer->bounds();
ui::Transform transform;
gfx::Transform transform;
transform.SetTranslateX(bounds.width());
new_layer->SetTransform(transform);
{
ui::ScopedLayerAnimationSettings settings(new_layer->GetAnimator());
settings.AddObserver(new AnimationObserverDeleteLayer(layer));
settings.SetTransitionDuration(swipe_duration);
settings.SetTweenType(ui::Tween::EASE_OUT);
new_layer->SetTransform(ui::Transform());
new_layer->SetTransform(gfx::Transform());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ash/system/tray/tray_item_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void TrayItemView::ChildPreferredSizeChanged(views::View* child) {
}

void TrayItemView::AnimationProgressed(const ui::Animation* animation) {
ui::Transform transform;
gfx::Transform transform;
transform.SetScale(animation->GetCurrentValue(),
animation->GetCurrentValue());
transform.ConcatTranslate(0, animation->CurrentValueBetween(
Expand Down
6 changes: 3 additions & 3 deletions ash/system/web_notification/web_notification_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ui::EventResult WebNotificationView::OnGestureEvent(
// The scroll-update events include the incremental scroll amount.
gesture_scroll_amount_ += event.details().scroll_x();

ui::Transform transform;
gfx::Transform transform;
transform.SetTranslateX(gesture_scroll_amount_);
layer()->SetTransform(transform);
layer()->SetOpacity(
Expand Down Expand Up @@ -298,7 +298,7 @@ void WebNotificationView::RestoreVisualState() {
ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kSwipeRestoreDurationMS));
layer()->SetTransform(ui::Transform());
layer()->SetTransform(gfx::Transform());
layer()->SetOpacity(1.f);
}

Expand All @@ -310,7 +310,7 @@ void WebNotificationView::SlideOutAndClose(SlideDirection direction) {
base::TimeDelta::FromMilliseconds(swipe_out_duration));
settings.AddObserver(this);

ui::Transform transform;
gfx::Transform transform;
transform.SetTranslateX(direction == SLIDE_LEFT ? -width() : width());
layer()->SetTransform(transform);
layer()->SetOpacity(0.f);
Expand Down
2 changes: 1 addition & 1 deletion ash/wm/gestures/long_press_affordance_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class LongPressAffordanceHandler::LongPressAffordanceView
GetPreferredSize().height() / 2);
canvas->Save();

ui::Transform scale;
gfx::Transform scale;
scale.SetScale(current_scale_, current_scale_);
// We want to scale from the center.
canvas->Translate(gfx::Point(center.x(), center.y()));
Expand Down
16 changes: 8 additions & 8 deletions ash/wm/image_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {

if (top_layer_.get()) {
if (center_width > 0) {
ui::Transform transform;
gfx::Transform transform;
transform.SetScaleX(
static_cast<float>(center_width) / top_layer_->bounds().width());
transform.ConcatTranslate(left, 0);
Expand All @@ -115,7 +115,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {
}
if (bottom_layer_.get()) {
if (center_width > 0) {
ui::Transform transform;
gfx::Transform transform;
transform.SetScaleX(
static_cast<float>(center_width) / bottom_layer_->bounds().width());
transform.ConcatTranslate(
Expand All @@ -126,7 +126,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {
}
if (left_layer_.get()) {
if (center_height > 0) {
ui::Transform transform;
gfx::Transform transform;
transform.SetScaleY(
(static_cast<float>(center_height) / left_layer_->bounds().height()));
transform.ConcatTranslate(0, top);
Expand All @@ -136,7 +136,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {
}
if (right_layer_.get()) {
if (center_height > 0) {
ui::Transform transform;
gfx::Transform transform;
transform.SetScaleY(
static_cast<float>(center_height) / right_layer_->bounds().height());
transform.ConcatTranslate(
Expand All @@ -155,7 +155,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {
top_left_layer_.get());
}
if (top_right_layer_.get()) {
ui::Transform transform;
gfx::Transform transform;
transform.SetTranslateX(size.width() - top_right_layer_->bounds().width());
top_right_layer_->SetTransform(transform);
top_right_painter_->SetClipRect(
Expand All @@ -166,7 +166,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {
top_right_layer_.get());
}
if (bottom_left_layer_.get()) {
ui::Transform transform;
gfx::Transform transform;
transform.SetTranslateY(
size.height() - bottom_left_layer_->bounds().height());
bottom_left_layer_->SetTransform(transform);
Expand All @@ -178,7 +178,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {
bottom_left_layer_.get());
}
if (bottom_right_layer_.get()) {
ui::Transform transform;
gfx::Transform transform;
transform.SetTranslate(
size.width() - bottom_right_layer_->bounds().width(),
size.height() - bottom_right_layer_->bounds().height());
Expand All @@ -194,7 +194,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {

if (center_layer_.get()) {
if (center_width > 0 && center_height > 0) {
ui::Transform transform;
gfx::Transform transform;
transform.SetScale(center_width / center_layer_->bounds().width(),
center_height / center_layer_->bounds().height());
transform.ConcatTranslate(left, top);
Expand Down
16 changes: 8 additions & 8 deletions ash/wm/session_state_animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ const float kSlowCloseSizeRatio = 0.95f;

// Returns the transform that should be applied to containers for the slow-close
// animation.
ui::Transform GetSlowCloseTransform() {
gfx::Transform GetSlowCloseTransform() {
gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size();
ui::Transform transform;
gfx::Transform transform;
transform.SetScale(kSlowCloseSizeRatio, kSlowCloseSizeRatio);
transform.ConcatTranslate(
floor(0.5 * (1.0 - kSlowCloseSizeRatio) * root_size.width() + 0.5),
Expand All @@ -50,9 +50,9 @@ ui::Transform GetSlowCloseTransform() {

// Returns the transform that should be applied to containers for the fast-close
// animation.
ui::Transform GetFastCloseTransform() {
gfx::Transform GetFastCloseTransform() {
gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size();
ui::Transform transform;
gfx::Transform transform;
transform.SetScale(0.0, 0.0);
transform.ConcatTranslate(floor(0.5 * root_size.width() + 0.5),
floor(0.5 * root_size.height() + 0.5));
Expand All @@ -79,7 +79,7 @@ void StartUndoSlowCloseAnimationForWindow(aura::Window* window) {
animator->StartAnimation(
new ui::LayerAnimationSequence(
ui::LayerAnimationElement::CreateTransformElement(
ui::Transform(),
gfx::Transform(),
base::TimeDelta::FromMilliseconds(kUndoSlowCloseAnimMs))));
}

Expand Down Expand Up @@ -119,7 +119,7 @@ void HideWindow(aura::Window* window) {
// Restores |window| to its original position and scale and full opacity
// instantaneously.
void RestoreWindow(aura::Window* window) {
window->layer()->SetTransform(ui::Transform());
window->layer()->SetTransform(gfx::Transform());
window->layer()->SetOpacity(1.0);
}

Expand All @@ -145,7 +145,7 @@ bool SessionStateAnimator::TestApi::ContainersAreAnimated(
return false;
break;
case ANIMATION_UNDO_SLOW_CLOSE:
if (layer->GetTargetTransform() != ui::Transform())
if (layer->GetTargetTransform() != gfx::Transform())
return false;
break;
case ANIMATION_FAST_CLOSE:
Expand All @@ -162,7 +162,7 @@ bool SessionStateAnimator::TestApi::ContainersAreAnimated(
return false;
break;
case ANIMATION_RESTORE:
if (layer->opacity() < 0.9999 || layer->transform() != ui::Transform())
if (layer->opacity() < 0.9999 || layer->transform() != gfx::Transform())
return false;
break;
default:
Expand Down
Loading

0 comments on commit 0f0453e

Please sign in to comment.