Bug 111333 - [EFL] Ensure right format is used in SnapshotImageGL.
Summary: [EFL] Ensure right format is used in SnapshotImageGL.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Kalyan
URL:
Keywords:
Depends on:
Blocks: 105659
  Show dependency treegraph
 
Reported: 2013-03-04 08:24 PST by Kalyan
Modified: 2013-03-05 23:39 PST (History)
7 users (show)

See Also:


Attachments
patch (1.97 KB, patch)
2013-03-04 09:58 PST, Kalyan
no flags Details | Formatted Diff | Diff
patchv2 (1.96 KB, patch)
2013-03-04 15:37 PST, Kalyan
benjamin: review-
Details | Formatted Diff | Diff
patchv3 (1.83 KB, patch)
2013-03-05 18:16 PST, Kalyan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kalyan 2013-03-04 08:24:58 PST
In SnapshotImageGL we use GL_BGRA as the format with glReadPixels. This is not the standard format on OpenGLES2.0. With GLES we should use GL_RGBA as the format and convert the result to BGRA.
Comment 1 Kalyan 2013-03-04 09:58:05 PST
Created attachment 191264 [details]
patch
Comment 2 Kenneth Rohde Christiansen 2013-03-04 10:39:22 PST
Comment on attachment 191264 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=191264&action=review

> Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.cpp:60
> +
> +        for (int i = 0; i < totalBytes; i += 4)
> +            std::swap(buf[i], buf[i + 2]);

why this indentation?
Comment 3 Kalyan 2013-03-04 15:37:38 PST
Created attachment 191328 [details]
patchv2
Comment 4 Kalyan 2013-03-04 15:38:54 PST
(In reply to comment #2)
> (From update of attachment 191264 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=191264&action=review
> 
> > +            std::swap(buf[i], buf[i + 2]);
> 
> why this indentation?

oops, fixed it now.
Comment 5 Benjamin Poulain 2013-03-05 17:10:38 PST
Comment on attachment 191328 [details]
patchv2

View in context: https://bugs.webkit.org/attachment.cgi?id=191328&action=review

> Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.cpp:62
> +#if USE(OPENGL_ES_2)
> +    // Convert to BGRA.
> +    int totalBytes = width * height * 4;
> +
> +    for (int i = 0; i < totalBytes; i += 4)
> +        std::swap(buf[i], buf[i + 2]);
> +#endif
> +

It is hard to believe you must do something so inefficient. :(

Here: std::swap(buf[i], buf[i + 2]);
You swap to 32bits pixels, not 2 * 8 bits component.
Comment 6 Kalyan 2013-03-05 18:16:51 PST
Created attachment 191629 [details]
patchv3
Comment 7 Kalyan 2013-03-05 18:19:11 PST
(In reply to comment #5)
> (From update of attachment 191328 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=191328&action=review
> It is hard to believe you must do something so inefficient. :(
> 
> Here: std::swap(buf[i], buf[i + 2]);
> You swap to 32bits pixels, not 2 * 8 bits component.

Thanks for highlighting this. Fixed it now.
Comment 8 WebKit Review Bot 2013-03-05 23:39:14 PST
Comment on attachment 191629 [details]
patchv3

Clearing flags on attachment: 191629

Committed r144887: <http://trac.webkit.org/changeset/144887>
Comment 9 WebKit Review Bot 2013-03-05 23:39:18 PST
All reviewed patches have been landed.  Closing bug.