GNOME Bugzilla – Bug 682161
ClutterImage overflows beyond its actor's allocation
Last modified: 2012-09-07 20:27:37 UTC
ClutterImages overflow beyond their actor's allocation if their content gravity is set to CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT. See: http://rishi.fedorapeople.org/gnome-photos-ok.png http://rishi.fedorapeople.org/gnome-photos-buggy.png One possible cause could be that clutter_image_paint_content uses the actor's content_box for painting and does not clip it to the actor's allocation.
Created attachment 221704 [details] [review] image: Clip the image to its actor's allocation when painting
clipping breaks batching, which is not good in general, but it's fatal if we use it inside a ClutterContent implementation - which can be reused by multiple actors. also, from an API standpoint, clipping is something actors do, not their content: the content is defined to be at most as big as the allocation of the actor painting it. finally, the content-box should always be smaller than the allocation. it's entirely possible that the code in get_content_box() is doing something wrong: it wouldn't be the first time I have to fix it; in theory, though, it should select the direction of the content depending on its major axis, and use the allocation size in that direction to compute the other one - so, strictly speaking, the content box should always be at most as big as the allocation. can you use the CLUTTER_DEBUG=layout environment variable to print out the size of the content and the computed size of the content box, and then paste them here for the buggy image?
The content box is clearly exceeding the allocation: Clutter-Message: [ +501883]:[LAYOUT]:./clutter-box-layout.c:746: Allocation for <unnamed>[<ClutterActor>:0x1b2e9d0] { 0.00, 47.00, 650.00, 482.00 } Clutter-Message: [ +501916]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: -1.00 Clutter-Message: [ +501945]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: 650.00 Clutter-Message: [ +501972]:[LAYOUT]:./clutter-actor.c:9037: Adjusting allocated X and width Clutter-Message: [ +501997]:[LAYOUT]:./clutter-actor.c:9075: Adjusting allocated Y and height Clutter-Message: [ +502025]:[LAYOUT]:./clutter-actor.c:9608: Calling <unnamed>[<ClutterActor>:0x1b2e9d0]::allocate() Clutter-Message: [ +502054]:[LAYOUT]:./clutter-actor.c:2491: Allocating 5 children of <unnamed>[<ClutterActor>:0x1b2e9d0] at { 0.00, 47.00 - 650.00 x 482.00 } using ClutterBinLayout Clutter-Message: [ +502090]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: -1.00 Clutter-Message: [ +502118]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: 650.00 Clutter-Message: [ +502145]:[LAYOUT]:./clutter-actor.c:9037: Adjusting allocated X and width Clutter-Message: [ +502171]:[LAYOUT]:./clutter-actor.c:9075: Adjusting allocated Y and height Clutter-Message: [ +502196]:[LAYOUT]:./clutter-actor.c:9709: No allocation needed Clutter-Message: [ +502225]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: -1.00 Clutter-Message: [ +502253]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: 650.00 Clutter-Message: [ +502280]:[LAYOUT]:./clutter-actor.c:9037: Adjusting allocated X and width Clutter-Message: [ +502305]:[LAYOUT]:./clutter-actor.c:9075: Adjusting allocated Y and height Clutter-Message: [ +502330]:[LAYOUT]:./clutter-actor.c:9709: No allocation needed Clutter-Message: [ +502360]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: -1.00 Clutter-Message: [ +502387]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: 650.00 Clutter-Message: [ +502414]:[LAYOUT]:./clutter-actor.c:9037: Adjusting allocated X and width Clutter-Message: [ +502440]:[LAYOUT]:./clutter-actor.c:9075: Adjusting allocated Y and height Clutter-Message: [ +502466]:[LAYOUT]:./clutter-actor.c:9709: No allocation needed Clutter-Message: [ +502495]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: -1.00 Clutter-Message: [ +502609]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: 650.00 Clutter-Message: [ +502638]:[LAYOUT]:./clutter-actor.c:9037: Adjusting allocated X and width Clutter-Message: [ +502664]:[LAYOUT]:./clutter-actor.c:9075: Adjusting allocated Y and height Clutter-Message: [ +502690]:[LAYOUT]:./clutter-actor.c:9709: No allocation needed Clutter-Message: [ +502719]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: -1.00 Clutter-Message: [ +502747]:[LAYOUT]:./clutter-actor.c:9115: Size cache hit for size: 650.00 Clutter-Message: [ +502774]:[LAYOUT]:./clutter-actor.c:9037: Adjusting allocated X and width Clutter-Message: [ +502800]:[LAYOUT]:./clutter-actor.c:9075: Adjusting allocated Y and height Clutter-Message: [ +502825]:[LAYOUT]:./clutter-actor.c:9709: No allocation needed Clutter-Message: [ +503259]:[LAYOUT]:./clutter-actor.c:19477: r_c: 1.030, r_a: 1.349 a: [650.00x482.00], c: [372.00x361.00] b: [0.00, -74.39, 650.00, 556.39]
Created attachment 222688 [details] [review] actor: Fix the content box for CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT A different approach to fixing this.
Review of attachment 222688 [details] [review]: looks good.
Attachment 222688 [details] pushed to master.