summaryrefslogtreecommitdiff
path: root/src/lib/ector/ector_buffer.h
blob: 0db6cc7d69bb1171fd8a42d4aa98d13b23f89f47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef ECTOR_BUFFER_H
#define ECTOR_BUFFER_H

#include <Ector.h>

#include "ector_generic_buffer.eo.h"
#include "software/ector_software_buffer_base.eo.h"

/**
 * @typedef Ector_Buffer
 * A generic pixel buffer type (2D). May be readable or writeable or both.
 */
typedef Ector_Generic_Buffer Ector_Buffer;

typedef struct _Ector_Generic_Buffer_Data Ector_Generic_Buffer_Data;
typedef struct _Ector_Software_Buffer_Base_Data Ector_Software_Buffer_Base_Data;
typedef struct _Ector_GL_Buffer_Base_Data Ector_GL_Buffer_Base_Data;

struct _Ector_Generic_Buffer_Data
{
   Ector_Buffer       *eo;
   unsigned int        w, h;
   unsigned char       l, r, t, b;
   Efl_Gfx_Colorspace  cspace;
   Eina_Bool           immutable : 1; // pixels_set is forbidden
};

struct _Ector_Software_Buffer_Base_Data
{
   Ector_Generic_Buffer_Data *generic;
   union {
      unsigned int     *u32;
      unsigned char    *u8;
   } pixels;
   unsigned int         stride;
   unsigned int         pixel_size; // in bytes
   struct {
      Eina_Inlist      *maps; // Ector_Software_Buffer_Map
   } internal;
   Eina_Bool            writable : 1; // pixels can be written to
   Eina_Bool            nofree : 1; // pixel data should not be free()'ed
};

struct _Ector_GL_Buffer_Base_Data
{
   Ector_Generic_Buffer_Data *generic;
   int texid;
   int fboid;
   struct {
      // x,y offset within the atlas
      // w,h size of the atlas itself
      int x, y, w, h;
   } atlas;
   Eina_Bool whole : 1;
};

#endif