1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gr_Scissor.h
4 
5   Copyright (C)2010 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 33893 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_GR_SCISSOR_H_
17 #define NN_GR_SCISSOR_H_
18 
19 #include <nn/gr/CTR/gr_Prefix.h>
20 
21 namespace nn
22 {
23     namespace gr
24     {
25         namespace CTR
26         {
27 
28             /* Please see man pages for details
29 
30             */
31             class Scissor
32             {
33             public:
34                 /* Please see man pages for details
35 
36                  */
Scissor()37                 Scissor():
38                 isEnable( true ),
39                 x( 0 ),
40                 y( 0 ),
41                 width( 240 ),
42                 height( 320 ),
43                 bufferWidth( 256 ),
44                 bufferHeight( 320 )
45                 {
46                 }
47 
48                 /* Please see man pages for details
49 
50 
51 
52 
53 
54 
55 
56 
57 
58                 */
Scissor(bool isEnable_,s32 x_,s32 y_,u32 width_,u32 height_,s32 bufferWidth_,s32 bufferHeight_)59                 Scissor( bool isEnable_, s32 x_, s32 y_, u32 width_, u32 height_, s32 bufferWidth_, s32 bufferHeight_ ) :
60                 isEnable( isEnable_ ),
61                 x( x_ ),
62                 y( y_ ),
63                 width( width_ ),
64                 height( height_ ),
65                 bufferWidth( bufferWidth_ ),
66                 bufferHeight( bufferHeight_ )
67                 {
68                 }
69 
70             public:
71                 /* Please see man pages for details
72 
73 
74 
75 
76 
77                  */
78                 bit32* MakeCommand( bit32* command ) const;
79 
80                 /* Please see man pages for details
81 
82 
83 
84 
85 
86 
87 
88                  */
MakeDisableCommand(bit32 * command,const s32 colorBufferWidth,const s32 colorBufferHeight)89                 static bit32* MakeDisableCommand( bit32* command,
90                     const s32 colorBufferWidth,
91                     const s32 colorBufferHeight )
92                 {
93                     s32 temp_width  = colorBufferWidth  - 1;
94                     s32 temp_height = colorBufferHeight - 1;
95 
96                     // 0x65-0x67
97                     *command++ = PICA_CMD_DATA_SCISSOR( false );
98                     *command++ = PICA_CMD_HEADER_BURSTSEQ( PICA_REG_SCISSOR, 3 );
99                     *command++ = 0;
100                     *command++ = PICA_CMD_DATA_SCISSOR_SIZE( temp_width, temp_height );
101 
102                     return command;
103                 }
104 
105             public:
106                 /* Please see man pages for details
107 
108 
109 
110 
111 
112 
113                  */
Set(s32 x_,s32 y_,u32 width_,u32 height_)114                 void Set( s32 x_, s32 y_, u32 width_, u32 height_ )
115                 {
116                     x = x_; y = y_; width = width_; height = height_;
117                 }
118 
119                 /* Please see man pages for details
120 
121 
122 
123 
124                  */
SetBufferSize(s32 bufferWidth_,s32 bufferHeight_)125                 void SetBufferSize( s32 bufferWidth_, s32 bufferHeight_ )
126                 {
127                     bufferWidth = bufferWidth_; bufferHeight = bufferHeight_;
128                 }
129 
130             public:
131                 /* Please see man pages for details
132 
133                 */
134                 bool    isEnable;
135                 NN_PADDING3;
136 
137                 /* Please see man pages for details
138 
139                 */
140                 s32        x;
141 
142                 /* Please see man pages for details
143 
144                 */
145                 s32        y;
146 
147                 /* Please see man pages for details
148 
149                 */
150                 u32        width;
151 
152                 /* Please see man pages for details
153 
154                 */
155                 u32        height;
156 
157                 /* Please see man pages for details
158 
159                 */
160                 s32        bufferWidth;
161 
162                 /* Please see man pages for details
163 
164                 */
165                 s32        bufferHeight;
166             };
167 
168         } // namespace CTR
169     } // namespace gr
170 } // namespace nn
171 
172 #endif // NN_GR_SCISSOR_H_
173