summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 18:25:28 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 18:25:28 +0000
commit6250e6dde28cf577a3746a068ddb89dcf3b29036 (patch)
tree57bd8f443b98cdb6380c5eba0a2f1229ad3da190
parent303d592db3872bb4c6d82f506848c0d5edecf6a1 (diff)
downloadchromium_src-6250e6dde28cf577a3746a068ddb89dcf3b29036.zip
chromium_src-6250e6dde28cf577a3746a068ddb89dcf3b29036.tar.gz
chromium_src-6250e6dde28cf577a3746a068ddb89dcf3b29036.tar.bz2
Use GetInverse
Rotation matrixes are normalized (and will soon changed to handle 90 rotations in special form), so no need to have separate inverse matrix. BUG=222483 TEST=no functionality change. Review URL: https://codereview.chromium.org/14361002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195238 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/OWNERS4
-rw-r--r--ash/ash_root_window_transformer.cc7
-rw-r--r--ash/ash_root_window_transformer.h1
-rw-r--r--ash/display/display_controller.cc15
4 files changed, 5 insertions, 22 deletions
diff --git a/ash/OWNERS b/ash/OWNERS
index 802f976..57aa02a 100644
--- a/ash/OWNERS
+++ b/ash/OWNERS
@@ -5,6 +5,8 @@ sky@chromium.org
per-file ash_strings.grd=*
per-file ash_chromeos_strings.grdp=*
+
+per-file ash_root_window_transformer.*=oshima@chromium.org
+per-file extended_desktop_unittest.*=oshima@chromium.org
per-file root_window_controller*=oshima@chromium.org
per-file screen_ash*=oshima@chromium.org
-per-file extended_desktop_unittest.*=oshima@chromium.org
diff --git a/ash/ash_root_window_transformer.cc b/ash/ash_root_window_transformer.cc
index d71b3dc..2cfb019 100644
--- a/ash/ash_root_window_transformer.cc
+++ b/ash/ash_root_window_transformer.cc
@@ -13,7 +13,6 @@ namespace ash {
AshRootWindowTransformer::AshRootWindowTransformer(
aura::RootWindow* root,
const gfx::Transform& transform,
- const gfx::Transform& inverted,
const gfx::Insets& host_insets,
float root_window_scale)
: root_window_(root),
@@ -23,20 +22,18 @@ AshRootWindowTransformer::AshRootWindowTransformer(
root_window_->layer()->SetForceRenderSurface(root_window_scale_ != 1.0f);
gfx::Transform translate;
- invert_transform_ = inverted;
- invert_transform_.Scale(root_window_scale_, root_window_scale_);
if (host_insets.top() != 0 || host_insets.left() != 0) {
float device_scale_factor = ui::GetDeviceScaleFactor(root_window_->layer());
float x_offset = host_insets.left() / device_scale_factor;
float y_offset = host_insets.top() / device_scale_factor;
translate.Translate(x_offset, y_offset);
- invert_transform_.Translate(-x_offset, -y_offset);
}
float inverted_scale = 1.0f / root_window_scale_;
translate.Scale(inverted_scale, inverted_scale);
-
transform_ = translate * transform;
+
+ CHECK(transform_.GetInverse(&invert_transform_));
}
gfx::Transform AshRootWindowTransformer::GetTransform() const {
diff --git a/ash/ash_root_window_transformer.h b/ash/ash_root_window_transformer.h
index 9b58f6e..d8b7900 100644
--- a/ash/ash_root_window_transformer.h
+++ b/ash/ash_root_window_transformer.h
@@ -22,7 +22,6 @@ class ASH_EXPORT AshRootWindowTransformer : public aura::RootWindowTransformer {
public:
AshRootWindowTransformer(aura::RootWindow* root,
const gfx::Transform& transform,
- const gfx::Transform& inverted,
const gfx::Insets& insets,
float root_window_scale);
// aura::RootWindowTransformer overrides:
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index ed85e94..89f2d3e 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -151,12 +151,6 @@ void RotateRootWindow(aura::RootWindow* root_window,
root_window->SetProperty(kRotationPropertyKey, info.rotation());
#endif
gfx::Transform rotate;
- // TODO(oshima): Manually complute the inverse of the
- // rotate+translate matrix to compensate for computation error in
- // the inverted matrix. Ideally, SkMatrix should have special
- // case handling for rotate+translate case. crbug.com/222483.
- gfx::Transform reverse_rotate;
-
// The origin is (0, 0), so the translate width/height must be reduced by
// 1 pixel.
float one_pixel = 1.0f / display.device_scale_factor();
@@ -166,31 +160,22 @@ void RotateRootWindow(aura::RootWindow* root_window,
case gfx::Display::ROTATE_90:
rotate.Translate(display.bounds().height() - one_pixel, 0);
rotate.Rotate(90);
- reverse_rotate.Rotate(270);
- reverse_rotate.Translate(-(display.bounds().height() - one_pixel), 0);
break;
case gfx::Display::ROTATE_270:
rotate.Translate(0, display.bounds().width() - one_pixel);
rotate.Rotate(270);
- reverse_rotate.Rotate(90);
- reverse_rotate.Translate(0, -(display.bounds().width() - one_pixel));
break;
case gfx::Display::ROTATE_180:
rotate.Translate(display.bounds().width() - one_pixel,
display.bounds().height() - one_pixel);
rotate.Rotate(180);
- reverse_rotate.Rotate(180);
- reverse_rotate.Translate(-(display.bounds().width() - one_pixel),
- -(display.bounds().height() - one_pixel));
break;
}
RoundNearZero(&rotate);
- RoundNearZero(&reverse_rotate);
scoped_ptr<aura::RootWindowTransformer> transformer(
new AshRootWindowTransformer(root_window,
rotate,
- reverse_rotate,
info.GetOverscanInsetsInPixel(),
info.ui_scale()));
root_window->SetRootWindowTransformer(transformer.Pass());