2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2008 Brent Fulgham <bfulgham@gmail.com>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef GraphicsContextPlatformPrivateCairo_h
29 #define GraphicsContextPlatformPrivateCairo_h
31 #include "GraphicsContext.h"
35 #include "PlatformContextCairo.h"
36 #include "RefPtrCairo.h"
42 #include <cairo-win32.h>
47 class GraphicsContextPlatformPrivate {
49 GraphicsContextPlatformPrivate(PlatformContextCairo* newPlatformContext)
50 : platformContext(newPlatformContext)
51 #if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
52 // NOTE: These may note be needed: review and remove once Cairo implementation is complete
54 , m_shouldIncludeChildWindows(false)
59 virtual ~GraphicsContextPlatformPrivate()
64 // On Windows, we need to update the HDC for form controls to draw in the right place.
68 void clip(const FloatRect&);
69 void clip(const Path&);
70 void scale(const FloatSize&);
72 void translate(float, float);
73 void concatCTM(const AffineTransform&);
74 void setCTM(const AffineTransform&);
75 void syncContext(cairo_t* cr);
77 // On everything else, we do nothing.
81 void clip(const FloatRect&) {}
82 void clip(const Path&) {}
83 void scale(const FloatSize&) {}
85 void translate(float, float) {}
86 void concatCTM(const AffineTransform&) {}
87 void setCTM(const AffineTransform&) {}
88 void syncContext(cairo_t*) { }
91 PlatformContextCairo* platformContext;
94 #if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
96 bool m_shouldIncludeChildWindows;
100 // This is a specialized private section for the Cairo GraphicsContext, which knows how
101 // to clean up the heap allocated PlatformContextCairo that we must use for the top-level
103 class GraphicsContextPlatformPrivateToplevel : public GraphicsContextPlatformPrivate {
105 GraphicsContextPlatformPrivateToplevel(PlatformContextCairo* platformContext)
106 : GraphicsContextPlatformPrivate(platformContext)
110 virtual ~GraphicsContextPlatformPrivateToplevel()
112 delete platformContext;
117 } // namespace WebCore
121 #endif // GraphicsContextPlatformPrivateCairo_h