Bug 26037

Summary: [Skia] Canvas globalAlpha property not applied to drawImage method
Product: WebKit Reporter: Anand K. Mistry <akmistry>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: amistry, dglazkov
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Use the alpha channel when painting images in skia.
dglazkov: review-
Use the alpha channel when painting images in skia. Updated. dglazkov: review+

Anand K. Mistry
Reported 2009-05-26 23:13:18 PDT
Setting the globalImage property of a canvas context is not honoured when doing a drawImage. Test case available at: http://philip.html5.org/tests/canvas/suite/tests/2d.composite.globalAlpha.image.html Chromium bug http://code.google.com/p/chromium/issues/detail?id=5281 Tested on: Firefox 3.0 Linux - PASS Firefox 3.5b4 OSX - PASS WebKit nightly OSX (44174) - PASS Chromium SVN (16864) - FAIL
Attachments
Use the alpha channel when painting images in skia. (28.59 KB, patch)
2009-06-02 20:32 PDT, Anand K. Mistry
dglazkov: review-
Use the alpha channel when painting images in skia. Updated. (28.59 KB, patch)
2009-06-03 16:04 PDT, Anand K. Mistry
dglazkov: review+
Dirk Schulze
Comment 1 2009-05-30 09:55:22 PDT
We fixexd it on Cairo by reading and applying the globalAlpha in WebCore/platform/graphics/cairo/ImageCairo.cpp directly. We added getAlpha() for Cairo to GraphicsContext.h maybe Skia needs to use it too.
Anand K. Mistry
Comment 2 2009-06-02 20:32:02 PDT
Created attachment 30889 [details] Use the alpha channel when painting images in skia.
Anand K. Mistry
Comment 3 2009-06-02 20:36:19 PDT
The patch is by me. Please ignore the gmail address.
Dimitri Glazkov (Google)
Comment 4 2009-06-03 10:37:06 PDT
Comment on attachment 30889 [details] Use the alpha channel when painting images in skia. > + int alpha = roundf(platformContext->getAlpha() * 256); > + if (alpha > 255) > + alpha = 255; > + else if (alpha < 0) > + alpha = 0; > + paint.setAlpha(alpha); 4 spaces indent. Looks great otherwise.
Anand K. Mistry
Comment 5 2009-06-03 16:04:54 PDT
Created attachment 30929 [details] Use the alpha channel when painting images in skia. Updated. Changes: Changed to 4 space indent.
Dimitri Glazkov (Google)
Comment 6 2009-06-03 16:12:46 PDT
Comment on attachment 30929 [details] Use the alpha channel when painting images in skia. Updated. Don't forget to mark for review next time :)
Dimitri Glazkov (Google)
Comment 7 2009-06-09 10:09:26 PDT
Note You need to log in before you can comment on or make changes to this bug.