WebKit Bugzilla
Attachment 340088 Details for
Bug 185511
: [GTK] Implement ImageBuffer::toBGRAData
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
(In reply to Michael Catanzaro from comment #3)
GTK-Implement-ImageBuffertoBGRAData.patch (text/plain), 4.15 KB, created by
Thibault Saunier
on 2018-05-10 07:06:35 PDT
(
hide
)
Description:
(In reply to Michael Catanzaro from comment #3)
Filename:
MIME Type:
Creator:
Thibault Saunier
Created:
2018-05-10 07:06:35 PDT
Size:
4.15 KB
patch
obsolete
>From 092fdbd5e39659ec1cb7c5dd57e9dd6dec416ea3 Mon Sep 17 00:00:00 2001 >From: Thibault Saunier <tsaunier@igalia.com> >Date: Wed, 25 Apr 2018 11:59:59 -0300 >Subject: [PATCH xserver] [GTK] Implement ImageBuffer::toBGRAData > >This was never implemented but will be required for the MediaStream API >tests. > >https://bugs.webkit.org/show_bug.cgi?id=185511 >--- > Source/WebCore/ChangeLog | 17 +++++++++++++++++ > .../WebCore/platform/graphics/ImageBuffer.cpp | 8 ++------ > .../platform/graphics/cg/ImageBufferCG.cpp | 7 +++++++ > .../platform/graphics/gtk/ImageBufferGtk.cpp | 12 +++++++++++- > 4 files changed, 37 insertions(+), 7 deletions(-) > >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a4a108d4e9a..e4f0903dc0d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2018-05-10 Thibault Saunier <tsaunier@igalia.com> >+ >+ [GTK] Implement ImageBuffer::toBGRAData >+ https://bugs.webkit.org/show_bug.cgi?id=185511 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This was never implemented but will be required for the MediaStream API >+ tests. >+ >+ * platform/graphics/ImageBuffer.cpp: >+ (WebCore::ImageBuffer::toBGRAData const): >+ * platform/graphics/cg/ImageBufferCG.cpp: >+ (WebCore::ImageBuffer::toBGRAData const): >+ * platform/graphics/gtk/ImageBufferGtk.cpp: >+ (WebCore::ImageBuffer::toBGRAData const): >+ > 2018-05-10 Thibault Saunier <tsaunier@igalia.com> > > [GStreamer] Fix style issue in MediaPlayerPrivateGStreamerBase >diff --git a/Source/WebCore/platform/graphics/ImageBuffer.cpp b/Source/WebCore/platform/graphics/ImageBuffer.cpp >index 4145b2b8f1e..8e859650f12 100644 >--- a/Source/WebCore/platform/graphics/ImageBuffer.cpp >+++ b/Source/WebCore/platform/graphics/ImageBuffer.cpp >@@ -102,17 +102,13 @@ FloatRect ImageBuffer::clampedRect(const FloatRect& rect) > return FloatRect(rect.location(), clampedSize(rect.size())); > } > >+#if !USE(CG) && !PLATFORM(GTK) > Vector<uint8_t> ImageBuffer::toBGRAData() const > { >-#if USE(CG) >- if (context().isAcceleratedContext()) >- flushContext(); >- return m_data.toBGRAData(context().isAcceleratedContext(), m_size.width(), m_size.height()); >-#else > // FIXME: Implement this for other backends. > return { }; >-#endif > } >+#endif > > #if !(USE(CG) || USE(DIRECT2D)) > >diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >index f485a3414e5..a6b122c852b 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >@@ -630,6 +630,13 @@ Vector<uint8_t> data(const ImageData& source, const String& mimeType, std::optio > return { }; > } > >+Vector<uint8_t> ImageBuffer::toBGRAData() const >+{ >+ if (context().isAcceleratedContext()) >+ flushContext(); >+ return m_data.toBGRAData(context().isAcceleratedContext(), m_size.width(), m_size.height()); >+} >+ > } // namespace WebCore > > #endif >diff --git a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp >index b23e64769e9..ed3a11f913b 100644 >--- a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp >+++ b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp >@@ -20,8 +20,8 @@ > #include "ImageBuffer.h" > > #include "CairoUtilities.h" >-#include "GdkCairoUtilities.h" > #include "GRefPtrGtk.h" >+#include "GdkCairoUtilities.h" > #include "MIMETypeRegistry.h" > #include <cairo.h> > #include <gtk/gtk.h> >@@ -87,6 +87,16 @@ String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> qual > return "data:" + mimeType + ";base64," + base64Data; > } > >+Vector<uint8_t> ImageBuffer::toBGRAData() const >+{ >+ auto pixbuf = adoptGRef(cairoSurfaceToGdkPixbuf(m_data.m_surface.get())); >+ auto pixels = gdk_pixbuf_get_pixels(pixbuf.get()); >+ >+ Vector<uint8_t> imageData; >+ imageData.append(pixels, gdk_pixbuf_get_byte_length(pixbuf.get())); >+ return imageData; >+} >+ > Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const > { > ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); >-- >2.17.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185511
:
340086
|
340087
| 340088