RESOLVED FIXED Bug 28130
[Haiku] Adding Image-specific files to WebCore.
https://bugs.webkit.org/show_bug.cgi?id=28130
Summary [Haiku] Adding Image-specific files to WebCore.
Maxime Simon
Reported 2009-08-09 07:14:38 PDT
Here is a patch to add these six files which are specific to images (or related): WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp WebCore/platform/graphics/haiku/IconHaiku.cpp WebCore/platform/graphics/haiku/ImageBufferData.h WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp WebCore/platform/graphics/haiku/ImageHaiku.cpp WebCore/platform/graphics/haiku/ImageSourceHaiku.cpp Regards, Maxime
Attachments
Patch to add six image-specific files to WebCore/platform/graphics/. (37.15 KB, patch)
2009-08-09 07:22 PDT, Maxime Simon
eric: review-
Patch to add four image-specific files to WebCore/platform/graphics/. (13.83 KB, patch)
2009-08-11 09:34 PDT, Maxime Simon
eric: review-
Patch to add GraphicsContext to WebCore/platform/graphics/haiku. (16.57 KB, patch)
2009-08-11 09:43 PDT, Maxime Simon
no flags
Patch to add ImageSource to WebCore/platform/graphics/haiku. (8.02 KB, patch)
2009-08-11 09:59 PDT, Maxime Simon
no flags
Adding four image-specific files to WebCore. (13.67 KB, patch)
2009-08-13 01:45 PDT, Maxime Simon
no flags
Maxime Simon
Comment 1 2009-08-09 07:22:01 PDT
Created attachment 34420 [details] Patch to add six image-specific files to WebCore/platform/graphics/.
Eric Seidel (no email)
Comment 2 2009-08-09 08:29:00 PDT
Comment on attachment 34420 [details] Patch to add six image-specific files to WebCore/platform/graphics/. Please split these out. GraphicsContext and the ImageSource stuff really need their own changes, they're complicated. :) Also, I made comments about parts of this patch in the previous bug which were not addressed by this posting.
Maxime Simon
Comment 3 2009-08-11 09:34:05 PDT
Created attachment 34566 [details] Patch to add four image-specific files to WebCore/platform/graphics/.
Maxime Simon
Comment 4 2009-08-11 09:43:24 PDT
Created attachment 34568 [details] Patch to add GraphicsContext to WebCore/platform/graphics/haiku.
Maxime Simon
Comment 5 2009-08-11 09:59:18 PDT
Created attachment 34570 [details] Patch to add ImageSource to WebCore/platform/graphics/haiku.
Eric Seidel (no email)
Comment 6 2009-08-12 10:24:24 PDT
Peter is our Image* guy these days.
Eric Seidel (no email)
Comment 7 2009-08-12 10:25:51 PDT
Comment on attachment 34568 [details] Patch to add GraphicsContext to WebCore/platform/graphics/haiku. Looks OK.
Eric Seidel (no email)
Comment 8 2009-08-12 10:28:14 PDT
Comment on attachment 34566 [details] Patch to add four image-specific files to WebCore/platform/graphics/. It seems this is not needed: Icon::Icon() 35 { 36 notImplemented(); 37 } Please remove it from both Icon.h and from Icon.cpp
Peter Kasting
Comment 9 2009-08-12 10:31:04 PDT
Comment on attachment 34570 [details] Patch to add ImageSource to WebCore/platform/graphics/haiku. > diff --git a/WebCore/platform/graphics/haiku/ImageSourceHaiku.cpp b/WebCore/platform/graphics/haiku/ImageSourceHaiku.cpp > new file mode 100644 > index 0000000..ee2184c > --- /dev/null > +++ b/WebCore/platform/graphics/haiku/ImageSourceHaiku.cpp > @@ -0,0 +1,222 @@> +// FIXME: Should use the Haiku translator API. As of yesterday, there's a cross-platform ImageSource.cpp in platform/graphics. It looks at a glance like you could just build with this file (except for one item I note below) instead of adding an ImageSourceHaiku.cpp. > +ImageDecoder* createDecoder(const Vector<char>& data) > +{ > + > + // JPEG > + // FIXME: Add JPEG support. You're using the cross-platform decoders for all other filetypes. Is there something wrong with the cross-platform JPEG decoder that prevents you from even instantiating it?
Maxime Simon
Comment 10 2009-08-12 11:04:51 PDT
(In reply to comment #9) > > +ImageDecoder* createDecoder(const Vector<char>& data) > > +{ > > + > > + // JPEG > > + // FIXME: Add JPEG support. > > You're using the cross-platform decoders for all other filetypes. Is there > something wrong with the cross-platform JPEG decoder that prevents you from > even instantiating it? Indeed, in the default Haiku distribution libjpeg isn't available. Of course we could add it as dependency, but the basic way to handle ImageDecoder in Haiku is to use BTranslators. And we intended to use it for all the other filetypes as well. I may have to discuss it with Ryan. Regards, Maxime
Peter Kasting
Comment 11 2009-08-12 11:21:52 PDT
(In reply to comment #10) > (In reply to comment #9) > > > +ImageDecoder* createDecoder(const Vector<char>& data) > > > +{ > > > + > > > + // JPEG > > > + // FIXME: Add JPEG support. > > > > You're using the cross-platform decoders for all other filetypes. Is there > > something wrong with the cross-platform JPEG decoder that prevents you from > > even instantiating it? > > Indeed, in the default Haiku distribution libjpeg isn't available. > Of course we could add it as dependency, but the basic way to handle > ImageDecoder in Haiku is to use BTranslators. And we intended to use it for all > the other filetypes as well. I may have to discuss it with Ryan. I see. Well, if you want to land the patch in the sort of state it's in now, we could either #if !PLATFORM(HAIKU) (or whatever the appropriate switch is) that block, or add some sort of ENABLE flag (which I am less in favor of). If you want to use a completely different mechanism (I have no idea what BTranslators are :D), we can design for that once you've got code that would work.
Ryan Leavengood
Comment 12 2009-08-12 11:35:22 PDT
(In reply to comment #11) > > I see. Well, if you want to land the patch in the sort of state it's in now, > we could either #if !PLATFORM(HAIKU) (or whatever the appropriate switch is) > that block, or add some sort of ENABLE flag (which I am less in favor of). Maxime let's just revert to using their ImageDecoder for now, and we can try using translators later. > If you want to use a completely different mechanism (I have no idea what > BTranslators are :D), we can design for that once you've got code that would > work. Maybe you really don't care, but: Translators are a pretty interesting idea from BeOS (that has been copied in Haiku) which allow file formats to be converted to a common base format to facilitate all kinds of conversions. It is sort of like translating languages into a base language to translate between them (though it works a lot better for binary data than human languages.) The main use at the moment is for images, so that all the image translators can convert to and from a basic bitmap, which allows conversions from PNG to JPG, JPG to GIF, RAW to PNG, etc. It is a pretty cool idea and of course we want to make use of such nice Haiku-only technologies in our WebKit port to make it truly native. The end result of this should be that our WebKit port would be able to render any images we have a translator for, without having to modify or recompile WebKit itself. We can come back to this later when we have something better working. Your willingness to adapt WebKit to help us is very much appreciated!
Peter Kasting
Comment 13 2009-08-12 11:54:32 PDT
(In reply to comment #12) > Translators are a pretty interesting idea from BeOS (that has been copied in > Haiku) which allow file formats to be converted to a common base format to > facilitate all kinds of conversions. It is sort of like translating languages > into a base language to translate between them (though it works a lot better > for binary data than human languages.) The main use at the moment is for > images, so that all the image translators can convert to and from a basic > bitmap, which allows conversions from PNG to JPG, JPG to GIF, RAW to PNG, etc. > > It is a pretty cool idea and of course we want to make use of such nice > Haiku-only technologies in our WebKit port to make it truly native. The end > result of this should be that our WebKit port would be able to render any > images we have a translator for, without having to modify or recompile WebKit > itself. Beware of the potential cost of that, if fitting it into WebCore involves e.g. copying an image's data, or doing more than one conversion. Decoding images has to be really, really fast in a web browser :)
Ryan Leavengood
Comment 14 2009-08-12 12:34:12 PDT
(In reply to comment #13) > > Beware of the potential cost of that, if fitting it into WebCore involves e.g. > copying an image's data, or doing more than one conversion. Decoding images > has to be really, really fast in a web browser :) Good point. There might be some overhead in using the translator system but hopefully not too much. We can do some benchmarks to be sure, but even if using the translators is a bit slower it might still be worth it. At least it shouldn't affect other ports ;) One other issue is that the translator system does not yet (and may never) support animated images. So for GIFs (and other future animated image formats, MNG, APNG, etc) we would have to fallback to using the WebKit decoders. But I'm tempted to try to fix that in Haiku...it is just tricky since translators are for any kind of data not just images.
Ryan Leavengood
Comment 15 2009-08-12 12:37:04 PDT
(In reply to comment #13) > > Beware of the potential cost of that, if fitting it into WebCore involves e.g. > copying an image's data, or doing more than one conversion. Decoding images > has to be really, really fast in a web browser :) Actually this has made me wonder: have you guys ever considered moving image loading and decoding into another thread? Maybe that would add unnecessary complexity and locking issues but at first glance it seems like something that would benefit from parallelism (multiple cores and all being common these days.)
Peter Kasting
Comment 16 2009-08-12 12:52:01 PDT
(In reply to comment #15) > Actually this has made me wonder: have you guys ever considered moving image > loading and decoding into another thread? Maybe that would add unnecessary > complexity and locking issues but at first glance it seems like something that > would benefit from parallelism (multiple cores and all being common these > days.) Not sure it'd be a big win since image decoding only happens on-demand, when the image is actually going to be drawn onscreen. Maybe for lots of images that are all visible at once. I haven't given it a lot of thought. Consider asking dhyatt on IRC.
Eric Seidel (no email)
Comment 17 2009-08-12 14:02:35 PDT
Comment on attachment 34568 [details] Patch to add GraphicsContext to WebCore/platform/graphics/haiku. Clearing flags on attachment: 34568 Committing to http://svn.webkit.org/repository/webkit/trunk ... M WebCore/ChangeLog A WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp Committed r47147 M WebCore/ChangeLog A WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp r47147 = 898556fb5c9912a0b53f789ad3e50e439ce26999 (trunk) No changes between current HEAD and refs/remotes/trunk Resetting to the latest refs/remotes/trunk http://trac.webkit.org/changeset/47147
Eric Seidel (no email)
Comment 18 2009-08-12 14:02:40 PDT
All reviewed patches have been landed. Closing bug.
Eric Seidel (no email)
Comment 19 2009-08-12 14:19:14 PDT
Sorry for the early closure. We just hit bug 28230.
Maxime Simon
Comment 20 2009-08-13 01:45:42 PDT
Created attachment 34720 [details] Adding four image-specific files to WebCore. --- 6 files changed, 386 insertions(+), 2 deletions(-)
Maxime Simon
Comment 21 2009-08-13 02:20:43 PDT
Comment on attachment 34570 [details] Patch to add ImageSource to WebCore/platform/graphics/haiku. I marked this patch as obsolete, we will use ImageSource.cpp instead. Tough I will post a new bug with a patch as the Haiku port doesn't support JPEG for now.
Eric Seidel (no email)
Comment 22 2009-08-18 15:12:12 PDT
Comment on attachment 34720 [details] Adding four image-specific files to WebCore. Looks OK.
Eric Seidel (no email)
Comment 23 2009-08-18 16:47:46 PDT
Comment on attachment 34720 [details] Adding four image-specific files to WebCore. Clearing flags on attachment: 34720 Committed r47463: <http://trac.webkit.org/changeset/47463>
Eric Seidel (no email)
Comment 24 2009-08-18 16:47:52 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.