Changeset 56354 in webkit
- Timestamp:
- Mar 22, 2010 12:37:17 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r56353 r56354 1 2010-03-22 Philippe Normand <pnormand@igalia.com> 2 3 Reviewed by Eric Carlson. 4 5 [GStreamer] Use ImageBuffer API to do painting 6 https://bugs.webkit.org/show_bug.cgi?id=35783 7 8 New ImageGStreamer class abstracting the conversion of GStreamer 9 buffers to cairo surfaces. Using this makes the painting code of 10 the player more generic. 11 12 * GNUmakefile.am: 13 * platform/graphics/gstreamer/ImageGStreamer.h: Added. 14 (WebCore::ImageGStreamer::image): 15 * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: Added. 16 (ImageGStreamer::createImage): 17 (ImageGStreamer::ImageGStreamer): 18 (ImageGStreamer::~ImageGStreamer): 19 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 20 (WebCore::MediaPlayerPrivate::paint): 21 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 22 1 23 2010-03-22 Beth Dakin <bdakin@apple.com> 2 24 -
trunk/WebCore/GNUmakefile.am
r56241 r56354 2474 2474 WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp \ 2475 2475 WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h \ 2476 WebCore/platform/graphics/gstreamer/ImageGStreamer.h \ 2477 WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp \ 2476 2478 WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp \ 2477 2479 WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h -
trunk/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r56010 r56354 29 29 30 30 31 #include "ColorSpace.h" 31 32 #include "CString.h" 32 33 #include "DataSourceGStreamer.h" … … 36 37 #include "GOwnPtrGStreamer.h" 37 38 #include "GraphicsContext.h" 39 #include "GraphicsTypes.h" 40 #include "ImageGStreamer.h" 38 41 #include "IntRect.h" 39 42 #include "KURL.h" … … 1205 1208 return; 1206 1209 1207 int width = 0, height = 0; 1208 GstCaps* caps = gst_buffer_get_caps(m_buffer); 1209 GstVideoFormat format; 1210 1211 if (!gst_video_format_parse_caps(caps, &format, &width, &height)) { 1212 gst_caps_unref(caps); 1213 return; 1214 } 1215 1216 cairo_format_t cairoFormat; 1217 if (format == GST_VIDEO_FORMAT_ARGB || format == GST_VIDEO_FORMAT_BGRA) 1218 cairoFormat = CAIRO_FORMAT_ARGB32; 1219 else 1220 cairoFormat = CAIRO_FORMAT_RGB24; 1221 1222 cairo_t* cr = context->platformContext(); 1223 cairo_surface_t* src = cairo_image_surface_create_for_data(GST_BUFFER_DATA(m_buffer), 1224 cairoFormat, 1225 width, height, 1226 4 * width); 1227 1228 cairo_save(cr); 1229 1230 // translate and scale the context to correct size 1231 cairo_translate(cr, rect.x(), rect.y()); 1232 cairo_scale(cr, static_cast<double>(rect.width()) / width, static_cast<double>(rect.height()) / height); 1233 1234 // And paint it. 1235 cairo_set_source_surface(cr, src, 0, 0); 1236 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_PAD); 1237 cairo_rectangle(cr, 0, 0, width, height); 1238 cairo_fill(cr); 1239 cairo_restore(cr); 1240 1241 cairo_surface_destroy(src); 1242 gst_caps_unref(caps); 1210 RefPtr<ImageGStreamer> gstImage = ImageGStreamer::createImage(m_buffer); 1211 if (!gstImage) 1212 return; 1213 1214 context->drawImage(reinterpret_cast<Image*>(gstImage->image().get()), sRGBColorSpace, 1215 rect, CompositeCopy, false); 1243 1216 } 1244 1217 -
trunk/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
r56010 r56354 29 29 #include "Timer.h" 30 30 31 #include <cairo.h>32 31 #include <glib.h> 33 32 #include <gst/gst.h>
Note: See TracChangeset
for help on using the changeset viewer.