summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/engines/common/evas_scale_sample.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_sample.c113
1 files changed, 67 insertions, 46 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_sample.c b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
index 54b8e92dc7..a8951b8353 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_sample.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
@@ -154,7 +154,7 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
154 dst_clip_w = m_clip_w; 154 dst_clip_w = m_clip_w;
155 dst_clip_h = m_clip_h; 155 dst_clip_h = m_clip_h;
156 } 156 }
157 157
158 if (dst_clip_x < dst_region_x) 158 if (dst_clip_x < dst_region_x)
159 { 159 {
160 dst_clip_w += dst_clip_x - dst_region_x; 160 dst_clip_w += dst_clip_x - dst_region_x;
@@ -258,7 +258,7 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
258 func = evas_common_gfx_func_composite_pixel_mask_span_get(src, dst, dst_clip_w, dc->render_op); 258 func = evas_common_gfx_func_composite_pixel_mask_span_get(src, dst, dst_clip_w, dc->render_op);
259 maskobj = dc->mask.mask; 259 maskobj = dc->mask.mask;
260 mask = maskobj->mask.mask; 260 mask = maskobj->mask.mask;
261/* 261/*
262 if (1 || dst_region_w > src_region_w || dst_region_h > src_region_h){ 262 if (1 || dst_region_w > src_region_w || dst_region_h > src_region_h){
263 printf("Mask w/h: %d/%d\n",maskobj->cache_entry.w, 263 printf("Mask w/h: %d/%d\n",maskobj->cache_entry.w,
264 maskobj->cache_entry.h); 264 maskobj->cache_entry.h);
@@ -276,26 +276,47 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
276 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) 276 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h))
277 { 277 {
278#ifdef HAVE_PIXMAN 278#ifdef HAVE_PIXMAN
279 if ((1) && 279# ifdef PIXMAN_IMAGE_SCALE_SAMPLE
280 (src->pixman.im) && (dst->pixman.im) && 280 if ((src->pixman.im) && (dst->pixman.im) && (!dc->mask.mask) &&
281 ((!dc->mul.use) || 281 ((!dc->mul.use) ||
282 ((dc->mul.use) && (dc->mul.col == 0xffffffff))) && 282 ((dc->mul.use) && (dc->mul.col == 0xffffffff))) &&
283 ((dc->render_op == _EVAS_RENDER_COPY) || 283 ((dc->render_op == _EVAS_RENDER_COPY) ||
284 (dc->render_op == _EVAS_RENDER_BLEND)) 284 (dc->render_op == _EVAS_RENDER_BLEND)))
285 )
286 { 285 {
287 pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY 286 pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
288 if (dc->render_op == _EVAS_RENDER_BLEND) op = PIXMAN_OP_OVER; 287 if (dc->render_op == _EVAS_RENDER_BLEND)
288 op = PIXMAN_OP_OVER;
289
289 pixman_image_composite(op, 290 pixman_image_composite(op,
290 src->pixman.im, NULL, 291 src->pixman.im, NULL,
291 dst->pixman.im, 292 dst->pixman.im,
292 (dst_clip_x - dst_region_x) + src_region_x, 293 (dst_clip_x - dst_region_x) + src_region_x,
293 (dst_clip_y - dst_region_y) + src_region_y, 294 (dst_clip_y - dst_region_y) + src_region_y,
294 0, 0, 295 0, 0,
295 dst_clip_x, dst_clip_y, 296 dst_clip_x, dst_clip_y,
297 dst_clip_w, dst_clip_h);
298 }
299 else if ((src->pixman.im) && (dst->pixman.im) &&
300 (dc->mask.mask) && (dc->mask.mask->pixman.im) &&
301 ((dc->render_op == _EVAS_RENDER_COPY) ||
302 (dc->render_op == _EVAS_RENDER_BLEND)))
303 {
304 // In case of pixel and color operation.
305 pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
306 if (dc->render_op == _EVAS_RENDER_BLEND)
307 op = PIXMAN_OP_OVER;
308
309 pixman_image_composite(op,
310 src->pixman.im, dc->mask.mask->pixman.im,
311 dst->pixman.im,
312 (dst_clip_x - dst_region_x) + src_region_x,
313 (dst_clip_y - dst_region_y) + src_region_y,
314 0, 0,
315 dst_clip_x, dst_clip_y,
296 dst_clip_w, dst_clip_h); 316 dst_clip_w, dst_clip_h);
297 } 317 }
298 else 318 else
319# endif
299#endif 320#endif
300 { 321 {
301 ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x; 322 ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x;
@@ -322,59 +343,59 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
322 } 343 }
323 else 344 else
324 { 345 {
325 /* fill scale tables */ 346 /* fill scale tables */
326 for (x = 0; x < dst_clip_w; x++) 347 for (x = 0; x < dst_clip_w; x++)
327 lin_ptr[x] = (((x + dst_clip_x - dst_region_x) * src_region_w) / dst_region_w) + src_region_x; 348 lin_ptr[x] = (((x + dst_clip_x - dst_region_x) * src_region_w) / dst_region_w) + src_region_x;
328 for (y = 0; y < dst_clip_h; y++) 349 for (y = 0; y < dst_clip_h; y++)
329 row_ptr[y] = src_data + (((((y + dst_clip_y - dst_region_y) * src_region_h) / dst_region_h) 350 row_ptr[y] = src_data + (((((y + dst_clip_y - dst_region_y) * src_region_h) / dst_region_h)
330 + src_region_y) * src_w); 351 + src_region_y) * src_w);
331 /* scale to dst */ 352 /* scale to dst */
332 dptr = dst_ptr; 353 dptr = dst_ptr;
333#ifdef DIRECT_SCALE 354#ifdef DIRECT_SCALE
334 if ((!src->cache_entry.flags.alpha) && 355 if ((!src->cache_entry.flags.alpha) &&
335 (!dst->cache_entry.flags.alpha) && 356 (!dst->cache_entry.flags.alpha) &&
336 (!dc->mul.use)) 357 (!dc->mul.use))
337 { 358 {
338 for (y = 0; y < dst_clip_h; y++) 359 for (y = 0; y < dst_clip_h; y++)
339 { 360 {
340#ifdef EVAS_SLI 361# ifdef EVAS_SLI
341 if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y) 362 if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y)
342#endif 363# endif
343 { 364 {
344 dst_ptr = dptr; 365 dst_ptr = dptr;
345 for (x = 0; x < dst_clip_w; x++) 366 for (x = 0; x < dst_clip_w; x++)
346 { 367 {
347 ptr = row_ptr[y] + lin_ptr[x]; 368 ptr = row_ptr[y] + lin_ptr[x];
348 *dst_ptr = *ptr; 369 *dst_ptr = *ptr;
349 dst_ptr++; 370 dst_ptr++;
350 } 371 }
351 } 372 }
352 dptr += dst_w; 373 dptr += dst_w;
353 } 374 }
354 } 375 }
355 else 376 else
356#endif 377#endif
357 { 378 {
358 /* a scanline buffer */ 379 /* a scanline buffer */
359 buf = alloca(dst_clip_w * sizeof(DATA32)); 380 buf = alloca(dst_clip_w * sizeof(DATA32));
360 for (y = 0; y < dst_clip_h; y++) 381 for (y = 0; y < dst_clip_h; y++)
361 { 382 {
362#ifdef EVAS_SLI 383#ifdef EVAS_SLI
363 if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y) 384 if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y)
364#endif 385#endif
365 { 386 {
366 dst_ptr = buf; 387 dst_ptr = buf;
367 for (x = 0; x < dst_clip_w; x++) 388 for (x = 0; x < dst_clip_w; x++)
368 { 389 {
369 ptr = row_ptr[y] + lin_ptr[x]; 390 ptr = row_ptr[y] + lin_ptr[x];
370 *dst_ptr = *ptr; 391 *dst_ptr = *ptr;
371 dst_ptr++; 392 dst_ptr++;
372 } 393 }
373 /* * blend here [clip_w *] buf -> dptr * */ 394 /* * blend here [clip_w *] buf -> dptr * */
374 func(buf, NULL, dc->mul.col, dptr, dst_clip_w); 395 func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
375 } 396 }
376 dptr += dst_w; 397 dptr += dst_w;
377 } 398 }
378 } 399 }
379 } 400 }
380} 401}