1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/android/edge_effect_base.h"
10 gfx::Transform
EdgeEffectBase::ComputeTransform(Edge edge
,
11 const gfx::SizeF
& viewport_size
,
13 // Transforms assume the edge layers are anchored to their *top center point*.
16 return gfx::Transform(1, 0, 0, 1, 0, offset
);
18 return gfx::Transform(0, 1, -1, 0, -viewport_size
.height() / 2.f
+ offset
,
19 viewport_size
.height() / 2.f
);
21 return gfx::Transform(-1, 0, 0, -1, 0, viewport_size
.height() + offset
);
23 return gfx::Transform(0, -1, 1, 0, -viewport_size
.height() / 2.f
+
24 viewport_size
.width() + offset
,
25 viewport_size
.height() / 2.f
);
27 NOTREACHED() << "Invalid edge: " << edge
;
28 return gfx::Transform();
33 gfx::SizeF
EdgeEffectBase::ComputeOrientedSize(
35 const gfx::SizeF
& viewport_size
) {
42 return gfx::SizeF(viewport_size
.height(), viewport_size
.width());
44 NOTREACHED() << "Invalid edge: " << edge
;
49 } // namespace content