Bug 26037 - [Skia] Canvas globalAlpha property not applied to drawImage method
Summary: [Skia] Canvas globalAlpha property not applied to drawImage method
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-26 23:13 PDT by Anand K. Mistry
Modified: 2009-06-09 10:09 PDT (History)
2 users (show)

See Also:


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-
Details | Formatted Diff | Diff
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+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anand K. Mistry 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
Comment 1 Dirk Schulze 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.
Comment 2 Anand K. Mistry 2009-06-02 20:32:02 PDT
Created attachment 30889 [details]
Use the alpha channel when painting images in skia.
Comment 3 Anand K. Mistry 2009-06-02 20:36:19 PDT
The patch is by me.  Please ignore the gmail address.
Comment 4 Dimitri Glazkov (Google) 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.
Comment 5 Anand K. Mistry 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.
Comment 6 Dimitri Glazkov (Google) 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 :)
Comment 7 Dimitri Glazkov (Google) 2009-06-09 10:09:26 PDT
Landed as http://trac.webkit.org/changeset/44537.