mesa: Add _mesa_swap2_copy and _mesa_swap4_copy
[mesa.git] / src / mesa / main / image.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #ifndef IMAGE_H
27 #define IMAGE_H
28
29
30 #include "glheader.h"
31 #include "compiler.h"
32
33 struct gl_context;
34 struct gl_pixelstore_attrib;
35
36 extern void
37 _mesa_swap2_copy(GLushort *dst, GLushort *src, GLuint n);
38
39 extern void
40 _mesa_swap4_copy(GLuint *dst, GLuint *src, GLuint n);
41
42 static inline void
43 _mesa_swap2(GLushort *p, GLuint n)
44 {
45 _mesa_swap2_copy(p, p, n);
46 }
47
48 static inline void
49 _mesa_swap4(GLuint *p, GLuint n)
50 {
51 _mesa_swap4_copy(p, p, n);
52 }
53
54 extern GLintptr
55 _mesa_image_offset( GLuint dimensions,
56 const struct gl_pixelstore_attrib *packing,
57 GLsizei width, GLsizei height,
58 GLenum format, GLenum type,
59 GLint img, GLint row, GLint column );
60
61 extern GLvoid *
62 _mesa_image_address( GLuint dimensions,
63 const struct gl_pixelstore_attrib *packing,
64 const GLvoid *image,
65 GLsizei width, GLsizei height,
66 GLenum format, GLenum type,
67 GLint img, GLint row, GLint column );
68
69 extern GLvoid *
70 _mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
71 const GLvoid *image,
72 GLsizei width,
73 GLenum format, GLenum type,
74 GLint column );
75
76 extern GLvoid *
77 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
78 const GLvoid *image,
79 GLsizei width, GLsizei height,
80 GLenum format, GLenum type,
81 GLint row, GLint column );
82
83 extern GLvoid *
84 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
85 const GLvoid *image,
86 GLsizei width, GLsizei height,
87 GLenum format, GLenum type,
88 GLint img, GLint row, GLint column );
89
90
91 extern GLint
92 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
93 GLint width, GLenum format, GLenum type );
94
95
96 extern GLint
97 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
98 GLint width, GLint height,
99 GLenum format, GLenum type );
100
101
102 extern void
103 _mesa_expand_bitmap(GLsizei width, GLsizei height,
104 const struct gl_pixelstore_attrib *unpack,
105 const GLubyte *bitmap,
106 GLubyte *destBuffer, GLint destStride,
107 GLubyte onValue);
108
109
110 extern void
111 _mesa_convert_colors(GLenum srcType, const GLvoid *src,
112 GLenum dstType, GLvoid *dst,
113 GLuint count, const GLubyte mask[]);
114
115
116 extern GLboolean
117 _mesa_clip_drawpixels(const struct gl_context *ctx,
118 GLint *destX, GLint *destY,
119 GLsizei *width, GLsizei *height,
120 struct gl_pixelstore_attrib *unpack);
121
122
123 extern GLboolean
124 _mesa_clip_readpixels(const struct gl_context *ctx,
125 GLint *srcX, GLint *srcY,
126 GLsizei *width, GLsizei *height,
127 struct gl_pixelstore_attrib *pack);
128
129 extern GLboolean
130 _mesa_clip_copytexsubimage(const struct gl_context *ctx,
131 GLint *destX, GLint *destY,
132 GLint *srcX, GLint *srcY,
133 GLsizei *width, GLsizei *height);
134
135 extern GLboolean
136 _mesa_clip_to_region(GLint xmin, GLint ymin,
137 GLint xmax, GLint ymax,
138 GLint *x, GLint *y,
139 GLsizei *width, GLsizei *height );
140
141 extern GLboolean
142 _mesa_clip_blit(struct gl_context *ctx,
143 GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
144 GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
145
146
147 #endif