blob: c99cffea5409d7dc5c79bbdf57d3ee5ccbbdde4a (
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 2014 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_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
#define ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
#include "ash/ash_export.h"
#include "ash/display/display_controller.h"
#include "ui/gfx/transform.h"
namespace ash {
// TouchTransformerController listens to display configuration change
// and updates the touch transformation for touch displays.
class ASH_EXPORT TouchTransformerController
: public DisplayController::Observer {
public:
TouchTransformerController();
virtual ~TouchTransformerController();
// Updates the TouchTransformer for touch device and pushes the new
// TouchTransformer into device manager.
void UpdateTouchTransformer() const;
// DisplayController::Observer:
virtual void OnDisplaysInitialized() override;
virtual void OnDisplayConfigurationChanged() override;
private:
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchTransformerMirrorModeLetterboxing);
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchTransformerMirrorModePillarboxing);
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchTransformerExtendedMode);
FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
TouchRadiusScale);
bool ShouldComputeMirrorModeTouchTransformer(
const DisplayInfo& touch_display) const ;
gfx::Transform GetMirrorModeTouchTransformer(
const DisplayInfo& touch_display) const;
gfx::Transform GetExtendedModeTouchTransformer(
const DisplayInfo& touch_display, const gfx::Size& fb_size) const;
double GetTouchResolutionScale(const DisplayInfo& touch_display) const;
// For unittests only.
bool force_compute_mirror_mode_touch_transformer_;
DISALLOW_COPY_AND_ASSIGN(TouchTransformerController);
};
} // namespace ash
#endif // ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
|