Lines Matching refs:s
26 static void read_pixel(const surface_t* s, context_t* c,
28 static void write_pixel(const surface_t* s, context_t* c,
30 static void readRGB565(const surface_t* s, context_t* c,
32 static void readABGR8888(const surface_t* s, context_t* c,
35 static uint32_t logic_op(int op, uint32_t s, uint32_t d);
73 static void pick_read_write(surface_t* s) in pick_read_write() argument
76 switch (s->format) { in pick_read_write()
77 case GGL_PIXEL_FORMAT_RGBA_8888: s->read = readABGR8888; break; in pick_read_write()
78 case GGL_PIXEL_FORMAT_RGB_565: s->read = readRGB565; break; in pick_read_write()
79 default: s->read = read_pixel; break; in pick_read_write()
81 s->write = write_pixel; in pick_read_write()
87 surface_t& s = c->state.texture[i].surface; in ggl_pick_texture() local
88 if ((!c->state.texture[i].enable) || (!s.dirty)) in ggl_pick_texture()
90 s.dirty = 0; in ggl_pick_texture()
91 pick_read_write(&s); in ggl_pick_texture()
93 gen.width = s.width; in ggl_pick_texture()
94 gen.height = s.height; in ggl_pick_texture()
95 gen.stride = s.stride; in ggl_pick_texture()
96 gen.data = uintptr_t(s.data); in ggl_pick_texture()
102 surface_t& s = c->state.buffers.color; in ggl_pick_cb() local
103 if (s.dirty) { in ggl_pick_cb()
104 s.dirty = 0; in ggl_pick_cb()
105 pick_read_write(&s); in ggl_pick_cb()
111 void read_pixel(const surface_t* s, context_t* c, in read_pixel() argument
114 assert((x < s->width) && (y < s->height)); in read_pixel()
116 const GGLFormat* f = &(c->formats[s->format]); in read_pixel()
117 int32_t index = x + (s->stride * y); in read_pixel()
118 uint8_t* const data = s->data + index * f->size; in read_pixel()
127 pixel->s[i] = f->c[i].h - f->c[i].l; in read_pixel()
128 if (pixel->s[i]) in read_pixel()
133 void readRGB565(const surface_t* s, context_t* /*c*/, in readRGB565() argument
136 uint16_t v = *(reinterpret_cast<uint16_t*>(s->data) + (x + (s->stride * y))); in readRGB565()
141 pixel->s[0] = 0; in readRGB565()
142 pixel->s[1] = 5; in readRGB565()
143 pixel->s[2] = 6; in readRGB565()
144 pixel->s[3] = 5; in readRGB565()
147 void readABGR8888(const surface_t* s, context_t* /*c*/, in readABGR8888() argument
150 uint32_t v = *(reinterpret_cast<uint32_t*>(s->data) + (x + (s->stride * y))); in readABGR8888()
156 pixel->s[0] = in readABGR8888()
157 pixel->s[1] = in readABGR8888()
158 pixel->s[2] = in readABGR8888()
159 pixel->s[3] = 8; in readABGR8888()
162 void write_pixel(const surface_t* s, context_t* c, in write_pixel() argument
165 assert((x < s->width) && (y < s->height)); in write_pixel()
173 const GGLFormat* f = &(c->formats[s->format]); in write_pixel()
174 int32_t index = x + (s->stride * y); in write_pixel()
175 uint8_t* const data = s->data + index * f->size; in write_pixel()
191 int32_t pixelSize = pixel->s[i]; in write_pixel()
228 static uint32_t logic_op(int op, uint32_t s, uint32_t d) in logic_op() argument
232 case GGL_AND: return s & d; in logic_op()
233 case GGL_AND_REVERSE: return s & ~d; in logic_op()
234 case GGL_COPY: return s; in logic_op()
235 case GGL_AND_INVERTED: return ~s & d; in logic_op()
237 case GGL_XOR: return s ^ d; in logic_op()
238 case GGL_OR: return s | d; in logic_op()
239 case GGL_NOR: return ~(s | d); in logic_op()
240 case GGL_EQUIV: return ~(s ^ d); in logic_op()
242 case GGL_OR_REVERSE: return s | ~d; in logic_op()
243 case GGL_COPY_INVERTED: return ~s; in logic_op()
244 case GGL_OR_INVERTED: return ~s | d; in logic_op()
245 case GGL_NAND: return ~(s & d); in logic_op()
248 return s; in logic_op()