Changeset 850235d in mainline for uspace/lib/draw/drawctx.c


Ignore:
Timestamp:
2013-03-10T14:56:21Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05bab88
Parents:
ea906c29 (diff), 2277e03 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    rea906c29 r850235d  
    129129        }
    130130
    131         bool clipped = false;
    132         bool masked = false;
    133 
    134         for (sysarg_t _y = y; _y < y + height; ++_y) {
    135                 for (sysarg_t _x = x; _x < x + width; ++_x) {
    136                         if (context->shall_clip) {
    137                                 clipped = _x < context->clip_x && _x >= context->clip_width
    138                                     && _y < context->clip_y && _y >= context->clip_height;
    139                         }
    140                        
    141                         if (context->mask) {
    142                                 pixel_t p = surface_get_pixel(context->mask, _x, _y);
    143                                 masked = p > 0 ? false : true;
    144                         }
    145 
    146                         if (!clipped && !masked) {
    147                                 pixel_t p_src = source_determine_pixel(context->source, _x, _y);
    148                                 pixel_t p_dst = surface_get_pixel(context->surface, _x, _y);
    149                                 pixel_t p_res = context->compose(p_src, p_dst);
    150                                 surface_put_pixel(context->surface, _x, _y, p_res);
     131        bool transfer_fast = source_is_fast(context->source)
     132            && (context->shall_clip == false)
     133            && (context->mask == NULL)
     134            && (context->compose == compose_src || context->compose == compose_over);
     135
     136        if (transfer_fast) {
     137
     138                for (sysarg_t _y = y; _y < y + height; ++_y) {
     139                        pixel_t *src = source_direct_access(context->source, x, _y);
     140                        pixel_t *dst = pixelmap_pixel_at(surface_pixmap_access(context->surface), x, _y);
     141                        if (src && dst) {
     142                                sysarg_t count = width;
     143                                while (count-- != 0) {
     144                                        *dst++ = *src++;
     145                                }
    151146                        }
    152147                }
     148                surface_add_damaged_region(context->surface, x, y, width, height);
     149
     150        } else {
     151
     152                bool clipped = false;
     153                bool masked = false;
     154                for (sysarg_t _y = y; _y < y + height; ++_y) {
     155                        for (sysarg_t _x = x; _x < x + width; ++_x) {
     156                                if (context->shall_clip) {
     157                                        clipped = _x < context->clip_x && _x >= context->clip_width
     158                                            && _y < context->clip_y && _y >= context->clip_height;
     159                                }
     160
     161                                if (context->mask) {
     162                                        pixel_t p = surface_get_pixel(context->mask, _x, _y);
     163                                        masked = p > 0 ? false : true;
     164                                }
     165
     166                                if (!clipped && !masked) {
     167                                        pixel_t p_src = source_determine_pixel(context->source, _x, _y);
     168                                        pixel_t p_dst = surface_get_pixel(context->surface, _x, _y);
     169                                        pixel_t p_res = context->compose(p_src, p_dst);
     170                                        surface_put_pixel(context->surface, _x, _y, p_res);
     171                                }
     172                        }
     173                }
     174
    153175        }
    154176}
Note: See TracChangeset for help on using the changeset viewer.