Bug 145457 - [EFL] Jpeg image export implementation for Canvas.
Summary: [EFL] Jpeg image export implementation for Canvas.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-29 05:51 PDT by KwangHyuk
Modified: 2015-06-10 08:58 PDT (History)
3 users (show)

See Also:


Attachments
Patch (8.36 KB, patch)
2015-05-30 09:33 PDT, KwangHyuk
no flags Details | Formatted Diff | Diff
Patch (9.00 KB, patch)
2015-06-09 10:36 PDT, KwangHyuk
no flags Details | Formatted Diff | Diff
Patch (8.99 KB, patch)
2015-06-10 07:41 PDT, KwangHyuk
no flags Details | Formatted Diff | Diff
Patch (8.99 KB, patch)
2015-06-10 07:43 PDT, KwangHyuk
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description KwangHyuk 2015-05-29 05:51:54 PDT
Webkit GTK supports jpeg image export, but Webkit EFL doesn't support it yet.
Comment 1 KwangHyuk 2015-05-30 09:33:02 PDT
Created attachment 253960 [details]
Patch
Comment 2 Gyuyoung Kim 2015-05-31 20:03:30 PDT
Comment on attachment 253960 [details]
Patch

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

> Source/WebCore/ChangeLog:20
> +        * platform/image-encoders/JPEGImageEncoder.cpp:

You need to explain what is modified.

> Source/WebCore/platform/MIMETypeRegistry.cpp:270
> +#elif PLATFORM(EFL)

Why can't we support image/tiff, image/bmp, image/ico ?

Besides I think GTK and EFL have used cairo backend. Thus it might be good if you change this change as below,

 #elif PLATFORM(GTK)
-    supportedImageMIMETypesForEncoding->add("image/png");
-    supportedImageMIMETypesForEncoding->add("image/jpeg");
     supportedImageMIMETypesForEncoding->add("image/tiff");
     supportedImageMIMETypesForEncoding->add("image/bmp");
     supportedImageMIMETypesForEncoding->add("image/ico");
 #elif USE(CAIRO)
     supportedImageMIMETypesForEncoding->add("image/png");
+    supportedImageMIMETypesForEncoding->add("image/jpeg");
+    supportedImageMIMETypesForEncoding->add("image/png");
 #endif

> Source/WebCore/platform/graphics/efl/ImageBufferEfl.cpp:4
> + *  This library is free software; you can redistribute it and/or

Oops. LGPL.... Please use BSD !

> Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp:126
> +        for (const unsigned char* rowEnd = pixel + offset + compressData.image_width * 4; pixel + offset < rowEnd;) {

I think this change can influence on other ports. So you need to explain why you modify this code.
Comment 3 Gyuyoung Kim 2015-05-31 20:11:59 PDT
Comment on attachment 253960 [details]
Patch

r- because some trivial reasons.
Comment 4 KwangHyuk 2015-05-31 20:44:04 PDT
(In reply to comment #2)
> Comment on attachment 253960 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253960&action=review
> 
> > Source/WebCore/ChangeLog:20
> > +        * platform/image-encoders/JPEGImageEncoder.cpp:
> 
> You need to explain what is modified.
> 
> > Source/WebCore/platform/MIMETypeRegistry.cpp:270
> > +#elif PLATFORM(EFL)
> 
> Why can't we support image/tiff, image/bmp, image/ico ?
> 
> Besides I think GTK and EFL have used cairo backend. Thus it might be good
> if you change this change as below,
> 
>  #elif PLATFORM(GTK)
> -    supportedImageMIMETypesForEncoding->add("image/png");
> -    supportedImageMIMETypesForEncoding->add("image/jpeg");
>      supportedImageMIMETypesForEncoding->add("image/tiff");
>      supportedImageMIMETypesForEncoding->add("image/bmp");
>      supportedImageMIMETypesForEncoding->add("image/ico");
>  #elif USE(CAIRO)
>      supportedImageMIMETypesForEncoding->add("image/png");
> +    supportedImageMIMETypesForEncoding->add("image/jpeg");
> +    supportedImageMIMETypesForEncoding->add("image/png");
>  #endif
> 

it's guarded by using #elif, therefore, it should be touched in order to re-use CAIRO definition.
This cairo definition might be for window port ?

> > Source/WebCore/platform/graphics/efl/ImageBufferEfl.cpp:4
> > + *  This library is free software; you can redistribute it and/or
> 
> Oops. LGPL.... Please use BSD !
> 
> > Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp:126
> > +        for (const unsigned char* rowEnd = pixel + offset + compressData.image_width * 4; pixel + offset < rowEnd;) {
> 
> I think this change can influence on other ports. So you need to explain why
> you modify this code.

ImageEncoder was not used by other port yet. :)


(In reply to comment #2)
> Comment on attachment 253960 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253960&action=review
> 
> > Source/WebCore/ChangeLog:20
> > +        * platform/image-encoders/JPEGImageEncoder.cpp:
> 
> You need to explain what is modified.
> 
> > Source/WebCore/platform/MIMETypeRegistry.cpp:270
> > +#elif PLATFORM(EFL)
> 
> Why can't we support image/tiff, image/bmp, image/ico ?
> 

Because this patch is just for adding jpeg export feature on Webkit EFL.
So, It's not necessary.
However, this can be considered as other new bug.

> Besides I think GTK and EFL have used cairo backend. Thus it might be good
> if you change this change as below,
> 
>  #elif PLATFORM(GTK)
> -    supportedImageMIMETypesForEncoding->add("image/png");
> -    supportedImageMIMETypesForEncoding->add("image/jpeg");
>      supportedImageMIMETypesForEncoding->add("image/tiff");
>      supportedImageMIMETypesForEncoding->add("image/bmp");
>      supportedImageMIMETypesForEncoding->add("image/ico");
>  #elif USE(CAIRO)
>      supportedImageMIMETypesForEncoding->add("image/png");
> +    supportedImageMIMETypesForEncoding->add("image/jpeg");
> +    supportedImageMIMETypesForEncoding->add("image/png");
>  #endif
> 
> > Source/WebCore/platform/graphics/efl/ImageBufferEfl.cpp:4
> > + *  This library is free software; you can redistribute it and/or
> 
> Oops. LGPL.... Please use BSD !
> 

Thx, let me think about it.

> > Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp:126
> > +        for (const unsigned char* rowEnd = pixel + offset + compressData.image_width * 4; pixel + offset < rowEnd;) {
> 
> I think this change can influence on other ports. So you need to explain why
> you modify this code.


Unfortunately, it just generates clobbered error caused by setjmp and longjmp.
So, I just modified some code related with pixel variable.
However, the logic is same.
Comment 5 KwangHyuk 2015-06-09 10:36:22 PDT
Created attachment 254579 [details]
Patch
Comment 6 KwangHyuk 2015-06-09 10:39:55 PDT
- License description was updated to use BSD.
- The reason why JPEGImageEncoder.cpp was modified was added to file.
Comment 7 Gyuyoung Kim 2015-06-09 20:11:21 PDT
Comment on attachment 254579 [details]
Patch

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

LGTM except for a trivial comment.

> Source/WebCore/ChangeLog:10
> +        No new tests, LayoutTests/fast/canvas/toDataURL-supportedTypes.html can be reused.

Unnecessary "LayoutTests/" in test path.

> Source/WebCore/platform/graphics/efl/ImageBufferEfl.cpp:75
> +    return "data:" + mimeType + ";base64," + base64Data;

Isn't StringBuilder more efficient ?

https://trac.webkit.org/wiki/EfficientStrings
Comment 8 KwangHyuk 2015-06-10 07:20:49 PDT
(In reply to comment #7)
> Comment on attachment 254579 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=254579&action=review
> 
> LGTM except for a trivial comment.
> 
> > Source/WebCore/ChangeLog:10
> > +        No new tests, LayoutTests/fast/canvas/toDataURL-supportedTypes.html can be reused.
> 
> Unnecessary "LayoutTests/" in test path.
> 

Ok, thanks.

> > Source/WebCore/platform/graphics/efl/ImageBufferEfl.cpp:75
> > +    return "data:" + mimeType + ";base64," + base64Data;
> 
> Isn't StringBuilder more efficient ?
> 
> https://trac.webkit.org/wiki/EfficientStrings

But, this is the general implementation for every ports like ImageBufferGtk, ImageBufferCairo as well as ImageBufferCG.
Therefore, may be, keeping of this implementation looks fine.
Comment 9 KwangHyuk 2015-06-10 07:41:39 PDT
Created attachment 254651 [details]
Patch
Comment 10 KwangHyuk 2015-06-10 07:43:24 PDT
Created attachment 254652 [details]
Patch
Comment 11 KwangHyuk 2015-06-10 07:46:29 PDT
GyuYoung, Could you review one more time ?

review flag just disappeared. :(
Comment 12 WebKit Commit Bot 2015-06-10 08:58:46 PDT
Comment on attachment 254652 [details]
Patch

Clearing flags on attachment: 254652

Committed r185417: <http://trac.webkit.org/changeset/185417>
Comment 13 WebKit Commit Bot 2015-06-10 08:58:52 PDT
All reviewed patches have been landed.  Closing bug.