summaryrefslogtreecommitdiffstats
path: root/media/video/capture/screen/mac/desktop_configuration.h
blob: c3c65b39be54a5d7daf613ad0a8f738e7275beb4 (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
60
61
62
63
64
65
// 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 MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_
#define MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_

#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
#include <vector>

#include "base/basictypes.h"
#include "media/base/media_export.h"
#include "third_party/skia/include/core/SkPoint.h"
#include "third_party/skia/include/core/SkRect.h"

namespace media {

// Describes the configuration of a specific display.
struct MEDIA_EXPORT MacDisplayConfiguration {
  MacDisplayConfiguration();

  // Returns the current configuration of the specified display.
  MEDIA_EXPORT static MacDisplayConfiguration ForDisplay(
      CGDirectDisplayID display_id);

  // Cocoa identifier for this display.
  CGDirectDisplayID id;

  // Bounds of this display in Density-Independent Pixels (DIPs).
  SkIRect bounds;

  // Bounds of this display in physical pixels.
  SkIRect pixel_bounds;

  // Scale factor from DIPs to physical pixels.
  float dip_to_pixel_scale;
};

typedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations;

// Describes the configuration of the whole desktop.
struct MEDIA_EXPORT MacDesktopConfiguration {
  MacDesktopConfiguration();
  ~MacDesktopConfiguration();

  // Returns the current configuration of the desktop.
  MEDIA_EXPORT static MacDesktopConfiguration GetCurrent();

  // Bounds of the desktop in Density-Independent Pixels (DIPs).
  SkIRect bounds;

  // Bounds of the desktop in physical pixels.
  SkIRect pixel_bounds;

  // Scale factor from DIPs to physical pixels.
  float dip_to_pixel_scale;

  // Configurations of the displays making up the desktop area.
  MacDisplayConfigurations displays;
};

}  // namespace media

#endif  // MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_