Bug 30825 - [CHROMIUM] Chromium/skia's canvas getImageData() is not accurate
Summary: [CHROMIUM] Chromium/skia's canvas getImageData() is not accurate
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Stephen White
Depends on:
Reported: 2009-10-27 09:17 PDT by Stephen White
Modified: 2009-11-09 17:30 PST (History)
1 user (show)

See Also:

Fix for data getImageData()'s unpremultiply (2.22 KB, patch)
2009-10-27 09:22 PDT, Stephen White
no flags Details | Formatted Diff | Diff
Fix typo (2.21 KB, patch)
2009-10-27 15:06 PDT, Stephen White
dimich: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen White 2009-10-27 09:17:30 PDT
Chromium/skia's implementation of canvas getImageData() does not unpremultiply colour values correctly.
In particular, LayoutTests/fast/canvas/canvas-getImageData.html requires that premultiplied values retrieved
from the canvas are accurately divided by alpha, but not rounded.

See http://crbug.com/22700
Comment 1 Stephen White 2009-10-27 09:22:23 PDT
Created attachment 41958 [details]
Fix for data getImageData()'s unpremultiply
Comment 2 David Levin 2009-10-27 14:14:45 PDT
Comment on attachment 41958 [details]
Fix for data getImageData()'s unpremultiply

> Index: WebCore/platform/graphics/skia/ImageBufferSkia.cpp
> +                destPixel[1] = a ? SkColorGetG(color) * 255 / a : 0,

I think you wanted a ";" here instead of a ",".
Comment 3 Stephen White 2009-10-27 15:06:52 PDT
Created attachment 41990 [details]
Fix typo
Comment 4 WebKit Commit Bot 2009-11-09 17:25:27 PST
Comment on attachment 41990 [details]
Fix typo

Rejecting patch 41990 from commit-queue.

Failed to run "['/Users/eseidel/Projects/CommitQueue/WebKitTools/Scripts/svn-apply', '--reviewer', 'Dmitri Titov', '--force']" exit_code: 1
patching file WebCore/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Hunk #1 FAILED at 164.
1 out of 1 hunk FAILED -- saving rejects to file WebCore/platform/graphics/skia/ImageBufferSkia.cpp.rej
Comment 5 Eric Seidel (no email) 2009-11-09 17:30:35 PST
Looks like this was landed as r50408 but just not closed.