Changeset 21415 in webkit
- Timestamp:
- May 11, 2007 1:27:19 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r21414 r21415 1 2007-05-11 Holger Hans Peter Freyther <zecke@selfish.org> 2 3 Reviewed by Maciej. 4 5 Bug 13676: [cairo/gdk] Provide implementation for ImageBufferCairo 6 http://bugs.webkit.org/show_bug.cgi?id=13676 7 8 There are no test cases that explicitly cover platform/graphics at present. 9 10 * platform/graphics/ImageBuffer.h: Add cairo bits 11 * platform/graphics/cairo/ImageBufferCairo.cpp: Untested implementation of the ImagerBuffer using the image_surface 12 (WebCore::ImageBuffer::create): Create a reasonable sized surface 13 (WebCore::ImageBuffer::ImageBuffer): Use a cairo_surface and create a GraphicsContext. GraphicsContext takes the cairo_t ownership 14 (WebCore::ImageBuffer::~ImageBuffer): Unref the surface 15 (WebCore::ImageBuffer::context): simply return the GraphicsContext, it should be possible to directly draw on it. 16 1 17 2007-05-11 Mitz Pettel <mitz@webkit.org> 2 18 -
trunk/WebCore/platform/graphics/ImageBuffer.h
r19290 r21415 40 40 #endif 41 41 42 #if PLATFORM(CAIRO) 43 struct _cairo_surface; 44 #endif 45 42 46 namespace WebCore { 43 47 … … 78 82 mutable QPixmap m_pixmap; 79 83 mutable QPainter* m_painter; 84 #elif PLATFORM(CAIRO) 85 ImageBuffer(_cairo_surface* surface); 86 mutable _cairo_surface *m_surface; 80 87 #endif 81 88 }; -
trunk/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
r21340 r21415 29 29 30 30 #include "GraphicsContext.h" 31 #include <cairo.h> 31 32 32 33 #define notImplemented() do { fprintf(stderr, "FIXME: UNIMPLEMENTED %s %s:%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); } while(0) … … 36 37 namespace WebCore { 37 38 38 auto_ptr<ImageBuffer> ImageBuffer::create(const IntSize& size, bool grayScale)39 auto_ptr<ImageBuffer> ImageBuffer::create(const IntSize& size, bool) 39 40 { 40 return auto_ptr<ImageBuffer>(); 41 cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 42 size.width(), size.height()); 43 if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) 44 return auto_ptr<ImageBuffer>(); 45 46 return auto_ptr<ImageBuffer>(new ImageBuffer(surface)); 41 47 } 42 48 49 ImageBuffer::ImageBuffer(_cairo_surface* surface) 50 : m_surface(surface) 51 { 52 cairo_t* context = cairo_create(m_surface); 53 m_context.set(new GraphicsContext(context)); 54 55 /* 56 * The context is now owned by the GraphicsContext 57 */ 58 cairo_destroy(context); 59 } 43 60 44 61 ImageBuffer::~ImageBuffer() 45 62 { 63 cairo_surface_destroy(m_surface); 46 64 } 47 65 48 66 GraphicsContext* ImageBuffer::context() const 49 67 { 50 return 0;68 return m_context.get(); 51 69 } 52 70
Note: See TracChangeset
for help on using the changeset viewer.