Changeset ba733e83 in mainline


Ignore:
Timestamp:
2012-11-23T10:08:02Z (11 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
563573b
Parents:
7dba813
Message:

Improved safety of the optimized pixel transfers.

Location:
uspace/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/pixelmap.h

    r7dba813 rba733e83  
    5252    sysarg_t y)
    5353{
    54         size_t offset = y * pixelmap->width + x;
    55         pixel_t *pixel = pixelmap->data + offset;
    56         return pixel;
     54        if (x < pixelmap->width && y < pixelmap->height) {
     55                size_t offset = y * pixelmap->width + x;
     56                pixel_t *pixel = pixelmap->data + offset;
     57                return pixel;
     58        } else {
     59                return NULL;
     60        }
    5761}
    5862
  • uspace/lib/draw/surface.c

    r7dba813 rba733e83  
    171171        surface->dirty_y_hi = surface->dirty_y_hi < y ? y : surface->dirty_y_hi;
    172172
    173         if (x < surface->pixmap.width && y < surface->pixmap.height) {
    174                 pixelmap_put_pixel(&surface->pixmap, x, y, pixel);
    175         }
     173        pixelmap_put_pixel(&surface->pixmap, x, y, pixel);
    176174}
    177175
    178176pixel_t surface_get_pixel(surface_t *surface, surface_coord_t x, surface_coord_t y)
    179177{
    180         if (x < surface->pixmap.width && y < surface->pixmap.height) {
    181                 return pixelmap_get_pixel(&surface->pixmap, x, y);
    182         } else {
    183                 return 0;
    184         }
     178        return pixelmap_get_pixel(&surface->pixmap, x, y);
    185179}
    186180
  • uspace/lib/gui/terminal.c

    r7dba813 rba733e83  
    199199                pixel_t *dst = pixelmap_pixel_at(
    200200                    surface_pixmap_access(surface), bx, by + y);
     201                pixel_t *dst_max = pixelmap_pixel_at(
     202                    surface_pixmap_access(surface), bx + FONT_WIDTH - 1, by + y);
     203                if (!dst || !dst_max) continue;
    201204                int count = FONT_WIDTH;
    202205                while (count-- != 0) {
Note: See TracChangeset for help on using the changeset viewer.