2 * Copyright (C) 2009 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef GraphicsLayerAndroid_h
18 #define GraphicsLayerAndroid_h
20 #if USE(ACCELERATED_COMPOSITING)
22 #include "FloatRect.h"
24 #include "GraphicsLayer.h"
25 #include "GraphicsLayerClient.h"
26 #include "LayerAndroid.h"
28 #include "SkBitmapRef.h"
38 class ScrollableLayerAndroid;
40 class GraphicsLayerAndroid : public GraphicsLayer {
43 GraphicsLayerAndroid(GraphicsLayerClient*);
44 virtual ~GraphicsLayerAndroid();
46 virtual void setName(const String&);
48 // for hosting this GraphicsLayer in a native layer hierarchy
49 virtual NativeLayer nativeLayer() const;
51 virtual bool setChildren(const Vector<GraphicsLayer*>&);
52 virtual void addChild(GraphicsLayer*);
53 virtual void addChildAtIndex(GraphicsLayer*, int index);
54 virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling);
55 virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling);
56 virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
58 virtual void removeFromParent();
60 virtual void setPosition(const FloatPoint&);
61 virtual void setPreserves3D(bool b);
62 virtual void setAnchorPoint(const FloatPoint3D&);
63 virtual void setSize(const FloatSize&);
65 virtual void setBackfaceVisibility(bool b);
66 virtual void setTransform(const TransformationMatrix&);
68 virtual void setChildrenTransform(const TransformationMatrix&);
70 virtual void setMaskLayer(GraphicsLayer*);
71 virtual void setMasksToBounds(bool);
72 virtual void setDrawsContent(bool);
74 virtual void setBackgroundColor(const Color&);
75 virtual void clearBackgroundColor();
77 virtual void setContentsOpaque(bool);
79 virtual void setOpacity(float);
81 virtual void setNeedsDisplay();
82 virtual void setNeedsDisplayInRect(const FloatRect&);
84 virtual bool addAnimation(const KeyframeValueList& valueList,
85 const IntSize& boxSize,
86 const Animation* anim,
87 const String& keyframesName,
89 bool createTransformAnimationsFromKeyframes(const KeyframeValueList&,
91 const String& keyframesName,
93 const IntSize& boxSize);
94 bool createAnimationFromKeyframes(const KeyframeValueList&,
96 const String& keyframesName,
99 virtual void removeAnimationsForProperty(AnimatedPropertyID);
100 virtual void removeAnimationsForKeyframes(const String& keyframesName);
101 virtual void pauseAnimation(const String& keyframesName);
103 virtual void suspendAnimations(double time);
104 virtual void resumeAnimations();
106 virtual void setContentsToImage(Image*);
107 virtual void setContentsToMedia(PlatformLayer*);
108 virtual PlatformLayer* platformLayer() const;
110 void pauseDisplay(bool state);
113 virtual void setDebugBackgroundColor(const Color&);
114 virtual void setDebugBorder(const Color&, float borderWidth);
117 virtual void setZPosition(float);
119 virtual void syncCompositingState();
120 void notifyClientAnimationStarted();
122 LayerAndroid* contentLayer() { return m_contentLayer; }
124 static int instancesCount();
129 void syncPositionState();
133 void updateFixedPosition();
134 void updateScrollingLayers();
136 // with SkPicture, we always repaint the entire layer's content.
138 void needsNotifyClient();
140 bool paintContext(SkPicture* context, const IntRect& rect);
142 bool m_needsSyncChildren;
143 bool m_needsSyncMask;
145 bool m_needsNotifyClient;
151 SkRegion m_dirtyRegion;
153 LayerAndroid* m_contentLayer;
154 ScrollableLayerAndroid* m_foregroundLayer;
155 LayerAndroid* m_foregroundClipLayer;
158 } // namespace WebCore
161 #endif // USE(ACCELERATED_COMPOSITING)
163 #endif // GraphicsLayerAndroid_h