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

« back to all changes in this revision

Viewing changes to clutter/cogl/gl/cogl-texture-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, write to the
20
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
 
 * Boston, MA 02111-1307, USA.
22
 
 */
23
 
 
24
 
#ifndef __COGL_TEXTURE_H
25
 
#define __COGL_TEXTURE_H
26
 
 
27
 
#include "cogl-bitmap-private.h"
28
 
#include "cogl-handle.h"
29
 
#include "cogl-material-private.h"
30
 
 
31
 
typedef struct _CoglTexture       CoglTexture;
32
 
typedef struct _CoglTexSliceSpan  CoglTexSliceSpan;
33
 
typedef struct _CoglSpanIter      CoglSpanIter;
34
 
typedef struct _CoglTexturePixel  CoglTexturePixel;
35
 
 
36
 
struct _CoglTexSliceSpan
37
 
{
38
 
  gint   start;
39
 
  gint   size;
40
 
  gint   waste;
41
 
};
42
 
 
43
 
struct _CoglSpanIter
44
 
{
45
 
  gint              index;
46
 
  GArray           *array;
47
 
  CoglTexSliceSpan *span;
48
 
  float             pos;
49
 
  float             next_pos;
50
 
  float             origin;
51
 
  float             cover_start;
52
 
  float             cover_end;
53
 
  float             intersect_start;
54
 
  float             intersect_end;
55
 
  float             intersect_start_local;
56
 
  float             intersect_end_local;
57
 
  gboolean          intersects;
58
 
};
59
 
 
60
 
/* This is used to store the first pixel of each slice. This is only
61
 
   used when glGenerateMipmap is not available */
62
 
struct _CoglTexturePixel
63
 
{
64
 
  /* We need to store the format of the pixel because we store the
65
 
     data in the source format which might end up being different for
66
 
     each slice if a subregion is updated with a different format */
67
 
  GLenum gl_format;
68
 
  GLenum gl_type;
69
 
  guint8 data[4];
70
 
};
71
 
 
72
 
struct _CoglTexture
73
 
{
74
 
  CoglHandleObject   _parent;
75
 
  CoglBitmap         bitmap;
76
 
  gboolean           bitmap_owner;
77
 
  GLenum             gl_target;
78
 
  GLenum             gl_intformat;
79
 
  GLenum             gl_format;
80
 
  GLenum             gl_type;
81
 
  GArray            *slice_x_spans;
82
 
  GArray            *slice_y_spans;
83
 
  GArray            *slice_gl_handles;
84
 
  gint               max_waste;
85
 
  GLenum             min_filter;
86
 
  GLenum             mag_filter;
87
 
  gboolean           is_foreign;
88
 
  GLint              wrap_mode;
89
 
  gboolean           auto_mipmap;
90
 
  gboolean           mipmaps_dirty;
91
 
 
92
 
  /* This holds a copy of the first pixel in each slice. It is only
93
 
     used to force an automatic update of the mipmaps when
94
 
     glGenerateMipmap is not available. */
95
 
  CoglTexturePixel  *first_pixels;
96
 
};
97
 
 
98
 
/* To improve batching of geometry when submitting vertices to OpenGL we
99
 
 * log the texture rectangles we want to draw to a journal, so when we
100
 
 * later flush the journal we aim to batch data, and gl draw calls. */
101
 
typedef struct _CoglJournalEntry
102
 
{
103
 
  CoglHandle               material;
104
 
  int                      n_layers;
105
 
  CoglMaterialFlushOptions flush_options;
106
 
  CoglMatrix               model_view;
107
 
  /* XXX: These entries are pretty big now considering the padding in
108
 
   * CoglMaterialFlushOptions and CoglMatrix, so we might need to optimize this
109
 
   * later. */
110
 
} CoglJournalEntry;
111
 
 
112
 
CoglTexture*
113
 
_cogl_texture_pointer_from_handle (CoglHandle handle);
114
 
 
115
 
void
116
 
_cogl_texture_set_wrap_mode_parameter (CoglTexture *tex,
117
 
                                       GLenum wrap_mode);
118
 
 
119
 
void
120
 
_cogl_texture_set_filters (CoglHandle handle,
121
 
                           GLenum min_filter,
122
 
                           GLenum mag_filter);
123
 
 
124
 
void
125
 
_cogl_texture_ensure_mipmaps (CoglHandle handle);
126
 
 
127
 
gboolean
128
 
_cogl_texture_span_has_waste (CoglTexture *tex,
129
 
                              gint x_span_index,
130
 
                              gint y_span_index);
131
 
 
132
 
void
133
 
_cogl_span_iter_begin (CoglSpanIter  *iter,
134
 
                       GArray        *array,
135
 
                       float          origin,
136
 
                       float          cover_start,
137
 
                       float          cover_end);
138
 
 
139
 
gboolean
140
 
_cogl_span_iter_end (CoglSpanIter *iter);
141
 
 
142
 
void
143
 
_cogl_span_iter_next (CoglSpanIter *iter);
144
 
 
145
 
#endif /* __COGL_TEXTURE_H */