2 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies)
3 * Copyright (C) 2013 Company 100, Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef CoordinatedGraphicsState_h
28 #define CoordinatedGraphicsState_h
30 #if USE(COORDINATED_GRAPHICS)
33 #include "FloatRect.h"
34 #include "FloatSize.h"
35 #include "GraphicsLayerAnimation.h"
38 #include "SurfaceUpdateInfo.h"
39 #include "TransformationMatrix.h"
41 #if ENABLE(CSS_FILTERS)
42 #include "FilterOperations.h"
45 #if USE(GRAPHICS_SURFACE)
46 #include "GraphicsSurfaceToken.h"
51 class CoordinatedSurface;
53 typedef uint32_t CoordinatedLayerID;
54 enum { InvalidCoordinatedLayerID = 0 };
56 typedef uint64_t CoordinatedImageBackingID;
57 enum { InvalidCoordinatedImageBackingID = 0 };
59 struct TileUpdateInfo {
62 WebCore::SurfaceUpdateInfo updateInfo;
65 struct TileCreationInfo {
70 struct CoordinatedGraphicsLayerState {
73 bool positionChanged: 1;
74 bool anchorPointChanged: 1;
76 bool transformChanged: 1;
77 bool childrenTransformChanged: 1;
78 bool contentsRectChanged: 1;
79 bool opacityChanged: 1;
80 bool solidColorChanged: 1;
81 bool debugBorderColorChanged: 1;
82 bool debugBorderWidthChanged: 1;
83 bool replicaChanged: 1;
87 bool animationsChanged: 1;
88 bool filtersChanged: 1;
89 bool childrenChanged: 1;
90 bool repaintCountChanged : 1;
91 bool canvasChanged: 1;
92 bool canvasShouldSwapBuffers: 1;
93 bool isScrollableChanged: 1;
94 bool committedScrollOffsetChanged: 1;
100 bool contentsOpaque : 1;
101 bool drawsContent : 1;
102 bool contentsVisible : 1;
103 bool backfaceVisible : 1;
104 bool masksToBounds : 1;
105 bool preserves3D : 1;
107 bool fixedToViewport : 1;
108 bool showDebugBorders : 1;
109 bool showRepaintCounter : 1;
110 bool isScrollable: 1;
115 CoordinatedGraphicsLayerState()
117 , contentsOpaque(false)
118 , drawsContent(false)
119 , contentsVisible(true)
120 , backfaceVisible(true)
121 , masksToBounds(false)
124 , fixedToViewport(false)
125 , showDebugBorders(false)
126 , showRepaintCounter(false)
128 , debugBorderWidth(0)
129 , replica(InvalidCoordinatedLayerID)
130 , mask(InvalidCoordinatedLayerID)
131 , imageID(InvalidCoordinatedImageBackingID)
132 #if USE(GRAPHICS_SURFACE)
133 , canvasFrontBuffer(0)
139 FloatPoint3D anchorPoint;
141 TransformationMatrix transform;
142 TransformationMatrix childrenTransform;
143 IntRect contentsRect;
146 Color debugBorderColor;
147 float debugBorderWidth;
148 #if ENABLE(CSS_FILTERS)
149 FilterOperations filters;
151 GraphicsLayerAnimations animations;
152 Vector<uint32_t> children;
153 Vector<TileCreationInfo> tilesToCreate;
154 Vector<uint32_t> tilesToRemove;
155 CoordinatedLayerID replica;
156 CoordinatedLayerID mask;
157 CoordinatedImageBackingID imageID;
159 unsigned repaintCount;
160 Vector<TileUpdateInfo> tilesToUpdate;
162 #if USE(GRAPHICS_SURFACE)
164 GraphicsSurfaceToken canvasToken;
165 uint32_t canvasFrontBuffer;
168 IntSize committedScrollOffset;
171 struct CoordinatedGraphicsState {
172 uint32_t rootCompositingLayer;
173 Color backgroundColor;
174 FloatPoint scrollPosition;
175 IntSize contentsSize;
178 Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState> > layersToUpdate;
179 Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedSurface> > > imagesToUpdate;
182 } // namespace WebCore
184 #endif // USE(COORDINATED_GRAPHICS)
186 #endif // CoordinatedGraphicsState_h