Bug 79651

Summary: [GTK] Crop support in BitmapImage
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: alex, mrobinson, pnormand
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 77087    
Attachments:
Description Flags
Crop support in BitmapImage mrobinson: review-

Description Philippe Normand 2012-02-27 02:10:45 PST
I'm not sure it's doable already.

What I need to do when painting an Image surface from a source rectangle to a destination rectangle is to select only a region of the source rectangle.

I'll attach a patch for ImageCairo.
Comment 1 Philippe Normand 2012-02-27 02:13:44 PST
Created attachment 128991 [details]
Crop support in BitmapImage
Comment 2 Martin Robinson 2012-02-27 08:54:07 PST
Comment on attachment 128991 [details]
Crop support in BitmapImage

Is this used anywhere?
Comment 3 Philippe Normand 2012-02-27 08:57:00 PST
(In reply to comment #2)
> (From update of attachment 128991 [details])
> Is this used anywhere?

In the patch of bug 77087 :)
I'm not sure this is the right approach though, I did this as an experiment and it seems to work but my knowledge of the Cairo stuff is a bit limited.
Comment 4 Philippe Normand 2012-03-06 02:11:48 PST
Alex, what do you think about this?
Comment 5 Martin Robinson 2012-03-06 06:56:00 PST
(In reply to comment #4)
> Alex, what do you think about this?

Perhaps ::crop could me a method on ImageGstreamer. Then you could just adjust the srcRect you pass into Image::draw.
Comment 6 Martin Robinson 2012-03-06 06:57:13 PST
Comment on attachment 128991 [details]
Crop support in BitmapImage

I think perhaps platform-independent Image is the wrong place for this. :/ Also it seems like a change like this should just go in the patch that depends on it -- instead of introducing code that is totally dead. Perhaps we can chat about another design.
Comment 7 Philippe Normand 2012-03-06 07:31:07 PST
(In reply to comment #5)
> (In reply to comment #4)
> > Alex, what do you think about this?
> 
> Perhaps ::crop could me a method on ImageGstreamer. Then you could just adjust the srcRect you pass into Image::draw.

the rect in MediaPlayerPrivateGStreamer::paint() is the destination rectangle, I think. Not the source rectangle. What I need to crop is the source.
Comment 8 Philippe Normand 2012-03-06 09:39:31 PST
Will do as Martin suggests. Thanks!