summaryrefslogtreecommitdiffstats
path: root/ash/ash_root_window_transformer.h
blob: 9b58f6e1e4cdf452849cdbc7cd58c84369f2ab34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_ASH_ROOT_WINDOW_TRANSFORMER_H_
#define ASH_ASH_ROOT_WINDOW_TRANSFORMER_H_

#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "ui/aura/root_window_transformer.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/transform.h"

namespace aura {
class RootWindow;
}

namespace ash {

// RootWindowTransformer for ash environment.
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:
  virtual gfx::Transform GetTransform() const OVERRIDE;
  virtual gfx::Transform GetInverseTransform() const OVERRIDE;
  virtual gfx::Rect GetRootWindowBounds(
      const gfx::Size& host_size) const OVERRIDE;
  virtual gfx::Insets GetHostInsets() const OVERRIDE;

 private:
  virtual ~AshRootWindowTransformer() {}

  aura::RootWindow* root_window_;
  gfx::Transform transform_;

  // The accurate representation of the inverse of the |transform_|.
  // This is used to avoid computation error caused by
  // |gfx::Transform::GetInverse|.
  gfx::Transform invert_transform_;

  // The scale of the root window. This is used to expand the
  // area of the root window (useful in HighDPI display).
  // Note that this should not be confused with the device scale
  // factor, which specfies the pixel density of the display.
  float root_window_scale_;

  gfx::Insets host_insets_;

  DISALLOW_COPY_AND_ASSIGN(AshRootWindowTransformer);
};

}  // namespace ash

#endif  // ASH_ASH_ROOT_WINDOW_TRANSFORMER_H_