12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef REMOTING_HOST_SCREEN_RESOLUTION_H_
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define REMOTING_HOST_SCREEN_RESOLUTION_H_
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/basictypes.h"
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/compiler_specific.h"
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace remoting {
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Describes a screen's dimensions and DPI.
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ScreenResolution {
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ScreenResolution();
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  ScreenResolution(const webrtc::DesktopSize& dimensions,
1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                   const webrtc::DesktopVector& dpi);
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns the screen dimensions scaled according to the passed |new_dpi|.
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  webrtc::DesktopSize ScaleDimensionsToDpi(
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      const webrtc::DesktopVector& new_dpi) const;
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Dimensions of the screen in pixels.
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const webrtc::DesktopSize& dimensions() const { return dimensions_; }
2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // The vertical and horizontal DPI of the screen.
2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const webrtc::DesktopVector& dpi() const { return dpi_; }
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns true if |dimensions_| specifies an empty rectangle or when
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // IsValid() returns false.
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool IsEmpty() const;
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
350f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Returns true if the dimensions and DPI of the two resolutions match.
360f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  bool Equals(const ScreenResolution& other) const;
370f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  webrtc::DesktopSize dimensions_;
4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  webrtc::DesktopVector dpi_;
412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace remoting
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  // REMOTING_HOST_SCREEN_RESOLUTION_H_
46