After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 682161 - ClutterImage overflows beyond its actor's allocation
ClutterImage overflows beyond its actor's allocation
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
1.11.x
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-08-18 16:16 UTC by Debarshi Ray
Modified: 2012-09-07 20:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
image: Clip the image to its actor's allocation when painting (1.72 KB, patch)
2012-08-18 16:19 UTC, Debarshi Ray
none Details | Review
actor: Fix the content box for CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT (2.35 KB, patch)
2012-08-28 22:26 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2012-08-18 16:16:26 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.
Comment 1 Debarshi Ray 2012-08-18 16:19:26 UTC
Created attachment 221704 [details] [review]
image: Clip the image to its actor's allocation when painting
Comment 2 Emmanuele Bassi (:ebassi) 2012-08-20 17:38:31 UTC
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?
Comment 3 Debarshi Ray 2012-08-28 22:25:01 UTC
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]
Comment 4 Debarshi Ray 2012-08-28 22:26:21 UTC
Created attachment 222688 [details] [review]
actor: Fix the content box for CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT

A different approach to fixing this.
Comment 5 Emmanuele Bassi (:ebassi) 2012-09-07 20:25:59 UTC
Review of attachment 222688 [details] [review]:

looks good.
Comment 6 Emmanuele Bassi (:ebassi) 2012-09-07 20:26:53 UTC
Attachment 222688 [details] pushed to master.