Changeset 0576df9 in mainline for uspace/app/launcher


Ignore:
Timestamp:
2020-11-14T21:28:35Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63b35c7
Parents:
38f5598
Message:

Decoding images without libdraw

Location:
uspace/app/launcher
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/launcher/launcher.c

    r38f5598 r0576df9  
    3636#include <errno.h>
    3737#include <gfx/coord.h>
     38#include <gfximage/tga.h>
    3839#include <stdbool.h>
    3940#include <stdio.h>
     
    4243#include <str_error.h>
    4344#include <task.h>
    44 
    45 #include <draw/surface.h>
    46 #include <draw/source.h>
    47 #include <draw/drawctx.h>
    48 #include <draw/codec.h>
    49 
    5045#include <ui/fixed.h>
    5146#include <ui/image.h>
     
    157152        gfx_bitmap_params_t logo_params;
    158153        gfx_bitmap_t *logo_bmp;
    159         gfx_bitmap_alloc_t alloc;
    160154        gfx_context_t *gc;
    161         surface_coord_t w, h;
    162155        gfx_rect_t logo_rect;
    163156        gfx_rect_t rect;
     157        gfx_coord2_t off;
    164158        errno_t rc;
    165159
     
    182176        }
    183177
    184         surface_t *logo = decode_tga((void *) helenos_tga, helenos_tga_size,
    185             SURFACE_FLAG_SHARED);
    186         if (!logo) {
    187                 printf("Unable to decode logo.\n");
    188                 return 1;
    189         }
    190 
    191178        rc = ui_create(display_spec, &ui);
    192179        if (rc != EOK) {
     
    217204        gc = ui_window_get_gc(window);
    218205
    219         surface_get_resolution(logo, &w, &h);
     206        rc = decode_tga(gc, (void *) helenos_tga, helenos_tga_size,
     207            &logo_bmp, &logo_rect);
     208        if (rc != EOK) {
     209                printf("Unable to decode logo.\n");
     210                return 1;
     211        }
     212
    220213        gfx_bitmap_params_init(&logo_params);
    221         logo_params.rect.p1.x = w;
    222         logo_params.rect.p1.y = h;
    223         logo_rect = logo_params.rect;
    224 
    225         alloc.pitch = sizeof(uint32_t) * w;
    226         alloc.off0 = 0;
    227         alloc.pixels = surface_direct_access(logo);
    228 
    229         rc = gfx_bitmap_create(gc, &logo_params, &alloc, &logo_bmp);
    230         if (rc  != EOK) {
    231                 printf("Error creating bitmap.\n");
    232                 return 1;
    233         }
     214        logo_params.rect = logo_rect;
    234215
    235216        rc = ui_fixed_create(&launcher.fixed);
     
    245226        }
    246227
    247         rect.p0.x = 5;
    248         rect.p0.y = 32;
    249         rect.p1.x = 5 + w;
    250         rect.p1.y = 32 + h;
     228        off.x = 5;
     229        off.y = 32;
     230        gfx_rect_translate(&off, &logo_rect, &rect);
    251231        ui_image_set_rect(launcher.image, &rect);
    252232
  • uspace/app/launcher/meson.build

    r38f5598 r0576df9  
    2727#
    2828
    29 deps = [ 'draw', 'ui' ]
     29deps = [ 'gfximage', 'ui' ]
    3030
    3131_images = files('gfx/helenos.tga')
Note: See TracChangeset for help on using the changeset viewer.