summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/LayerAndroid.h
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2010-01-04 19:33:17 +0000
committerNicolas Roard <nicolas@android.com>2010-01-04 19:33:17 +0000
commit9acd586e4a0aa54e4f630665aa0d3c8c95b78e72 (patch)
tree97f62cc64e391bde4a9436791e844dda7ed3f76a /WebCore/platform/graphics/android/LayerAndroid.h
parent5bd553b63661fa0f711bb9c02566d5df80a9432f (diff)
downloadexternal_webkit-9acd586e4a0aa54e4f630665aa0d3c8c95b78e72.zip
external_webkit-9acd586e4a0aa54e4f630665aa0d3c8c95b78e72.tar.gz
external_webkit-9acd586e4a0aa54e4f630665aa0d3c8c95b78e72.tar.bz2
webkit layers support
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.h')
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h
new file mode 100644
index 0000000..284185d
--- /dev/null
+++ b/WebCore/platform/graphics/android/LayerAndroid.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LayerAndroid_h
+#define LayerAndroid_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "Color.h"
+#include "FloatPoint.h"
+#include "FloatPoint3D.h"
+#include "FloatSize.h"
+#include "GraphicsContext.h"
+#include "GraphicsLayer.h"
+#include "RefPtr.h"
+#include "StringHash.h"
+#include "Vector.h"
+#include <wtf/HashSet.h>
+
+class SkCanvas;
+class SkPicture;
+class SkRect;
+
+namespace WebCore {
+
+class AndroidAnimation;
+class AndroidAnimationValue;
+
+class LayerAndroid : public RefCounted<LayerAndroid> {
+
+public:
+ static PassRefPtr<LayerAndroid> create(bool isRootLayer);
+ LayerAndroid(bool isRootLayer);
+ LayerAndroid(LayerAndroid* layer);
+ ~LayerAndroid();
+
+ static int instancesCount();
+
+ void setSize(FloatSize size) { m_size = size; }
+ void setOpacity(float opacity) { m_opacity = opacity; }
+ void setTranslation(FloatPoint translation) { m_translation = translation; }
+ void setRotation(float a) { m_angleTransform = a; m_doRotation = true; }
+ void setScale(FloatPoint3D scale) { m_scale = scale; }
+ void setPosition(FloatPoint position) { m_position = position; }
+ void setAnchorPoint(FloatPoint3D point) { m_anchorPoint = point; }
+ void setHaveContents(bool haveContents) { m_haveContents = haveContents; }
+ void setHaveImage(bool haveImage) { m_haveImage = haveImage; }
+ void setDrawsContent(bool drawsContent);
+ void setMaskLayer(LayerAndroid*);
+ void setMasksToBounds(bool);
+ void setBackgroundColor(const Color& color);
+ void setIsRootLayer(bool isRootLayer) { m_isRootLayer = isRootLayer; }
+
+ void paintOn(float scrollX, float scrollY, float scale, SkCanvas*);
+ GraphicsContext* paintContext();
+ void removeAllChildren() { m_children.clear(); }
+ void addChildren(LayerAndroid* layer) { m_children.append(layer); }
+ bool prepareContext(bool force = false);
+ void startRecording();
+ void stopRecording();
+ SkPicture* recordContext();
+ void setClip(SkCanvas* clip);
+ FloatPoint position() { return m_position; }
+ FloatPoint translation() { return m_translation; }
+ FloatSize size() { return m_size; }
+
+ void setFixedPosition(FloatPoint position);
+ void addAnimation(PassRefPtr<AndroidAnimation> anim);
+ void removeAnimation(const String& name);
+ Vector<RefPtr<AndroidAnimationValue> >* evaluateAnimations() const;
+ bool evaluateAnimations(double time,
+ Vector<RefPtr<AndroidAnimationValue> >* result) const;
+ bool hasAnimations() const;
+
+private:
+
+ void paintChildren(float scrollX, float scrollY,
+ float scale, SkCanvas* canvas,
+ float opacity);
+
+ void paintMe(float scrollX, float scrollY,
+ float scale, SkCanvas* canvas,
+ float opacity);
+
+ bool m_doRotation;
+ bool m_isRootLayer;
+ bool m_isFixed;
+ bool m_haveContents;
+ bool m_drawsContent;
+ bool m_haveImage;
+ bool m_haveClip;
+ bool m_backgroundColorSet;
+
+ float m_angleTransform;
+ float m_opacity;
+
+ FloatSize m_size;
+ FloatPoint m_position;
+ FloatPoint m_translation;
+ FloatPoint m_fixedPosition;
+ FloatPoint3D m_anchorPoint;
+ FloatPoint3D m_scale;
+
+ SkPicture* m_recordingPicture;
+ Color m_backgroundColor;
+
+ Vector<RefPtr<LayerAndroid> > m_children;
+ typedef HashMap<String, RefPtr<AndroidAnimation> > KeyframesMap;
+ KeyframesMap m_animations;
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // LayerAndroid_h