vk/image: Add an explicit DestroyImage function
[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 struct gl_framebuffer;
36
37 extern void
38 _mesa_swap2_copy(GLushort *dst, GLushort *src, GLuint n);
39
40 extern void
41 _mesa_swap4_copy(GLuint *dst, GLuint *src, GLuint n);
42
43 static inline void
44 _mesa_swap2(GLushort *p, GLuint n)
45 {
46 _mesa_swap2_copy(p, p, n);
47 }
48
49 static inline void
50 _mesa_swap4(GLuint *p, GLuint n)
51 {
52 _mesa_swap4_copy(p, p, n);
53 }
54
55 extern GLintptr
56 _mesa_image_offset( GLuint dimensions,
57 const struct gl_pixelstore_attrib *packing,
58 GLsizei width, GLsizei height,
59 GLenum format, GLenum type,
60 GLint img, GLint row, GLint column );
61
62 extern GLvoid *
63 _mesa_image_address( GLuint dimensions,
64 const struct gl_pixelstore_attrib *packing,
65 const GLvoid *image,
66 GLsizei width, GLsizei height,
67 GLenum format, GLenum type,
68 GLint img, GLint row, GLint column );
69
70 extern GLvoid *
71 _mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
72 const GLvoid *image,
73 GLsizei width,
74 GLenum format, GLenum type,
75 GLint column );
76
77 extern GLvoid *
78 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
79 const GLvoid *image,
80 GLsizei width, GLsizei height,
81 GLenum format, GLenum type,
82 GLint row, GLint column );
83
84 extern GLvoid *
85 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
86 const GLvoid *image,
87 GLsizei width, GLsizei height,
88 GLenum format, GLenum type,
89 GLint img, GLint row, GLint column );
90
91
92 extern GLint
93 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
94 GLint width, GLenum format, GLenum type );
95
96
97 extern GLint
98 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
99 GLint width, GLint height,
100 GLenum format, GLenum type );
101
102
103 extern void
104 _mesa_expand_bitmap(GLsizei width, GLsizei height,
105 const struct gl_pixelstore_attrib *unpack,
106 const GLubyte *bitmap,
107 GLubyte *destBuffer, GLint destStride,
108 GLubyte onValue);
109
110
111 extern void
112 _mesa_convert_colors(GLenum srcType, const GLvoid *src,
113 GLenum dstType, GLvoid *dst,
114 GLuint count, const GLubyte mask[]);
115
116
117 extern GLboolean
118 _mesa_clip_drawpixels(const struct gl_context *ctx,
119 GLint *destX, GLint *destY,
120 GLsizei *width, GLsizei *height,
121 struct gl_pixelstore_attrib *unpack);
122
123
124 extern GLboolean
125 _mesa_clip_readpixels(const struct gl_context *ctx,
126 GLint *srcX, GLint *srcY,
127 GLsizei *width, GLsizei *height,
128 struct gl_pixelstore_attrib *pack);
129
130 extern GLboolean
131 _mesa_clip_copytexsubimage(const struct gl_context *ctx,
132 GLint *destX, GLint *destY,
133 GLint *srcX, GLint *srcY,
134 GLsizei *width, GLsizei *height);
135
136 extern GLboolean
137 _mesa_clip_to_region(GLint xmin, GLint ymin,
138 GLint xmax, GLint ymax,
139 GLint *x, GLint *y,
140 GLsizei *width, GLsizei *height );
141
142 extern GLboolean
143 _mesa_clip_blit(struct gl_context *ctx,
144 const struct gl_framebuffer *readFb,
145 const struct gl_framebuffer *drawFb,
146 GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
147 GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
148
149
150 #endif