~oem-solutions-group/unity-2d/clutter-1.0

« back to all changes in this revision

Viewing changes to clutter/cogl/cogl/cogl-texture-2d-sliced-private.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Cogl
 
3
 *
 
4
 * An object oriented GL/GLES Abstraction/Utility Layer
 
5
 *
 
6
 * Copyright (C) 2007,2008,2009 Intel Corporation.
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This library is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Lesser General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public
 
19
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 
20
 *
 
21
 *
 
22
 */
 
23
 
 
24
#ifndef __COGL_TEXTURE_2D_SLICED_H
 
25
#define __COGL_TEXTURE_2D_SLICED_H
 
26
 
 
27
#include "cogl-bitmap-private.h"
 
28
#include "cogl-handle.h"
 
29
#include "cogl-material-private.h"
 
30
#include "cogl-texture-private.h"
 
31
 
 
32
#define COGL_TEXTURE_2D_SLICED(tex) ((CoglTexture2DSliced *)tex)
 
33
 
 
34
typedef struct _CoglTexture2DSliced CoglTexture2DSliced;
 
35
typedef struct _CoglTexturePixel  CoglTexturePixel;
 
36
 
 
37
/* This is used to store the first pixel of each slice. This is only
 
38
   used when glGenerateMipmap is not available */
 
39
struct _CoglTexturePixel
 
40
{
 
41
  /* We need to store the format of the pixel because we store the
 
42
     data in the source format which might end up being different for
 
43
     each slice if a subregion is updated with a different format */
 
44
  GLenum gl_format;
 
45
  GLenum gl_type;
 
46
  guint8 data[4];
 
47
};
 
48
 
 
49
struct _CoglTexture2DSliced
 
50
{
 
51
  CoglTexture       _parent;
 
52
  GArray           *slice_x_spans;
 
53
  GArray           *slice_y_spans;
 
54
  GArray           *slice_gl_handles;
 
55
  int               max_waste;
 
56
 
 
57
  /* The internal format of the GL texture represented as a
 
58
     CoglPixelFormat */
 
59
  CoglPixelFormat   format;
 
60
  /* The internal format of the GL texture represented as a GL enum */
 
61
  GLenum            gl_format;
 
62
  GLenum            gl_target;
 
63
  int               width;
 
64
  int               height;
 
65
  GLenum            min_filter;
 
66
  GLenum            mag_filter;
 
67
  gboolean          is_foreign;
 
68
  GLint             wrap_mode;
 
69
  gboolean          auto_mipmap;
 
70
  gboolean          mipmaps_dirty;
 
71
 
 
72
  /* This holds a copy of the first pixel in each slice. It is only
 
73
     used to force an automatic update of the mipmaps when
 
74
     glGenerateMipmap is not available. */
 
75
  CoglTexturePixel *first_pixels;
 
76
};
 
77
 
 
78
GQuark
 
79
_cogl_handle_texture_2d_sliced_get_type (void);
 
80
 
 
81
CoglHandle
 
82
_cogl_texture_2d_sliced_new_with_size (unsigned int     width,
 
83
                                       unsigned int     height,
 
84
                                       CoglTextureFlags flags,
 
85
                                       CoglPixelFormat  internal_format);
 
86
 
 
87
CoglHandle
 
88
_cogl_texture_2d_sliced_new_from_foreign (GLuint           gl_handle,
 
89
                                          GLenum           gl_target,
 
90
                                          GLuint           width,
 
91
                                          GLuint           height,
 
92
                                          GLuint           x_pot_waste,
 
93
                                          GLuint           y_pot_waste,
 
94
                                          CoglPixelFormat  format);
 
95
 
 
96
CoglHandle
 
97
_cogl_texture_2d_sliced_new_from_bitmap (CoglHandle       bmp_handle,
 
98
                                         CoglTextureFlags flags,
 
99
                                         CoglPixelFormat  internal_format);
 
100
 
 
101
#endif /* __COGL_TEXTURE_2D_SLICED_H */