diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
commit | 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch) | |
tree | 4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h | |
parent | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff) | |
download | external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h')
-rw-r--r-- | WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h b/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h index 0abdea6..84350e8 100644 --- a/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h +++ b/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h @@ -31,25 +31,50 @@ #ifndef PixelDumpSupportCG_h #define PixelDumpSupportCG_h +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> #include <wtf/RetainPtr.h> -#ifndef CGFLOAT_DEFINED -#ifdef __LP64__ -typedef double CGFloat; -#else -typedef float CGFloat; +typedef struct CGContext* CGContextRef; + +#if PLATFORM(MAC) +typedef void* PlatformBitmapBuffer; +#elif PLATFORM(WIN) +typedef HBITMAP PlatformBitmapBuffer; #endif -#define CGFLOAT_DEFINED 1 + +class BitmapContext : public RefCounted<BitmapContext> { +public: + static PassRefPtr<BitmapContext> createByAdoptingBitmapAndContext(PlatformBitmapBuffer buffer, CGContextRef context) + { + return adoptRef(new BitmapContext(buffer, context)); + } + + ~BitmapContext() + { + if (m_buffer) +#if PLATFORM(MAC) + free(m_buffer); +#elif PLATFORM(WIN) + DeleteObject(m_buffer); #endif + } -typedef struct CGContext* CGContextRef; -struct CGRect; + CGContextRef cgContext() const { return m_context.get(); } + +private: + + BitmapContext(PlatformBitmapBuffer buffer, CGContextRef context) + : m_buffer(buffer) + , m_context(AdoptCF, context) + { + } + + PlatformBitmapBuffer m_buffer; + RetainPtr<CGContextRef> m_context; -RetainPtr<CGContextRef> getBitmapContextFromWebView(); -CGRect getSelectionRect(); +}; -void paintWebView(CGContextRef); -void repaintWebView(CGContextRef context, bool horizontal); -void drawSelectionRect(CGContextRef, const CGRect&); +PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect); #endif // PixelDumpSupportCG_h |