Changeset d8ddf7a in mainline for uspace/lib/ui/src/image.c
- Timestamp:
- 2020-11-22T17:52:37Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2d879f7
- Parents:
- 4f64b7b8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/image.c
r4f64b7b8 rd8ddf7a 124 124 } 125 125 126 /** Set image flags. 127 * 128 * @param image Image 129 * @param flags Flags 130 */ 131 void ui_image_set_flags(ui_image_t *image, ui_image_flags_t flags) 132 { 133 image->flags = flags; 134 } 135 126 136 /** Paint image. 127 137 * … … 131 141 errno_t ui_image_paint(ui_image_t *image) 132 142 { 143 gfx_rect_t irect; 133 144 gfx_rect_t srect; 134 145 gfx_coord2_t offs; 146 errno_t rc; 147 148 if ((image->flags & ui_imgf_frame) != 0) { 149 rc = ui_paint_bevel(image->res->gc, &image->rect, 150 image->res->btn_frame_color, image->res->btn_frame_color, 151 1, NULL); 152 if (rc != EOK) 153 return rc; 154 } 135 155 136 156 if (image->bitmap == NULL) 137 157 return EOK; 158 159 irect = image->rect; 160 if ((image->flags & ui_imgf_frame) != 0) { 161 irect.p0.x++; 162 irect.p0.y++; 163 irect.p1.x--; 164 irect.p1.y--; 165 } 138 166 139 167 /* … … 141 169 * we need to subtract it. 142 170 */ 143 offs.x = i mage->rect.p0.x - image->brect.p0.x;144 offs.y = i mage->rect.p0.y - image->brect.p0.y;171 offs.x = irect.p0.x - image->brect.p0.x; 172 offs.y = irect.p0.y - image->brect.p0.y; 145 173 146 174 /* 147 * Trans alte image rectangle back to bitmap coordinate space.175 * Translate image rectangle back to bitmap coordinate space. 148 176 * Thus the bitmap will be clipped to the image rectangle. 149 177 */ 150 gfx_rect_rtranslate(&offs, &i mage->rect, &srect);178 gfx_rect_rtranslate(&offs, &irect, &srect); 151 179 return gfx_bitmap_render(image->bitmap, &srect, &offs); 180 152 181 } 153 182
Note:
See TracChangeset
for help on using the changeset viewer.