summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubhransu Mohanty <sub.mohanty@samsung.com>2015-08-17 13:45:42 +0900
committerCedric BAIL <cedric@osg.samsung.com>2015-08-19 14:56:29 +0200
commitf1a4f461c2f90372035c59fc9cc376d25ad54c27 (patch)
tree18b5fb1009bf8503c2e967526cb41a88f53870a3
parent146f3c52b50cde7d356e904858ac9aad7fa6710a (diff)
ector: add bounding box info in RLE data for software backend.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/ector/software/ector_software_private.h1
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c20
2 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index c91d1d467a..5fefe590aa 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -56,6 +56,7 @@ typedef struct _Raster_Buffer
56 56
57typedef struct _Shape_Rle_Data 57typedef struct _Shape_Rle_Data
58{ 58{
59 Eina_Rectangle bbox;
59 unsigned short alloc; 60 unsigned short alloc;
60 unsigned short size; 61 unsigned short size;
61 SW_FT_Span *spans;// array of Scanlines. 62 SW_FT_Span *spans;// array of Scanlines.
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index 47a0cae07d..5afb1caf27 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -388,8 +388,11 @@ _rle_generation_cb( int count, const SW_FT_Span* spans,void *user)
388Shape_Rle_Data * 388Shape_Rle_Data *
389ector_software_rasterizer_generate_rle_data(Software_Rasterizer *rasterizer, SW_FT_Outline *outline) 389ector_software_rasterizer_generate_rle_data(Software_Rasterizer *rasterizer, SW_FT_Outline *outline)
390{ 390{
391 int i, rle_size;
392 int l = 0, t = 0, r = 0, b = 0;
391 Shape_Rle_Data *rle_data = (Shape_Rle_Data *) calloc(1, sizeof(Shape_Rle_Data)); 393 Shape_Rle_Data *rle_data = (Shape_Rle_Data *) calloc(1, sizeof(Shape_Rle_Data));
392 SW_FT_Raster_Params params; 394 SW_FT_Raster_Params params;
395 SW_FT_Span* span;
393 396
394 params.flags = SW_FT_RASTER_FLAG_DIRECT | SW_FT_RASTER_FLAG_AA ; 397 params.flags = SW_FT_RASTER_FLAG_DIRECT | SW_FT_RASTER_FLAG_AA ;
395 params.gray_spans = &_rle_generation_cb; 398 params.gray_spans = &_rle_generation_cb;
@@ -398,6 +401,23 @@ ector_software_rasterizer_generate_rle_data(Software_Rasterizer *rasterizer, SW_
398 401
399 sw_ft_grays_raster.raster_render(rasterizer->raster, &params); 402 sw_ft_grays_raster.raster_render(rasterizer->raster, &params);
400 403
404 // update RLE bounding box.
405 span = rle_data->spans;
406 rle_size = rle_data->size;
407 if (rle_size)
408 {
409 t = span[0].y;
410 b = span[rle_size-1].y;
411 for (i = 0; i < rle_size; i++)
412 {
413 if (span[i].x < l) l = span[i].x;
414 if (span[i].x + span[i].len > r) r = span[i].x + span[i].len;
415 }
416 rle_data->bbox.x = l;
417 rle_data->bbox.y = t;
418 rle_data->bbox.w = r - l;
419 rle_data->bbox.h = b - t + 1;
420 }
401 return rle_data; 421 return rle_data;
402} 422}
403 423