Changeset 7dba813 in mainline
- Timestamp:
- 2012-11-22T09:03:39Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ba733e83
- Parents:
- 8e6ec6e
- Location:
- uspace
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/fb/kfb/port.c
r8e6ec6e r7dba813 163 163 /* Faster damage routine ignoring offsets. */ 164 164 for (sysarg_t y = y0; y < height + y0; ++y) { 165 pixel_t *pixel = pixelmap_pixel_at(map, x0, y); 165 166 for (sysarg_t x = x0; x < width + x0; ++x) { 166 kfb.pixel2visual(kfb.addr + FB_POS(x, y), 167 *pixelmap_pixel_at(map, x, y)); 167 kfb.pixel2visual(kfb.addr + FB_POS(x, y), *pixel++); 168 168 } 169 169 } -
uspace/lib/draw/drawctx.c
r8e6ec6e r7dba813 129 129 } 130 130 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 } 151 146 } 152 147 } 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 153 175 } 154 176 } -
uspace/lib/draw/source.c
r8e6ec6e r7dba813 90 90 } 91 91 92 bool source_is_fast(source_t *source) 93 { 94 return (source->mask == NULL) 95 && (source->alpha == (pixel_t) PIXEL(255, 0, 0, 0)) 96 && (source->texture != NULL) 97 && (source->texture_tile == false) 98 && transform_is_fast(&source->transform); 99 } 100 101 pixel_t *source_direct_access(source_t *source, double x, double y) 102 { 103 assert(source_is_fast(source)); 104 105 long _x = (long) (x + source->transform.m[0][2]); 106 long _y = (long) (y + source->transform.m[1][2]); 107 108 pixelmap_t *pixmap = surface_pixmap_access(source->texture); 109 if (_x < 0 || _x >= (long) pixmap->width || _y < 0 || _y >= (long) pixmap->height) { 110 return NULL; 111 } 112 113 return pixelmap_pixel_at(pixmap, (sysarg_t) _x, (sysarg_t) _y); 114 } 115 92 116 pixel_t source_determine_pixel(source_t *source, double x, double y) 93 117 { -
uspace/lib/draw/source.h
r8e6ec6e r7dba813 71 71 extern void source_set_mask(source_t *, surface_t *, bool); 72 72 73 extern bool source_is_fast(source_t *); 74 extern pixel_t *source_direct_access(source_t *, double, double); 73 75 extern pixel_t source_determine_pixel(source_t *, double, double); 74 76 -
uspace/lib/draw/surface.c
r8e6ec6e r7dba813 143 143 } 144 144 145 void surface_add_damaged_region(surface_t *surface, surface_coord_t x, surface_coord_t y, 146 surface_coord_t width, surface_coord_t height) 147 { 148 surface->dirty_x_lo = surface->dirty_x_lo > x ? x : surface->dirty_x_lo; 149 surface->dirty_y_lo = surface->dirty_y_lo > y ? y : surface->dirty_y_lo; 150 151 surface_coord_t x_hi = x + width - 1; 152 surface_coord_t y_hi = y + height - 1; 153 154 surface->dirty_x_hi = surface->dirty_x_hi < x_hi ? x_hi : surface->dirty_x_hi; 155 surface->dirty_y_hi = surface->dirty_y_hi < y_hi ? y_hi : surface->dirty_y_hi; 156 } 157 145 158 void surface_reset_damaged_region(surface_t *surface) 146 159 { -
uspace/lib/draw/surface.h
r8e6ec6e r7dba813 61 61 extern void surface_get_damaged_region(surface_t *, surface_coord_t *, surface_coord_t *, 62 62 surface_coord_t *, surface_coord_t *); 63 extern void surface_add_damaged_region(surface_t *, surface_coord_t , surface_coord_t , 64 surface_coord_t , surface_coord_t ); 63 65 extern void surface_reset_damaged_region(surface_t *); 64 66 -
uspace/lib/gui/terminal.c
r8e6ec6e r7dba813 196 196 uint16_t glyph = fb_font_glyph(field->ch); 197 197 198 // FIXME: This font drawing routine is shamelessly199 // suboptimal. It should be optimized for200 // aligned memory transfers, etc.201 202 198 for (unsigned int y = 0; y < FONT_SCANLINES; y++) { 203 for (unsigned int x = 0; x < FONT_WIDTH; x++) { 204 pixel_t pixel = 205 (fb_font[glyph][y] & (1 << (7 - x))) ? fgcolor : bgcolor; 206 surface_put_pixel(surface, bx + x, by + y, pixel); 199 pixel_t *dst = pixelmap_pixel_at( 200 surface_pixmap_access(surface), bx, by + y); 201 int count = FONT_WIDTH; 202 while (count-- != 0) { 203 *dst++ = (fb_font[glyph][y] & (1 << count)) ? fgcolor : bgcolor; 207 204 } 208 205 } 206 surface_add_damaged_region(surface, bx, by, FONT_WIDTH, FONT_SCANLINES); 209 207 } 210 208 -
uspace/lib/softrend/transform.c
r8e6ec6e r7dba813 136 136 } 137 137 138 bool transform_is_fast(transform_t *t) 139 { 140 return (t->m[0][0] == 1) && (t->m[0][1] == 0) 141 && (t->m[1][0] == 0) && (t->m[1][1] == 1) 142 && ((t->m[0][2] - ((long) t->m[0][2])) == 0.0) 143 && ((t->m[1][2] - ((long) t->m[1][2])) == 0.0); 144 } 145 138 146 void transform_apply_linear(const transform_t *t, double *x, double *y) 139 147 { -
uspace/lib/softrend/transform.h
r8e6ec6e r7dba813 37 37 #define SOFTREND_TRANSFORM_H_ 38 38 39 #include <bool.h> 40 39 41 #ifndef PI 40 42 #define PI 3.141592653589793 … … 53 55 extern void transform_rotate(transform_t *, double); 54 56 57 extern bool transform_is_fast(transform_t *); 58 55 59 extern void transform_apply_linear(const transform_t *, double *, double *); 56 60 extern void transform_apply_affine(const transform_t *, double *, double *); -
uspace/srv/hid/compositor/compositor.c
r8e6ec6e r7dba813 314 314 /* Paint background color. */ 315 315 for (sysarg_t y = y_dmg_vp - vp->pos.y; y < y_dmg_vp - vp->pos.y + h_dmg_vp; ++y) { 316 for (sysarg_t x = x_dmg_vp - vp->pos.x; x < x_dmg_vp - vp->pos.x + w_dmg_vp; ++x) { 317 surface_put_pixel(vp->surface, x, y, bg_color); 316 pixel_t *dst = pixelmap_pixel_at( 317 surface_pixmap_access(vp->surface), x_dmg_vp - vp->pos.x, y); 318 sysarg_t count = w_dmg_vp; 319 while (count-- != 0) { 320 *dst++ = bg_color; 318 321 } 319 322 } 323 surface_add_damaged_region(vp->surface, 324 x_dmg_vp - vp->pos.x, y_dmg_vp - vp->pos.y, w_dmg_vp, h_dmg_vp); 320 325 321 326 transform_t transform; … … 381 386 if (isec_ptr) { 382 387 /* Pointer is currently painted directly by copying pixels. 383 * However, it is possible to draw the p ainter similarly388 * However, it is possible to draw the pointer similarly 384 389 * as window by using drawctx_transfer. It would allow 385 390 * more sophisticated control over drawing, but would also 386 391 * cost more regarding the performance. */ 387 392 388 pixel_t pix = 0;389 393 sysarg_t x_vp = x_dmg_ptr - vp->pos.x; 390 394 sysarg_t y_vp = y_dmg_ptr - vp->pos.y; … … 393 397 394 398 for (sysarg_t y = 0; y < h_dmg_ptr; ++y) { 395 for (sysarg_t x = 0; x < w_dmg_ptr; ++x) { 396 pix = surface_get_pixel(sf_ptr, x_ptr + x, y_ptr + y); 397 if (ALPHA(pix) == 255) { 398 surface_put_pixel(vp->surface, x_vp + x, y_vp + y, pix); 399 } 399 pixel_t *src = pixelmap_pixel_at( 400 surface_pixmap_access(sf_ptr), x_ptr, y_ptr + y); 401 pixel_t *dst = pixelmap_pixel_at( 402 surface_pixmap_access(vp->surface), x_vp, y_vp + y); 403 sysarg_t count = w_dmg_ptr; 404 while (count-- != 0) { 405 *dst = (*src & 0xff000000) ? *src : *dst; 406 ++dst; ++src; 400 407 } 401 408 } 409 surface_add_damaged_region(vp->surface, x_vp, y_vp, w_dmg_ptr, h_dmg_ptr); 402 410 } 403 411 }
Note:
See TracChangeset
for help on using the changeset viewer.