aboutsummaryrefslogtreecommitdiff
path: root/src/wld/renderer.c
diff options
context:
space:
mode:
authorMichael Mackus <michaelmackus@gmail.com>2019-06-16 11:29:17 -0700
committerMichael Mackus <michaelmackus@gmail.com>2019-06-16 11:31:34 -0700
commit95dfa5e6560c1b19b52d8ec76ca725de1157f231 (patch)
tree9a8cc00b80464f1c6e77c53a3d04cc55c1e2e43d /src/wld/renderer.c
parentc5c548536c62f5b7281f43ab896c8daf927fcaee (diff)
downloadwterm-95dfa5e6560c1b19b52d8ec76ca725de1157f231.zip
wterm-95dfa5e6560c1b19b52d8ec76ca725de1157f231.tar.gz
wterm-95dfa5e6560c1b19b52d8ec76ca725de1157f231.tar.bz2
Update WLD library
Diffstat (limited to 'src/wld/renderer.c')
-rw-r--r--src/wld/renderer.c167
1 files changed, 94 insertions, 73 deletions
diff --git a/src/wld/renderer.c b/src/wld/renderer.c
index be4a03c..a038095 100644
--- a/src/wld/renderer.c
+++ b/src/wld/renderer.c
@@ -21,116 +21,137 @@
* SOFTWARE.
*/
-#include "wld/wld-private.h"
-
-void default_fill_region(struct wld_renderer *renderer, uint32_t color,
- pixman_region32_t *region) {
- pixman_box32_t *box;
- int num_boxes;
-
- box = pixman_region32_rectangles(region, &num_boxes);
-
- while (num_boxes--) {
- renderer->impl->fill_rectangle(renderer, color, box->x1, box->y1,
- box->x2 - box->x1, box->y2 - box->y1);
- ++box;
- }
+#include "wld-private.h"
+
+void default_fill_region(struct wld_renderer * renderer, uint32_t color,
+ pixman_region32_t * region)
+{
+ pixman_box32_t * box;
+ int num_boxes;
+
+ box = pixman_region32_rectangles(region, &num_boxes);
+
+ while (num_boxes--)
+ {
+ renderer->impl->fill_rectangle(renderer, color, box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+ ++box;
+ }
}
-void default_copy_region(struct wld_renderer *renderer, struct buffer *buffer,
+void default_copy_region(struct wld_renderer * renderer, struct buffer * buffer,
int32_t dst_x, int32_t dst_y,
- pixman_region32_t *region) {
- pixman_box32_t *box;
- int num_boxes;
-
- box = pixman_region32_rectangles(region, &num_boxes);
-
- while (num_boxes--) {
- renderer->impl->copy_rectangle(renderer, buffer, dst_x + box->x1,
- dst_y + box->y1, box->x1, box->y1,
- box->x2 - box->x1, box->y2 - box->y1);
- ++box;
- }
+ pixman_region32_t * region)
+{
+ pixman_box32_t * box;
+ int num_boxes;
+
+ box = pixman_region32_rectangles(region, &num_boxes);
+
+ while (num_boxes--)
+ {
+ renderer->impl->copy_rectangle(renderer, buffer,
+ dst_x + box->x1, dst_y + box->y1,
+ box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+ ++box;
+ }
}
-void renderer_initialize(struct wld_renderer *renderer,
- const struct wld_renderer_impl *impl) {
- *((const struct wld_renderer_impl **)&renderer->impl) = impl;
- renderer->target = NULL;
+void renderer_initialize(struct wld_renderer * renderer,
+ const struct wld_renderer_impl * impl)
+{
+ *((const struct wld_renderer_impl **) &renderer->impl) = impl;
+ renderer->target = NULL;
}
EXPORT
-void wld_destroy_renderer(struct wld_renderer *renderer) {
- renderer->impl->destroy(renderer);
+void wld_destroy_renderer(struct wld_renderer * renderer)
+{
+ renderer->impl->destroy(renderer);
}
EXPORT
-uint32_t wld_capabilities(struct wld_renderer *renderer,
- struct wld_buffer *buffer) {
- return renderer->impl->capabilities(renderer, (struct buffer *)buffer);
+uint32_t wld_capabilities(struct wld_renderer * renderer,
+ struct wld_buffer * buffer)
+{
+ return renderer->impl->capabilities(renderer, (struct buffer *) buffer);
}
EXPORT
-bool wld_set_target_buffer(struct wld_renderer *renderer,
- struct wld_buffer *buffer) {
- if (!renderer->impl->set_target(renderer, (struct buffer *)buffer))
- return false;
+bool wld_set_target_buffer(struct wld_renderer * renderer,
+ struct wld_buffer * buffer)
+{
+ if (!renderer->impl->set_target(renderer, (struct buffer *) buffer))
+ return false;
- renderer->target = buffer;
+ renderer->target = buffer;
- return true;
+ return true;
}
EXPORT
-bool wld_set_target_surface(struct wld_renderer *renderer,
- struct wld_surface *surface) {
- struct buffer *back_buffer;
+bool wld_set_target_surface(struct wld_renderer * renderer,
+ struct wld_surface * surface)
+{
+ struct buffer * back_buffer;
- if (!(back_buffer = surface->impl->back(surface)))
- return false;
+ if (!(back_buffer = surface->impl->back(surface)))
+ return false;
- return renderer->impl->set_target(renderer, back_buffer);
+ return renderer->impl->set_target(renderer, back_buffer);
}
EXPORT
-void wld_fill_rectangle(struct wld_renderer *renderer, uint32_t color,
- int32_t x, int32_t y, uint32_t width, uint32_t height) {
- renderer->impl->fill_rectangle(renderer, color, x, y, width, height);
+void wld_fill_rectangle(struct wld_renderer * renderer, uint32_t color,
+ int32_t x, int32_t y, uint32_t width, uint32_t height)
+{
+ renderer->impl->fill_rectangle(renderer, color, x, y, width, height);
}
EXPORT
-void wld_fill_region(struct wld_renderer *renderer, uint32_t color,
- pixman_region32_t *region) {
- renderer->impl->fill_region(renderer, color, region);
+void wld_fill_region(struct wld_renderer * renderer, uint32_t color,
+ pixman_region32_t * region)
+{
+ renderer->impl->fill_region(renderer, color, region);
}
EXPORT
-void wld_copy_rectangle(struct wld_renderer *renderer,
- struct wld_buffer *buffer, int32_t dst_x, int32_t dst_y,
- int32_t src_x, int32_t src_y, uint32_t width,
- uint32_t height) {
- renderer->impl->copy_rectangle(renderer, (struct buffer *)buffer, dst_x,
- dst_y, src_x, src_y, width, height);
+void wld_copy_rectangle(struct wld_renderer * renderer,
+ struct wld_buffer * buffer,
+ int32_t dst_x, int32_t dst_y,
+ int32_t src_x, int32_t src_y,
+ uint32_t width, uint32_t height)
+{
+ renderer->impl->copy_rectangle(renderer, (struct buffer *) buffer,
+ dst_x, dst_y, src_x, src_y, width, height);
}
EXPORT
-void wld_copy_region(struct wld_renderer *renderer, struct wld_buffer *buffer,
- int32_t dst_x, int32_t dst_y, pixman_region32_t *region) {
- renderer->impl->copy_region(renderer, (struct buffer *)buffer, dst_x, dst_y,
- region);
+void wld_copy_region(struct wld_renderer * renderer,
+ struct wld_buffer * buffer,
+ int32_t dst_x, int32_t dst_y, pixman_region32_t * region)
+{
+ renderer->impl->copy_region(renderer, (struct buffer *) buffer,
+ dst_x, dst_y, region);
}
EXPORT
-void wld_draw_text(struct wld_renderer *renderer, struct wld_font *font_base,
- uint32_t color, int32_t x, int32_t y, const char *text,
- uint32_t length, struct wld_extents *extents) {
- struct font *font = (void *)font_base;
-
- renderer->impl->draw_text(renderer, font, color, x, y, text, length, extents);
+void wld_draw_text(struct wld_renderer * renderer,
+ struct wld_font * font_base, uint32_t color,
+ int32_t x, int32_t y, const char * text, uint32_t length,
+ struct wld_extents * extents)
+{
+ struct font * font = (void *) font_base;
+
+ renderer->impl->draw_text(renderer, font, color, x, y, text, length,
+ extents);
}
EXPORT
-void wld_flush(struct wld_renderer *renderer) {
- renderer->impl->flush(renderer);
- renderer->impl->set_target(renderer, NULL);
+void wld_flush(struct wld_renderer * renderer)
+{
+ renderer->impl->flush(renderer);
+ renderer->impl->set_target(renderer, NULL);
}
+