Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
image.cc
Go to the documentation of this file.
1 
18 #include "ion/gfx/image.h"
19 
20 #include "ion/base/enumhelper.h"
21 #include "ion/base/invalid.h"
22 #include "ion/base/logging.h"
23 #include "ion/base/static_assert.h"
24 #include "ion/portgfx/glheaders.h"
25 
26 namespace ion {
27 namespace gfx {
28 
29 const uint32 Image::kNumFormats = kEglImage + 1;
30 
32  : format_(kRgb888),
33  width_(0),
34  height_(0),
35  depth_(0),
36  data_size_(0),
37  type_(kDense),
38  dims_(k2d) {}
39 
41  if (base::DataContainer* data = data_.Get()) data->RemoveReceiver(this);
42 }
43 
44 void Image::Set(Format format, uint32 width, uint32 height,
45  const base::DataContainerPtr& data) {
46  SetData(kDense, k2d, format, width, height, 1, data);
47 }
48 
49 void Image::Set(Format format, uint32 width, uint32 height, uint32 depth,
50  const base::DataContainerPtr& data) {
51  SetData(kDense, k3d, format, width, height, depth, data);
52 }
53 
54 void Image::SetArray(Format format, uint32 width, uint32 num_planes,
55  const base::DataContainerPtr& data) {
56  SetData(kArray, k2d, format, width, num_planes, 1, data);
57 }
58 void Image::SetArray(Format format, uint32 width, uint32 height,
59  uint32 num_planes, const base::DataContainerPtr& data) {
60  Set(format, width, height, num_planes, data);
61  SetData(kArray, k3d, format, width, height, num_planes, data);
62 }
63 
67  SetData(kEgl, k2d, kEglImage, 0, 0, 0, image);
68 }
69 
73  SetData(kExternalEgl, k2d, kEglImage, 0, 0, 0, external_image);
74 }
75 
79  static const PixelFormat kPixelFormats[] = {
80  /* kAlpha */ {GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE},
81  /* kLuminance */ {GL_LUMINANCE, GL_LUMINANCE,
82  GL_UNSIGNED_BYTE},
83  /* kLuminanceAlpha */ {GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA,
84  GL_UNSIGNED_BYTE},
85  /* kRgb888 */ {GL_RGB, GL_RGB, GL_UNSIGNED_BYTE},
86  /* kRgba8888 */ {GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE},
87  /* kRgb565 */ {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5},
88  /* kRgba4444 */ {GL_RGBA, GL_RGBA,
89  GL_UNSIGNED_SHORT_4_4_4_4},
90  /* kRgba5551 */ {GL_RGBA, GL_RGBA,
91  GL_UNSIGNED_SHORT_5_5_5_1},
92  /* kRgbaFloat */ {GL_RGBA, GL_RGBA, GL_FLOAT},
93  /* kR8 */ {GL_R8, GL_RED, GL_UNSIGNED_BYTE},
94  /* kRSigned8 */ {GL_R8_SNORM, GL_RED, GL_BYTE},
95  /* kR8i */ {GL_R8I, GL_RED_INTEGER, GL_BYTE},
96  /* kR8ui */ {GL_R8UI, GL_RED_INTEGER,
97  GL_UNSIGNED_BYTE},
98  /* kR16fFloat */ {GL_R16F, GL_RED, GL_FLOAT},
99  /* kR16fHalf */ {GL_R16F, GL_RED, GL_HALF_FLOAT},
100  /* kR16i */ {GL_R16I, GL_RED_INTEGER, GL_SHORT},
101  /* kR16ui */ {GL_R16UI, GL_RED_INTEGER,
102  GL_UNSIGNED_SHORT},
103  /* kR32f */ {GL_R32F, GL_RED, GL_FLOAT},
104  /* kR32i */ {GL_R32I, GL_RED_INTEGER, GL_INT},
105  /* kR32ui */ {GL_R32UI, GL_RED_INTEGER,
106  GL_UNSIGNED_INT},
107  /* kRg8 */ {GL_RG8, GL_RG, GL_UNSIGNED_BYTE},
108  /* kRgSigned8 */ {GL_RG8_SNORM, GL_RG, GL_BYTE},
109  /* kRg8i */ {GL_RG8I, GL_RG_INTEGER, GL_BYTE},
110  /* kRg8ui */ {GL_RG8UI, GL_RG_INTEGER,
111  GL_UNSIGNED_BYTE},
112  /* kRg16fFloat */ {GL_RG16F, GL_RG, GL_FLOAT},
113  /* kRg16fHalf */ {GL_RG16F, GL_RG, GL_HALF_FLOAT},
114  /* kRg16i */ {GL_RG16I, GL_RG_INTEGER, GL_SHORT},
115  /* kRg16ui */ {GL_RG16UI, GL_RG_INTEGER,
116  GL_UNSIGNED_SHORT},
117  /* kRg32f */ {GL_RG32F, GL_RG, GL_FLOAT},
118  /* kRg32i */ {GL_RG32I, GL_RG_INTEGER, GL_INT},
119  /* kRg32ui */ {GL_RG32UI, GL_RG_INTEGER,
120  GL_UNSIGNED_INT},
121  /* kRgb8 */ {GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE},
122  /* kRgbSigned8 */ {GL_RGB8_SNORM, GL_RGB, GL_BYTE},
123  /* kRgb8i */ {GL_RGB8I, GL_RGB_INTEGER, GL_BYTE},
124  /* kRgb8ui */ {GL_RGB8UI, GL_RGB_INTEGER,
125  GL_UNSIGNED_BYTE},
126  /* kRgb16fFloat */ {GL_RGB16F, GL_RGB, GL_FLOAT},
127  /* kRgb16fHalf */ {GL_RGB16F, GL_RGB, GL_HALF_FLOAT},
128  /* kRgb16i */ {GL_RGB16I, GL_RGB_INTEGER, GL_SHORT},
129  /* kRgb16ui */ {GL_RGB16UI, GL_RGB_INTEGER,
130  GL_UNSIGNED_SHORT},
131  /* kRgb32f */ {GL_RGB32F, GL_RGB, GL_FLOAT},
132  /* kRgb32i */ {GL_RGB32I, GL_RGB_INTEGER, GL_INT},
133  /* kRgb32ui */ {GL_RGB32UI, GL_RGB_INTEGER,
134  GL_UNSIGNED_INT},
135  /* kRgba8 */ {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE},
136  /* kRgbaSigned8 */ {GL_RGBA8_SNORM, GL_RGBA, GL_BYTE},
137  /* kRgba8i */ {GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE},
138  /* kRgba8ui */ {GL_RGBA8UI, GL_RGBA_INTEGER,
139  GL_UNSIGNED_BYTE},
140  /* kRgb10a2 */ {GL_RGB10_A2, GL_RGBA,
141  GL_UNSIGNED_INT_2_10_10_10_REV},
142  /* kRgb10a2ui */ {GL_RGB10_A2UI, GL_RGBA_INTEGER,
143  GL_UNSIGNED_INT_2_10_10_10_REV},
144  /* kRgba16fFloat */ {GL_RGBA16F, GL_RGBA, GL_FLOAT},
145  /* kRgba16fHalf */ {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT},
146  /* kRgba16i */ {GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT},
147  /* kRgba16ui */ {GL_RGBA16UI, GL_RGBA_INTEGER,
148  GL_UNSIGNED_SHORT},
149  /* kRgba32f */ {GL_RGBA32F, GL_RGBA, GL_FLOAT},
150  /* kRgba32i */ {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT},
151  /* kRgba32ui */ {GL_RGBA32UI, GL_RGBA_INTEGER,
152  GL_UNSIGNED_INT},
153  /* kRenderbufferDepth16 */ {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT,
154  GL_UNSIGNED_SHORT},
155  /* kRenderbufferDepth24 */ {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT,
156  GL_UNSIGNED_INT},
157  /* kRenderbufferDepth32f */ {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT,
158  GL_FLOAT},
159  /* kRenderbufferDepth24Stencil8 */ {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL,
160  GL_UNSIGNED_INT_24_8},
161  /* kRenderbufferDepth32fStencil8*/ {GL_DEPTH32F_STENCIL8,
162  GL_DEPTH_STENCIL,
163  GL_FLOAT_32_UNSIGNED_INT_24_8_REV},
164  /* kTextureDepth16Int */ {GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT,
165  GL_UNSIGNED_INT},
166  /* kTextureDepth16Short */ {GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT,
167  GL_UNSIGNED_SHORT},
168  /* kStencil8 */ {GL_STENCIL_INDEX8, GL_STENCIL,
169  GL_UNSIGNED_BYTE},
170  /* kDxt1 */ {GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
171  GL_RGB,
172  GL_UNSIGNED_BYTE},
173  /* kDxt1Rgba */ {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
174  GL_RGBA,
175  GL_UNSIGNED_BYTE},
176  /* kDxt5 */ {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
177  GL_RGBA,
178  GL_UNSIGNED_BYTE},
179  /* kEtc1 */ {GL_ETC1_RGB8_OES, GL_RGB,
180  GL_UNSIGNED_BYTE},
181  /* kPvrtc1Rgb2 */ {GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
182  GL_RGB,
183  GL_UNSIGNED_BYTE},
184  /* kPvrtc1Rgb4 */ {GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
185  GL_RGB,
186  GL_UNSIGNED_BYTE},
187  /* kPvrtc1Rgba2 */ {GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
188  GL_RGBA,
189  GL_UNSIGNED_BYTE},
190  /* kPvrtc1Rgba4 */ {GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
191  GL_RGBA,
192  GL_UNSIGNED_BYTE},
193  /* kSrgb8 */ {GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE},
194  /* kSrgba8 */ {GL_SRGB8_ALPHA8, GL_RGBA,
195  GL_UNSIGNED_BYTE},
196  /* kRgb11f_11f_10f_Rev */ {GL_R11F_G11F_B10F, GL_RGB,
197  GL_UNSIGNED_INT_10F_11F_11F_REV},
198  /* kRgb11f_11f_10f_RevFloat */ {GL_R11F_G11F_B10F, GL_RGB, GL_FLOAT},
199  /* kRgb11f_11f_10f_RevHalf */ {GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT},
200  /* kRgb565Byte */ {GL_RGB565, GL_RGB, GL_UNSIGNED_BYTE},
201  /* kRgb565Short */ {GL_RGB565, GL_RGB,
202  GL_UNSIGNED_SHORT_5_6_5},
203  /* kRgb5a1Byte */ {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_BYTE},
204  /* kRgb5a1Short */ {GL_RGB5_A1, GL_RGBA,
205  GL_UNSIGNED_SHORT_5_5_5_1},
206  /* kRgb5a1Int */ {GL_RGB5_A1, GL_RGBA,
207  GL_UNSIGNED_INT_2_10_10_10_REV},
208  /* kRgb9e5Float */ {GL_RGB9_E5, GL_RGB, GL_FLOAT},
209  /* kRgb9e5Half */ {GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT},
210  /* kRgb9e5RevInt */ {GL_RGB9_E5, GL_RGB,
211  GL_UNSIGNED_INT_5_9_9_9_REV},
212  /* kRgba4Byte */ {GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE},
213  /* kRgba4Short */ {GL_RGBA4, GL_RGBA,
214  GL_UNSIGNED_SHORT_4_4_4_4}};
215  static const PixelFormat kInvalidPixelFormat = {0, 0, 0};
216 
217  return (format == kInvalid || format == kEglImage) ? kInvalidPixelFormat
218  : kPixelFormats[format];
219 }
220 
221 const char* Image::GetFormatString(Format format) {
222  static const char* kStrings[] = {
223  "Alpha",
224  "Luminance",
225  "LuminanceAlpha",
226  "Rgb888",
227  "Rgba8888",
228  "Rgb565",
229  "Rgba4444",
230  "Rgba5551",
231  "RgbaFloat",
232  "R8",
233  "RSigned8",
234  "R8i",
235  "R8ui",
236  "R16fFloat",
237  "R16fHalf",
238  "R16i",
239  "R16ui",
240  "R32f",
241  "R32i",
242  "R32ui",
243  "Rg8",
244  "RgSigned8",
245  "Rg8i",
246  "Rg8ui",
247  "Rg16fFloat",
248  "Rg16fHalf",
249  "Rg16i",
250  "Rg16ui",
251  "Rg32f",
252  "Rg32i",
253  "Rg32ui",
254  "Rgb8",
255  "RgbSigned8",
256  "Rgb8i",
257  "Rgb8ui",
258  "Rgb16fFloat",
259  "Rgb16fHalf",
260  "Rgb16i",
261  "Rgb16ui",
262  "Rgb32f",
263  "Rgb32i",
264  "Rgb32ui",
265  "Rgba8",
266  "RgbaSigned8",
267  "Rgba8i",
268  "Rgba8ui",
269  "Rgb10a2",
270  "Rgb10a2ui",
271  "Rgba16fFloat",
272  "Rgba16fHalf",
273  "Rgba16i",
274  "Rgba16ui",
275  "Rgba32f",
276  "Rgba32i",
277  "Rgba32ui",
278  "RenderbufferDepth16",
279  "RenderbufferDepth24",
280  "RenderbufferDepth32f",
281  "RenderbufferDepth24Stencil8",
282  "RenderbufferDepth32fStencil8",
283  "TextureDepth16Int",
284  "TextureDepth16Short",
285  "Stencil8",
286  "Dxt1",
287  "Dxt1Rgba",
288  "Dxt5",
289  "Etc1",
290  "Pvrtc1Rgb2",
291  "Pvrtc1Rgb4",
292  "Pvrtc1Rgba2",
293  "Pvrtc1Rgba4",
294  "Srgb8",
295  "Srgba8",
296  "Rgb11f_11f_10f_Rev",
297  "Rgb11f_11f_10f_RevFloat",
298  "Rgb11f_11f_10f_RevHalf",
299  "Rgb565Byte",
300  "Rgb565Short",
301  "Rgb5a1Byte",
302  "Rgb5a1Short",
303  "Rgb5a1Int",
304  "Rgb9e5Float",
305  "Rgb9e5Half",
306  "Rgb9e5RevInt",
307  "Rgba4Byte",
308  "Rgba4Short",
309  "EGLImage"
310  };
311  return static_cast<uint32>(format) >= kNumFormats ? "<UNKNOWN>"
312  : kStrings[format];
313 }
314 
316  switch (format) {
317  case kAlpha:
321  case kTextureDepth16Int:
323  case kStencil8:
324  case kLuminance:
325  case kR8:
326  case kRSigned8:
327  case kR8i:
328  case kR8ui:
329  case kR16fFloat:
330  case kR16fHalf:
331  case kR16i:
332  case kR16ui:
333  case kR32f:
334  case kR32i:
335  case kR32ui:
336  return 1;
337 
340  case kLuminanceAlpha:
341  case kRg8:
342  case kRgSigned8:
343  case kRg8i:
344  case kRg8ui:
345  case kRg16fFloat:
346  case kRg16fHalf:
347  case kRg16i:
348  case kRg16ui:
349  case kRg32f:
350  case kRg32i:
351  case kRg32ui:
352  return 2;
353 
354  case kDxt1:
355  case kEtc1:
356  case kPvrtc1Rgb2:
357  case kPvrtc1Rgb4:
358  case kRgb565:
359  case kRgb888:
360  case kRgb8:
361  case kRgbSigned8:
362  case kRgb8i:
363  case kRgb8ui:
364  case kRgb16fFloat:
365  case kRgb16fHalf:
366  case kRgb16i:
367  case kRgb16ui:
368  case kRgb32f:
369  case kRgb32i:
370  case kRgb32ui:
371  case kRgb11f_11f_10f_Rev:
374  case kRgb565Byte:
375  case kRgb565Short:
376  case kRgb9e5Float:
377  case kRgb9e5Half:
378  case kRgb9e5RevInt:
379  case kSrgb8:
380  return 3;
381 
382  case kDxt1Rgba:
383  case kDxt5:
384  case kPvrtc1Rgba2:
385  case kPvrtc1Rgba4:
386  case kRgb10a2:
387  case kRgb10a2ui:
388  case kRgba4444:
389  case kRgba5551:
390  case kRgba8888:
391  case kRgba8:
392  case kRgbaSigned8:
393  case kRgba8i:
394  case kRgba8ui:
395  case kRgba16fFloat:
396  case kRgba16fHalf:
397  case kRgba16i:
398  case kRgba16ui:
399  case kRgba32f:
400  case kRgba32i:
401  case kRgba32ui:
402  case kRgb5a1Byte:
403  case kRgb5a1Short:
404  case kRgb5a1Int:
405  case kRgba4Byte:
406  case kRgba4Short:
407  case kSrgba8:
408  case kRgbaFloat:
409  return 4;
410 
411  case kEglImage:
412  case kInvalid:
413  return 0;
414 
415  default:
416  DCHECK(false) << "Unknown format";
417  return 0;
418  }
419 }
420 
421 size_t Image::ComputeDataSize(Format format, uint32 width, uint32 height) {
422  switch (format) {
423  case kAlpha:
424  case kLuminance:
425  case kStencil8:
426  case kR8:
427  case kRSigned8:
428  case kR8i:
429  case kR8ui:
430  return width * height;
431 
432  case kDxt1:
433  case kDxt1Rgba:
434  case kEtc1:
436  return 8 * ((width + 3) / 4) * ((height + 3) / 4);
437 
438  case kDxt5:
440  return 16 * ((width + 3) / 4) * ((height + 3) / 4);
441 
443  case kTextureDepth16Int:
445  case kLuminanceAlpha:
446  case kRgb565:
447  case kRgba4444:
448  case kRgba5551:
449  case kR16fFloat:
450  case kR16fHalf:
451  case kR16i:
452  case kR16ui:
453  case kRg8:
454  case kRgSigned8:
455  case kRg8i:
456  case kRg8ui:
457  case kRgb565Byte:
458  case kRgb565Short:
459  case kRgb5a1Byte:
460  case kRgb5a1Int:
461  case kRgb5a1Short:
462  case kRgba4Byte:
463  case kRgba4Short:
464  return 2 * width * height;
465 
466  case kPvrtc1Rgb2:
467  case kPvrtc1Rgba2:
468  return width * height / 4;
469 
470  case kPvrtc1Rgb4:
471  case kPvrtc1Rgba4:
472  return width * height / 2;
473 
474  case kRgb888:
475  case kRgb8:
476  case kRgbSigned8:
477  case kRgb8i:
478  case kRgb8ui:
479  case kSrgb8:
480  return 3 * width * height;
481 
482  case kRgba8888:
483  case kR32f:
484  case kR32i:
485  case kR32ui:
486  case kRg16fHalf:
487  case kRg16fFloat:
488  case kRg16i:
489  case kRg16ui:
490  case kRgb10a2:
491  case kRgb10a2ui:
492  case kRgba8:
493  case kRgbaSigned8:
494  case kRgba8i:
495  case kRgba8ui:
499  case kRgb11f_11f_10f_Rev:
502  case kRgb9e5Float:
503  case kRgb9e5Half:
504  case kRgb9e5RevInt:
505  case kSrgba8:
506  return 4 * width * height;
507 
508  case kRgb16fFloat:
509  case kRgb16fHalf:
510  case kRgb16i:
511  case kRgb16ui:
512  return 6 * width * height;
513 
514  case kRg32f:
515  case kRg32i:
516  case kRg32ui:
517  case kRgba16fFloat:
518  case kRgba16fHalf:
519  case kRgba16i:
520  case kRgba16ui:
522  return 8 * width * height;
523 
524  case kRgb32f:
525  case kRgb32i:
526  case kRgb32ui:
527  return 12 * width * height;
528 
529  case kRgba32f:
530  case kRgba32i:
531  case kRgba32ui:
532  case kRgbaFloat:
533  return 16 * width * height;
534 
535  case kEglImage:
536  case kInvalid:
537  return 0U;
538 
539  default:
540  DCHECK(false) << "Unknown format";
541  return 0U;
542  }
543 }
544 
545 size_t Image::ComputeDataSize(Format format, uint32 width, uint32 height,
546  uint32 depth) {
547  return ComputeDataSize(format, width, height) * depth;
548 }
549 
550 void Image::SetData(Type type, Dimensions dims, Format format, uint32 width,
551  uint32 height, uint32 depth,
552  const base::DataContainerPtr& data) {
553  type_ = type;
554  dims_ = dims;
555  format_ = format;
556  width_ = width;
557  height_ = height;
558  depth_ = depth;
559  if (base::DataContainer* old_data = data_.Get())
560  old_data->RemoveReceiver(this);
561  data_ = data;
562  if (base::DataContainer* new_data = data_.Get())
563  new_data->AddReceiver(this);
564  if (data_.Get() && data_->GetData())
565  data_size_ = ComputeDataSize(format, width, height, depth);
566  else
567  data_size_ = 0;
568  Notify();
569 }
570 
571 } // namespace gfx
572 
573 namespace base {
574 
575 using gfx::Image;
576 
578 template <> ION_API
579 const EnumHelper::EnumData<Image::Dimensions> EnumHelper::GetEnumData() {
580  static const GLenum kValues[] = {0, 0};
581  static const char* kStrings[] = {"2", "3"};
582  ION_STATIC_ASSERT(ARRAYSIZE(kValues) == ARRAYSIZE(kStrings),
583  "EnumHelper size mismatch");
584  return EnumData<Image::Dimensions>(
585  base::IndexMap<Image::Dimensions, GLenum>(kValues, ARRAYSIZE(kValues)),
586  kStrings);
587 }
588 
590 template <> ION_API
591 const EnumHelper::EnumData<Image::Type> EnumHelper::GetEnumData() {
592  static const GLenum kValues[] = {0, 0, 0, 0};
593  static const char* kStrings[] = {"Array", "Dense", "EGLImage",
594  "External EGLImage"};
595  ION_STATIC_ASSERT(ARRAYSIZE(kValues) == ARRAYSIZE(kStrings),
596  "EnumHelper size mismatch");
597  return EnumData<Image::Type>(
598  base::IndexMap<Image::Type, GLenum>(kValues, ARRAYSIZE(kValues)),
599  kStrings);
600 }
601 
602 } // namespace base
603 } // namespace ion
"Unsized" formats.
Definition: image.h:40
~Image() override
The destructor is protected because all base::Referent classes must have protected or private destruc...
Definition: image.cc:40
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
Definition: glheaders.h:195
Format
Supported image formats.
Definition: image.h:38
Image()
The default constructor creates an empty (0x0) dense 2D image with format kRgb888.
Definition: image.cc:31
bits exponent, half float data.
Definition: image.h:159
std::string type
Definition: printer.cc:353
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
Definition: glheaders.h:192
#define GL_LUMINANCE_ALPHA
Definition: glheaders.h:468
#define DCHECK(expr)
Definition: logging.h:331
Depth and depth/stencil renderbuffers.
Definition: image.h:107
bit alpha, packed 5551 uint16 data.
Definition: image.h:153
bit alpha, packed 2,10,10,10 uint32 data.
Definition: image.h:155
Four channel RGBA images.
Definition: image.h:92
void SetArray(Format format, uint32 width, uint32 num_planes, const base::DataContainerPtr &data)
Similar to Set(), but creates an array of 1D textures.
Definition: image.cc:54
Struct representing the GL types for a particular Format (see above).
Definition: image.h:192
void Notify() const
Notifies all contained Notifiers by calling their OnNotify().
Definition: notifier.cc:81
bit alpha, uint8 data.
Definition: image.h:151
Three channel RGB images.
Definition: image.h:79
static size_t ComputeDataSize(Format format, uint32 width, uint32 height)
Convenience functions that return the correct data size in bytes of an image having the given format ...
Definition: image.cc:421
The DataContainer class encapsulates arbitrary user data passed to Ion.
Definition: datacontainer.h:74
T * Get() const
Returns a raw pointer to the instance, which may be NULL.
Definition: sharedptr.h:89
This template class can be used to map between two kinds of indices when the following assumptions ap...
Definition: indexmap.h:40
Two-component red-green images.
Definition: image.h:66
bits exponent, packed 5999 uint32 data.
Definition: image.h:161
static const PixelFormat & GetPixelFormat(Format format)
Convenience function that returns a PixelFormat given a Format.
Definition: image.cc:76
have arbitrary format.
Definition: image.h:169
bits blue, packed 10f,11f,11f uint32 data.
Definition: image.h:141
bits exponent, float data.
Definition: image.h:157
4444 uint16 data.
Definition: image.h:166
const Grid & image
The original monochrome image data, as doubles (0 - 1).
Definition: sdfutils.cc:90
Packed sized images.
Definition: image.h:139
Compressed images.
Definition: image.h:123
void SetExternalEglImage(const base::DataContainerPtr &external_image)
Sets the image to be of external EGLImage type.
Definition: image.cc:70
bits blue, packed float data.
Definition: image.h:143
Copyright 2016 Google Inc.
bits blue, packed half float data.
Definition: image.h:145
void Set(Format format, uint32 width, uint32 height, const base::DataContainerPtr &data)
Sets the image to the given size and format and using the data in the given DataContainer, which is assumed to be the correct size.
Definition: image.cc:44
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
Definition: glheaders.h:198
int width
static int GetNumComponentsForFormat(Format format)
Convenience function that returns the number of components for a given format.
Definition: image.cc:315
Stencil images.
Definition: image.h:120
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
Definition: glheaders.h:189
compatibility, where both format and internal_format are GL_RGBA).
Definition: image.h:53
green, uint8 data.
Definition: image.h:147
#define ION_STATIC_ASSERT(expr, message)
Copyright 2016 Google Inc.
Definition: static_assert.h:35
void SetEglImage(const base::DataContainerPtr &image)
Sets the image to be of EGLImage type.
Definition: image.cc:64
#define GL_LUMINANCE
Definition: glheaders.h:465
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
Definition: sharedptr.h:60
static const uint32 kNumFormats
Definition: image.h:198
#define GL_ETC1_RGB8_OES
Definition: glheaders.h:345
static const char * GetFormatString(Format format)
Convenience function that returns a string representing the name of a given Format.
Definition: image.cc:221
green, packed 565 uint16 data.
Definition: image.h:149