Changeset 0576df9 in mainline for uspace/app/barber/barber.c
- Timestamp:
- 2020-11-14T21:28:35Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63b35c7
- Parents:
- 38f5598
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/barber/barber.c
r38f5598 r0576df9 34 34 */ 35 35 36 #include <draw/surface.h>37 #include <draw/codec.h>38 36 #include <device/led_dev.h> 39 37 #include <errno.h> 40 38 #include <fibril_synch.h> 39 #include <gfximage/tga_gz.h> 41 40 #include <io/pixel.h> 42 41 #include <loc.h> … … 94 93 static fibril_timer_t *frame_timer = NULL; 95 94 static ui_image_t *frame_img; 96 static surface_t *frames[FRAMES];97 95 static gfx_bitmap_t *frame_bmp[FRAMES]; 98 96 … … 123 121 static bool decode_frames(gfx_context_t *gc) 124 122 { 125 gfx_bitmap_alloc_t alloc; 126 surface_coord_t w, h; 127 gfx_bitmap_params_t params; 123 gfx_rect_t rect; 128 124 errno_t rc; 129 125 130 126 for (unsigned int i = 0; i < FRAMES; i++) { 131 frames[i] = decode_tga_gz(images[i].addr, images[i].size,132 SURFACE_FLAG_SHARED);133 if ( frames[i] == NULL) {127 rc = decode_tga_gz(gc, images[i].addr, images[i].size, 128 &frame_bmp[i], &rect); 129 if (rc != EOK) { 134 130 printf("Unable to decode frame %u.\n", i); 135 131 return false; 136 132 } 137 133 138 surface_get_resolution(frames[i], &w, &h); 139 gfx_bitmap_params_init(¶ms); 140 params.rect.p1.x = w; 141 params.rect.p1.y = h; 142 143 alloc.pitch = sizeof(uint32_t) * w; 144 alloc.off0 = 0; 145 alloc.pixels = surface_direct_access(frames[i]); 146 147 rc = gfx_bitmap_create(gc, ¶ms, &alloc, &frame_bmp[i]); 148 if (rc != EOK) { 149 printf("Error creating bitmap.\n"); 150 return false; 151 } 134 (void) rect; 152 135 } 153 136 … … 162 145 gfx_bitmap_destroy(frame_bmp[i]); 163 146 frame_bmp[i] = NULL; 164 165 surface_destroy(frames[i]);166 frames[i] = NULL;167 147 } 168 148 }
Note:
See TracChangeset
for help on using the changeset viewer.