raster pushed a commit to branch master.
commit 1e9d4bf28f88b6eb4dd073ac63519f9ea58ba94e
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date: Sat Aug 10 16:26:30 2013 +0900
evas - fix up border adjust improvement from last night. handles overlap now
---
src/lib/evas/canvas/evas_object_image.c | 62 ++++++++++++++++++++++++---------
1 file changed, 46 insertions(+), 16 deletions(-)
diff --git a/src/lib/evas/canvas/evas_object_image.c
b/src/lib/evas/canvas/evas_object_image.c
index df49c70..1531bae 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -3967,25 +3967,26 @@ evas_object_image_render(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj, v
br = o->cur->border.r;
bt = o->cur->border.t;
bb = o->cur->border.b;
- if ((bl + br) > imagew)
- {
- bl = imagew / 2;
- br = imagew - bl;
- }
- if ((bl + br) > imagew)
- {
- bl = imagew / 2;
- br = imagew - bl;
- }
- if ((bt + bb) > imageh)
+ // fix impossible border settings if img pixels
not enough
+ if ((bl + br) > imw)
{
- bt = imageh / 2;
- bb = imageh - bt;
+ int b0 = bl, b1 = br;
+
+ if ((bl + br) > 0)
+ {
+ bl = (bl * imw) / (bl + br);
+ br = imw - bl;
+ }
}
- if ((bt + bb) > imageh)
+ if ((bt + bb) > imh)
{
- bt = imageh / 2;
- bb = imageh - bt;
+ int b0 = bt, b1 = bb;
+
+ if ((bt + bb) > 0)
+ {
+ bt = (bt * imh) / (bt + bb);
+ bb = imh - bt;
+ }
}
if (o->cur->border.scale != 1.0)
{
@@ -3998,6 +3999,35 @@ evas_object_image_render(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj, v
{
bsl = bl; bsr = br; bst = bt; bsb = bb;
}
+ // adjust output border rendering if it doesnt fit
+ if ((bsl + bsr) > iw)
+ {
+ int b0 = bsl, b1 = bsr;
+
+ if ((bsl + bsr) > 0)
+ {
+ bsl = (bsl * iw) / (bsl + bsr);
+ bsr = iw - bsl;
+ }
+ if (b0 > 0) bl = (bl * bsl) / b0;
+ else bl = 0;
+ if (b1 > 0) br = (br * bsr) / b1;
+ else br = 0;
+ }
+ if ((bst + bsb) > ih)
+ {
+ int b0 = bst, b1 = bsb;
+
+ if ((bst + bsb) > 0)
+ {
+ bst = (bst * ih) / (bst + bsb);
+ bsb = ih - bst;
+ }
+ if (b0 > 0) bt = (bt * bst) / b0;
+ else bt = 0;
+ if (b1 > 0) bb = (bb * bsb) / b1;
+ else bb = 0;
+ }
// #--
// |
inx = 0; iny = 0;
--
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk