aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-01-22 13:41:08 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-01-22 13:41:08 +0000
commit7b830a1d2728eb20be09406fcfe23871e1a61308 (patch)
tree135cb68665d5c3196dd810f50d6d9b81a484d049 /src/images
parent00bf85a98675c9d0c3150bbeb0a3d7198ad8f21f (diff)
update makefile for newly moved Factories
git-svn-id: http://skia.googlecode.com/svn/trunk@77 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkImageDecoder_Factory.cpp54
-rw-r--r--src/images/SkImageEncoder_Factory.cpp33
2 files changed, 87 insertions, 0 deletions
diff --git a/src/images/SkImageDecoder_Factory.cpp b/src/images/SkImageDecoder_Factory.cpp
new file mode 100644
index 0000000000..33009812fd
--- /dev/null
+++ b/src/images/SkImageDecoder_Factory.cpp
@@ -0,0 +1,54 @@
+/* libs/graphics/ports/SkImageDecoder_Factory.cpp
+**
+** Copyright 2006, 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.
+*/
+
+#include "SkImageDecoder.h"
+#include "SkMovie.h"
+#include "SkStream.h"
+#include "SkTRegistry.h"
+
+typedef SkTRegistry<SkImageDecoder*, SkStream*> DecodeReg;
+
+SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
+ const DecodeReg* curr = DecodeReg::Head();
+ while (curr) {
+ SkImageDecoder* codec = curr->factory()(stream);
+ stream->rewind();
+ if (codec) {
+ return codec;
+ }
+ curr = curr->next();
+ }
+ return NULL;
+}
+
+/////////////////////////////////////////////////////////////////////////
+
+typedef SkTRegistry<SkMovie*, SkStream*> MovieReg;
+
+SkMovie* SkMovie::DecodeStream(SkStream* stream) {
+ const MovieReg* curr = MovieReg::Head();
+ while (curr) {
+ SkMovie* movie = curr->factory()(stream);
+ if (movie) {
+ return movie;
+ }
+ stream->rewind();
+ curr = curr->next();
+ }
+ return NULL;
+}
+
diff --git a/src/images/SkImageEncoder_Factory.cpp b/src/images/SkImageEncoder_Factory.cpp
new file mode 100644
index 0000000000..f44cd8fa30
--- /dev/null
+++ b/src/images/SkImageEncoder_Factory.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright 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.
+ */
+
+#include "SkImageEncoder.h"
+#include "SkTRegistry.h"
+
+typedef SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> EncodeReg;
+
+SkImageEncoder* SkImageEncoder::Create(Type t) {
+ const EncodeReg* curr = EncodeReg::Head();
+ while (curr) {
+ SkImageEncoder* codec = curr->factory()(t);
+ if (codec) {
+ return codec;
+ }
+ curr = curr->next();
+ }
+ return NULL;
+}
+