Changeset 794e368 in mainline
- Timestamp:
- 2014-08-28T13:55:26Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c6c39d4f
- Parents:
- a9763c6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/draw/font/bitmap_backend.c
ra9763c6 r794e368 136 136 surface_get_resolution(raw_surface, &w, &h); 137 137 138 if ( h == data->points) {138 if (!data->scale) { 139 139 *result = raw_surface; 140 140 return EOK; … … 147 147 transform_t transform; 148 148 transform_identity(&transform); 149 double ratio = ((double) data->points) / ((double) h);150 transform_scale(&transform, ratio,ratio);149 transform_translate(&transform, 0.5, 0.5); 150 transform_scale(&transform, data->scale_ratio, data->scale_ratio); 151 151 source_set_transform(&source, transform); 152 152 153 double width = w;154 double height = h;155 transform_apply_linear(&transform, &width, &height); 156 surface_t *scaled_surface = 157 surface_create((sysarg_t) (width + 0.5), (sysarg_t) (height + 0.5),NULL, 0);153 surface_coord_t scaled_width = (data->scale_ratio * ((double) w) + 0.5); 154 surface_coord_t scaled_height = (data->scale_ratio * ((double) h) + 0.5); 155 156 surface_t *scaled_surface = surface_create(scaled_width, scaled_height, 157 NULL, 0); 158 158 if (!scaled_surface) { 159 159 surface_destroy(raw_surface); … … 164 164 drawctx_init(&context, scaled_surface); 165 165 drawctx_set_source(&context, &source); 166 drawctx_transfer(&context, 0, 0, 167 (sysarg_t) (width + 0.5), (sysarg_t) (height + 0.5)); 166 drawctx_transfer(&context, 0, 0, scaled_width, scaled_height); 168 167 169 168 surface_destroy(raw_surface); … … 249 248 data->scale = true; 250 249 data->scale_ratio = ((double) points) / ((double) line_height); 250 line_height = (data->scale_ratio * ((double) line_height)); 251 251 data->font_metrics.ascender = (metric_t) 252 252 (data->scale_ratio * data->font_metrics.ascender + 0.5); 253 data->font_metrics.descender = (metric_t)254 (data->scale_ratio * data->font_metrics.descender - 0.5);253 data->font_metrics.descender = 254 line_height - data->font_metrics.ascender; 255 255 data->font_metrics.leading = (metric_t) 256 256 (data->scale_ratio * data->font_metrics.leading + 0.5);
Note:
See TracChangeset
for help on using the changeset viewer.