Changeset 28db46b in mainline


Ignore:
Timestamp:
2020-01-25T22:26:50Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
01c2759
Parents:
2012fe0
Message:

Clear pointer by properly repainting what's under

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/seat.c

    r2012fe0 r28db46b  
    183183}
    184184
    185 /** Draw or clear seat pointer
    186  *
    187  * @param seat Seat
    188  * @param shown @c true to display pointer, @c false to clear it
    189  *
    190  * @return EOK on success or an error code
    191  */
    192 static errno_t ds_seat_draw_pointer(ds_seat_t *seat, bool shown)
     185/** Draw seat pointer
     186 *
     187 * @param seat Seat
     188 *
     189 * @return EOK on success or an error code
     190 */
     191static errno_t ds_seat_draw_pointer(ds_seat_t *seat)
    193192{
    194193        errno_t rc;
     
    204203                goto error;
    205204
    206         rc = ds_seat_draw_cross(seat, 8, 1, shown ? black :
    207             seat->display->bg_color);
    208         if (rc != EOK)
    209                 return rc;
    210 
    211         rc = ds_seat_draw_cross(seat, 8, 0, shown ? white :
    212             seat->display->bg_color);
    213         if (rc != EOK)
    214                 return rc;
     205        rc = ds_seat_draw_cross(seat, 8, 1, black);
     206        if (rc != EOK)
     207                goto error;
     208
     209        rc = ds_seat_draw_cross(seat, 8, 0, white);
     210        if (rc != EOK)
     211                goto error;
     212
     213        gfx_color_delete(black);
     214        gfx_color_delete(white);
    215215
    216216        return EOK;
     
    218218        if (black != NULL)
    219219                gfx_color_delete(black);
     220        if (white != NULL)
     221                gfx_color_delete(white);
    220222        return rc;
     223}
     224
     225/** Clear seat pointer
     226 *
     227 * @param seat Seat
     228 *
     229 * @return EOK on success or an error code
     230 */
     231static errno_t ds_seat_clear_pointer(ds_seat_t *seat)
     232{
     233        gfx_rect_t rect;
     234
     235        rect.p0.x = seat->pntpos.x - 8;
     236        rect.p0.y = seat->pntpos.y - 8;
     237        rect.p1.x = seat->pntpos.x + 8 + 1;
     238        rect.p1.y = seat->pntpos.y + 8 + 1;
     239
     240        return ds_display_paint(seat->display, &rect);
    221241}
    222242
     
    277297
    278298                printf("clear pointer\n");
    279                 (void) ds_seat_draw_pointer(seat, false);
     299                (void) ds_seat_clear_pointer(seat);
    280300                seat->pntpos = npos;
    281301
     
    291311
    292312                printf("draw pointer\n");
    293                 (void) ds_seat_draw_pointer(seat, true);
     313                (void) ds_seat_draw_pointer(seat);
    294314        }
    295315
Note: See TracChangeset for help on using the changeset viewer.