mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 09:14:09 +08:00
fix bug when zoom in the source bits in PixmanStretchBlt
This commit is contained in:
+14
-5
@@ -456,20 +456,27 @@ int GAL_StretchBlt (GAL_Surface *src, GAL_Rect *srcrect,
|
||||
}
|
||||
|
||||
{
|
||||
double fscale_x = srcrect->w * 1.0 / dstrect->w;
|
||||
double fscale_y = srcrect->h * 1.0 / dstrect->h;
|
||||
double fscale_x = dstrect->w * 1.0 / srcrect->w;
|
||||
double fscale_y = dstrect->h * 1.0 / srcrect->h;
|
||||
pixman_f_transform_t ftransform;
|
||||
pixman_transform_t transform;
|
||||
pixman_fixed_t *params;
|
||||
int n_params;
|
||||
pixman_region32_t clip_region;
|
||||
|
||||
_DBG_PRINTF ("srcrect: %d, %d, %dx%d; dstrect: %d, %d, %dx%d; scale: %f x %f; cliprect: %d, %d, %dx%d\n",
|
||||
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
|
||||
dstrect->x, dstrect->y, dstrect->w, dstrect->h,
|
||||
fscale_x, fscale_y,
|
||||
dst->clip_rect.x, dst->clip_rect.y, dst->clip_rect.w, dst->clip_rect.h);
|
||||
|
||||
pixman_f_transform_init_identity (&ftransform);
|
||||
pixman_f_transform_scale (&ftransform, NULL, fscale_x, fscale_y);
|
||||
//pixman_f_transform_translate (&ftransform, NULL, - dstrect->w / 2.0f, - dstrect->h / 2.0);
|
||||
pixman_f_transform_scale (&ftransform, NULL, 1.0/fscale_x, 1.0/fscale_y);
|
||||
pixman_transform_from_pixman_f_transform (&transform, &ftransform);
|
||||
pixman_image_set_transform (src_img, &transform);
|
||||
|
||||
fscale_x = hypot (ftransform.m[0][0], ftransform.m[0][1]) / ftransform.m[2][2];
|
||||
fscale_y = hypot (ftransform.m[1][0], ftransform.m[1][1]) / ftransform.m[2][2];
|
||||
params = pixman_filter_create_separable_convolution (
|
||||
&n_params,
|
||||
pixman_double_to_fixed(fscale_x),
|
||||
@@ -478,7 +485,7 @@ int GAL_StretchBlt (GAL_Surface *src, GAL_Rect *srcrect,
|
||||
PIXMAN_KERNEL_IMPULSE,
|
||||
PIXMAN_KERNEL_BOX,
|
||||
PIXMAN_KERNEL_BOX,
|
||||
2, 2);
|
||||
4, 4);
|
||||
pixman_image_set_filter (src_img, PIXMAN_FILTER_SEPARABLE_CONVOLUTION, params, n_params);
|
||||
free (params);
|
||||
|
||||
@@ -492,6 +499,8 @@ int GAL_StretchBlt (GAL_Surface *src, GAL_Rect *srcrect,
|
||||
0, 0,
|
||||
dstrect->x, dstrect->y,
|
||||
srcrect->w, srcrect->h);
|
||||
|
||||
pixman_region32_fini (&clip_region);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
Reference in New Issue
Block a user