Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/draw/source.c

    r6d5e378 rb3222a3  
    4545        source->color = PIXEL(0, 0, 0, 0);
    4646        source->texture = NULL;
    47         source->texture_tile = false;
     47        source->texture_extend = PIXELMAP_EXTEND_TRANSPARENT_BLACK;
    4848
    4949        source->alpha = PIXEL(255, 0, 0, 0);
    5050        source->mask = NULL;
    51         source->mask_tile = false;
     51        source->mask_extend = PIXELMAP_EXTEND_TRANSPARENT_BLACK;
    5252}
    5353
     
    7373}
    7474
    75 void source_set_texture(source_t *source, surface_t *texture, bool tile)
     75void source_set_texture(source_t *source, surface_t *texture,
     76    pixelmap_extend_t extend)
    7677{
    7778        source->texture = texture;
    78         source->texture_tile = tile;
     79        source->texture_extend = extend;
    7980}
    8081
     
    8485}
    8586
    86 void source_set_mask(source_t *source, surface_t *mask, bool tile)
     87void source_set_mask(source_t *source, surface_t *mask,
     88    pixelmap_extend_t extend)
    8789{
    8890        source->mask = mask;
    89         source->mask_tile = tile;
     91        source->mask_extend = extend;
     92}
     93
     94bool source_is_fast(source_t *source)
     95{
     96        return ((source->mask == NULL) &&
     97            (source->alpha == (pixel_t) PIXEL(255, 0, 0, 0)) &&
     98            (source->texture != NULL) &&
     99            (transform_is_fast(&source->transform)));
     100}
     101
     102pixel_t *source_direct_access(source_t *source, double x, double y)
     103{
     104        assert(source_is_fast(source));
     105
     106        long _x = (long) (x + source->transform.matrix[0][2]);
     107        long _y = (long) (y + source->transform.matrix[1][2]);
     108
     109        return pixelmap_pixel_at(
     110            surface_pixmap_access(source->texture), (sysarg_t) _x, (sysarg_t) _y);
    90111}
    91112
     
    100121                mask_pix = source->filter(
    101122                    surface_pixmap_access(source->mask),
    102                     x, y, source->mask_tile);
     123                    x, y, source->mask_extend);
    103124        } else {
    104125                mask_pix = source->alpha;
     
    113134                texture_pix = source->filter(
    114135                    surface_pixmap_access(source->texture),
    115                     x, y, source->texture_tile);
     136                    x, y, source->texture_extend);
    116137        } else {
    117138                texture_pix = source->color;
Note: See TracChangeset for help on using the changeset viewer.