aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-02-12 17:17:10 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-02-12 17:17:10 +0000
commit86d4008e894f6ce0b1938ac6b45d4074af85d3b7 (patch)
treecbe4aeefbc34afda182d39780eabb34d457e77b9 /src
parentdc3381fc8194a6192af39539c6ac9787b20209d3 (diff)
add layers
git-svn-id: http://skia.googlecode.com/svn/trunk@501 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/utils/SkLayer.cpp67
-rw-r--r--src/utils/utils_files.mk1
2 files changed, 68 insertions, 0 deletions
diff --git a/src/utils/SkLayer.cpp b/src/utils/SkLayer.cpp
new file mode 100644
index 0000000000..c5a6d9a20c
--- /dev/null
+++ b/src/utils/SkLayer.cpp
@@ -0,0 +1,67 @@
+#include "SkLayer.h"
+
+SkLayer::SkLayer() {
+ m_doRotation = false;
+ m_isFixed = false;
+ m_backgroundColorSet = false;
+
+ m_angleTransform = 0;
+ m_opacity = 1;
+
+ m_size.set(0, 0);
+ m_position.set(0, 0);
+ m_translation.set(0, 0);
+ m_anchorPoint.set(0.5, 0.5);
+ m_scale.set(1, 1);
+
+ m_backgroundColor = 0;
+}
+
+SkLayer::SkLayer(const SkLayer& src) {
+ m_doRotation = src.m_doRotation;
+ m_isFixed = src.m_isFixed;
+ m_backgroundColorSet = src.m_backgroundColorSet;
+
+ m_angleTransform = src.m_angleTransform;
+ m_opacity = src.m_opacity;
+ m_size = src.m_size;
+ m_position = src.m_position;
+ m_translation = src.m_translation;
+ m_anchorPoint = src.m_anchorPoint;
+ m_scale = src.m_scale;
+
+ m_fixedLeft = src.m_fixedLeft;
+ m_fixedTop = src.m_fixedTop;
+ m_fixedRight = src.m_fixedRight;
+ m_fixedBottom = src.m_fixedBottom;
+
+ m_backgroundColor = src.m_backgroundColor;
+}
+
+SkLayer::~SkLayer() {
+ this->removeChildren();
+}
+
+int SkLayer::countChildren() const {
+ return m_children.count();
+}
+
+SkLayer* SkLayer::getChild(int index) const {
+ if ((unsigned)index < (unsigned)m_children.count()) {
+ return m_children[index];
+ }
+ return NULL;
+}
+
+SkLayer* SkLayer::addChild(SkLayer* child) {
+ child->ref();
+ *m_children.append() = child;
+ return child;
+}
+
+void SkLayer::removeChildren() {
+ m_children.unrefAll();
+ m_children.reset();
+}
+
+
diff --git a/src/utils/utils_files.mk b/src/utils/utils_files.mk
index 0ff23c26cd..68cc587111 100644
--- a/src/utils/utils_files.mk
+++ b/src/utils/utils_files.mk
@@ -4,6 +4,7 @@ SOURCE := \
SkCullPoints.cpp \
SkDumpCanvas.cpp \
SkInterpolator.cpp \
+ SkLayer.cpp \
SkNinePatch.cpp \
SkNWayCanvas.cpp \
SkParse.cpp \