]> git.saurik.com Git - iphone-api.git/blob - WebCore/GraphicsLayerCA.h
Adding the WebCore headers (for Cydget).
[iphone-api.git] / WebCore / GraphicsLayerCA.h
1 /*
2 * Copyright (C) 2009 Apple 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 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 GraphicsLayerCA_h
27 #define GraphicsLayerCA_h
28
29 #if USE(ACCELERATED_COMPOSITING)
30
31 #include "GraphicsLayer.h"
32 #include <wtf/RetainPtr.h>
33
34 @class WebAnimationDelegate;
35 @class WebLayer;
36
37 namespace WebCore {
38
39 class GraphicsLayerCA : public GraphicsLayer {
40 public:
41
42 GraphicsLayerCA(GraphicsLayerClient*);
43 virtual ~GraphicsLayerCA();
44
45 virtual void setName(const String&);
46
47 // for hosting this GraphicsLayer in a native layer hierarchy
48 virtual NativeLayer nativeLayer() const;
49
50 virtual void addChild(GraphicsLayer*);
51 virtual void addChildAtIndex(GraphicsLayer*, int index);
52 virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling);
53 virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling);
54 virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
55
56 virtual void removeFromParent();
57
58 virtual void setPosition(const FloatPoint&);
59 virtual void setAnchorPoint(const FloatPoint3D&);
60 virtual void setSize(const FloatSize&);
61
62 virtual void setTransform(const TransformationMatrix&);
63
64 virtual void setChildrenTransform(const TransformationMatrix&);
65
66 virtual void setPreserves3D(bool);
67 virtual void setMasksToBounds(bool);
68 virtual void setDrawsContent(bool);
69
70 virtual void setBackgroundColor(const Color&, const Animation* anim = 0, double beginTime = 0);
71 virtual void clearBackgroundColor();
72
73 virtual void setContentsOpaque(bool);
74 virtual void setBackfaceVisibility(bool);
75
76 // return true if we started an animation
77 virtual bool setOpacity(float, const Animation* anim = 0, double beginTime = 0);
78
79 virtual void setNeedsDisplay();
80 virtual void setNeedsDisplayInRect(const FloatRect&);
81
82 virtual void suspendAnimations();
83 virtual void resumeAnimations();
84
85 virtual bool animateTransform(const TransformValueList&, const IntSize&, const Animation*, double beginTime, bool isTransition);
86 virtual bool animateFloat(AnimatedPropertyID, const FloatValueList&, const Animation*, double beginTime);
87
88 virtual void setContentsToImage(Image*);
89 virtual void setContentsToVideo(PlatformLayer*);
90 virtual void clearContents();
91
92 virtual void updateContentsRect();
93
94 virtual PlatformLayer* platformLayer() const;
95
96 virtual void setContentsScale(float);
97
98 virtual void setDebugBackgroundColor(const Color&);
99 virtual void setDebugBorder(const Color&, float borderWidth);
100 virtual void setZPosition(float);
101
102 private:
103 WebLayer* primaryLayer() const { return m_transformLayer.get() ? m_transformLayer.get() : m_layer.get(); }
104 WebLayer* hostLayerForSublayers() const;
105 WebLayer* layerForSuperlayer() const;
106
107 WebLayer* animatedLayer(AnimatedPropertyID property) const
108 {
109 return (property == AnimatedPropertyBackgroundColor) ? m_contentsLayer.get() : primaryLayer();
110 }
111
112 void setBasicAnimation(AnimatedPropertyID, TransformOperation::OperationType, short index, void* fromVal, void* toVal, bool isTransition, const Animation*, double time);
113 void setKeyframeAnimation(AnimatedPropertyID, TransformOperation::OperationType, short index, void* keys, void* values, void* timingFunctions, bool isTransition, const Animation*, double time);
114
115 virtual void removeAnimation(int index, bool reset);
116
117 bool requiresTiledLayer(const FloatSize&) const;
118 void swapFromOrToTiledLayer(bool useTiledLayer);
119
120 void setHasContentsLayer(bool);
121 void setContentsLayer(WebLayer*);
122 void setContentsLayerFlipped(bool);
123
124 RetainPtr<WebLayer> m_layer;
125 RetainPtr<WebLayer> m_transformLayer;
126 RetainPtr<WebLayer> m_contentsLayer;
127
128 RetainPtr<WebAnimationDelegate> m_animationDelegate;
129
130 bool m_contentLayerForImageOrVideo;
131 };
132
133 } // namespace WebCore
134
135
136 #endif // USE(ACCELERATED_COMPOSITING)
137
138 #endif // GraphicsLayerCA_h