OSDN Git Service

#32713 初コミット。SVNrev567時点での、ファイルはbranch/140707(ReBuild XGVersion)から移行したもの。
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / SlimDXc_Jun2010(VC++2008) / source / dxgi / OutputDescription.cpp
1 #include "stdafx.h"
2 /*
3 * Copyright (c) 2007-2010 SlimDX Group
4
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24 #include <dxgi.h>
25
26 #include "OutputDescription.h"
27 #include "../Utilities.h"
28
29 using namespace System;
30
31 namespace SlimDX
32 {
33 namespace DXGI
34 {       
35         OutputDescription::OutputDescription( const DXGI_OUTPUT_DESC& native )
36         {
37                 m_DeviceName = gcnew String( native.DeviceName );
38                 m_DesktopCoordinates = Utilities::ConvertRect( native.DesktopCoordinates );
39                 m_AttachedToDesktop = native.AttachedToDesktop ? true : false;
40                 m_Rotation = static_cast<DisplayModeRotation>( native.Rotation );
41                 m_Monitor = IntPtr( native.Monitor );
42         }
43
44         String^ OutputDescription::Name::get()
45         {
46                 return m_DeviceName;
47         }
48
49         Drawing::Rectangle OutputDescription::DesktopBounds::get()
50         {
51                 return m_DesktopCoordinates;
52         }
53
54         bool OutputDescription::IsAttachedToDesktop::get()
55         {
56                 return m_AttachedToDesktop;
57         }
58
59         DisplayModeRotation OutputDescription::Rotation::get()
60         {
61                 return m_Rotation;
62         }
63
64         IntPtr OutputDescription::MonitorHandle::get()
65         {
66                 return m_Monitor;
67         }
68
69         bool OutputDescription::operator == ( OutputDescription left, OutputDescription right )
70         {
71                 return OutputDescription::Equals( left, right );
72         }
73
74         bool OutputDescription::operator != ( OutputDescription left, OutputDescription right )
75         {
76                 return !OutputDescription::Equals( left, right );
77         }
78
79         int OutputDescription::GetHashCode()
80         {
81                 return m_DeviceName->GetHashCode() + m_DesktopCoordinates.GetHashCode() + m_AttachedToDesktop.GetHashCode()
82                          + m_Rotation.GetHashCode() + m_Monitor.GetHashCode();
83         }
84
85         bool OutputDescription::Equals( Object^ value )
86         {
87                 if( value == nullptr )
88                         return false;
89
90                 if( value->GetType() != GetType() )
91                         return false;
92
93                 return Equals( safe_cast<OutputDescription>( value ) );
94         }
95
96         bool OutputDescription::Equals( OutputDescription value )
97         {
98                 return ( m_DeviceName == value.m_DeviceName && m_DesktopCoordinates == value.m_DesktopCoordinates && m_AttachedToDesktop == value.m_AttachedToDesktop
99                          && m_Rotation == value.m_Rotation && m_Monitor == value.m_Monitor );
100         }
101
102         bool OutputDescription::Equals( OutputDescription% value1, OutputDescription% value2 )
103         {
104                 return ( value1.m_DeviceName == value2.m_DeviceName && value1.m_DesktopCoordinates == value2.m_DesktopCoordinates && value1.m_AttachedToDesktop == value2.m_AttachedToDesktop
105                          && value1.m_Rotation == value2.m_Rotation && value1.m_Monitor == value2.m_Monitor );
106         }
107 }
108 }