sourcegraph / go-webkit2

WebKit API bindings (WebKitGTK+ v2) for Go
https://sourcegraph.com/github.com/sourcegraph/go-webkit2
Other
313 stars 61 forks source link

Fix snapshot byte order #9

Closed alicebob closed 9 years ago

alicebob commented 10 years ago

Fix cairo_format_t to Go's image.RGBA conversion

sqs commented 10 years ago

Thanks for the PR! What is the specific problem this fixes?

Sent from my iPhone

On Mar 15, 2014, at 20:06, Harmen notifications@github.com wrote:

Fix cairo_format_t to Go's image.RGBA conversion

You can merge this Pull Request by running

git pull https://github.com/alicebob/go-webkit2 master Or view, comment on, or merge it at:

https://github.com/sourcegraph/go-webkit2/pull/9

Commit Summary

Fix snapshot byte order File Changes

M webkit2/webview.go (32) Patch Links:

https://github.com/sourcegraph/go-webkit2/pull/9.patch https://github.com/sourcegraph/go-webkit2/pull/9.diff — Reply to this email directly or view it on GitHub.

alicebob commented 10 years ago

The original did not convert the byte order going from cairo to Go (argb to rgba), but (depending on the endianness of the former) that showed as an image where the red and blue channels were swapped.

alicebob commented 10 years ago

https://developer.gnome.org/cairo/stable/cairo-Image-Surfaces.html#cairo-format-t

CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The 32-bit quantities are stored native-endian. ...

http://golang.org/pkg/image/#RGBA

... in R, G, B, A order ...

mackross commented 9 years ago

Can we get this merged in please?

sqs commented 9 years ago

Sorry for the delay. Merged!