From 7e731ea10afc30246c6004a367deb09470640ff3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 25 Mar 2014 12:27:21 +0900 Subject: [PATCH] Evas filters: Ignore ox,oy when stretching in the same direction During padding calculation, ox and oy should be ignored unless the blend operation is neither repeating nor stretching. Otherwise, the buffer will grow without necessity. --- src/lib/evas/filters/evas_filter_parser.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/evas/filters/evas_filter_parser.c b/src/lib/evas/filters/evas_filter_parser.c index aaa9e7b543..b72f8f6794 100644 --- a/src/lib/evas/filters/evas_filter_parser.c +++ b/src/lib/evas/filters/evas_filter_parser.c @@ -263,6 +263,8 @@ static struct { "stretch_xy", EVAS_FILTER_FILL_MODE_STRETCH_XY } }; +static Evas_Filter_Fill_Mode _fill_mode_get(Evas_Filter_Instruction *instr); + typedef enum { VT_NONE, @@ -924,6 +926,7 @@ _blend_padding_update(Evas_Filter_Program *pgm, Evas_Filter_Instruction *instr, int *padl, int *padr, int *padt, int *padb) { const char *inbuf, *outbuf; + Evas_Filter_Fill_Mode fillmode; Buffer *in, *out; int ox, oy, l = 0, r = 0, t = 0, b = 0; @@ -938,6 +941,10 @@ _blend_padding_update(Evas_Filter_Program *pgm, Evas_Filter_Instruction *instr, out = _buffer_get(pgm, outbuf); EINA_SAFETY_ON_NULL_RETURN(out); + fillmode = _fill_mode_get(instr); + if (fillmode & (EVAS_FILTER_FILL_MODE_STRETCH_X | EVAS_FILTER_FILL_MODE_REPEAT_X)) ox = 0; + if (fillmode & (EVAS_FILTER_FILL_MODE_STRETCH_Y | EVAS_FILTER_FILL_MODE_REPEAT_Y)) oy = 0; + if (ox < 0) l = (-ox) + in->pad.l; else r = ox + in->pad.r;