• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef GraphicsContextPrivate_h
27 #define GraphicsContextPrivate_h
28 
29 #include "TransformationMatrix.h"
30 #include "Gradient.h"
31 #include "GraphicsContext.h"
32 #include "Pattern.h"
33 
34 namespace WebCore {
35 
36     struct GraphicsContextState {
GraphicsContextStateGraphicsContextState37         GraphicsContextState()
38             : textDrawingMode(cTextFill)
39             , strokeStyle(SolidStroke)
40             , strokeThickness(0)
41 #if PLATFORM(CAIRO)
42             , globalAlpha(1.0f)
43 #endif
44             , strokeColorSpace(SolidColorSpace)
45             , strokeColor(Color::black)
46             , fillRule(RULE_NONZERO)
47             , fillColorSpace(SolidColorSpace)
48             , fillColor(Color::black)
49             , shouldAntialias(true)
50             , paintingDisabled(false)
51             , shadowBlur(0)
52             , shadowsIgnoreTransforms(false)
53         {
54         }
55 
56         int textDrawingMode;
57 
58         StrokeStyle strokeStyle;
59         float strokeThickness;
60 #if PLATFORM(CAIRO)
61         float globalAlpha;
62 #elif PLATFORM(QT)
63         TransformationMatrix pathTransform;
64 #endif
65         ColorSpace strokeColorSpace;
66         Color strokeColor;
67         RefPtr<Gradient> strokeGradient;
68         RefPtr<Pattern> strokePattern;
69 
70         WindRule fillRule;
71         ColorSpace fillColorSpace;
72         Color fillColor;
73         RefPtr<Gradient> fillGradient;
74         RefPtr<Pattern> fillPattern;
75 
76         bool shouldAntialias;
77 
78         bool paintingDisabled;
79 
80         IntSize shadowSize;
81         unsigned shadowBlur;
82         Color shadowColor;
83 
84         bool shadowsIgnoreTransforms;
85     };
86 
87     class GraphicsContextPrivate {
88     public:
GraphicsContextPrivate()89         GraphicsContextPrivate()
90             : m_focusRingWidth(0)
91             , m_focusRingOffset(0)
92             , m_updatingControlTints(false)
93         {
94         }
95 
96         GraphicsContextState state;
97         Vector<GraphicsContextState> stack;
98         Vector<IntRect> m_focusRingRects;
99         int m_focusRingWidth;
100         int m_focusRingOffset;
101         bool m_updatingControlTints;
102     };
103 
104 } // namespace WebCore
105 
106 #endif // GraphicsContextPrivate_h
107