Debian Codegraph @

common/2d/gpixel.cpp

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19
20 #include "u_mem.h"
21 #include "gr.h"
22 #if DXX_USE_OGL
23 #include "ogl_init.h"
24 #endif
25
26 namespace dcx {
27
28 color_palette_index gr_ugpixel(const grs_bitmap &bitmap, int x, int y)
29 {
30 switch (bitmap.get_type())
31 {
32 case bm_mode::linear:
33 return bitmap.bm_data[ bitmap.bm_rowsize*y + x ];
34 case bm_mode::ilbm:
35 case bm_mode::rgb15:
36 break;
37 #if DXX_USE_OGL
38 case bm_mode::ogl:
39 return ogl_ugpixel(bitmap, x, y);
40 #endif
41 }
42 return color_palette_index{0};
43 }
44
45 color_palette_index gr_gpixel(const grs_bitmap &bitmap, const unsigned x, const unsigned y)
46 {
47 if (x >= bitmap.bm_w || y >= bitmap.bm_h)
48 return color_palette_index{0};
49 return gr_ugpixel(bitmap, x, y);
50 }
51
52 }