aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-26 17:41:56 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-26 17:41:56 +0000
commitbb6992a9d6e21b3f28068765de0a41c6f2508dfd (patch)
treee5b946771673635162bb3d24c9143cc718faeb96 /include
parent06afe7b5a1ef03bfc6494c51ab2a1f7a386de5c2 (diff)
add experimental canvas pipe
git-svn-id: http://skia.googlecode.com/svn/trunk@1187 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/pipe/SkGPipe.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/pipe/SkGPipe.h b/include/pipe/SkGPipe.h
new file mode 100644
index 0000000000..5c729a2aba
--- /dev/null
+++ b/include/pipe/SkGPipe.h
@@ -0,0 +1,61 @@
+/*
+ Copyright 2011 Google Inc.
+
+ 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 SkGPipe_DEFINED
+#define SkGPipe_DEFINED
+
+#include "SkWriter32.h"
+
+class SkCanvas;
+
+class SkGPipeReader {
+public:
+ SkGPipeReader(SkCanvas* target);
+ ~SkGPipeReader();
+
+ enum Status {
+ kDone_Status, //!< no more data expected from reader
+ kEOF_Status, //!< need more data from reader
+ kError_Status //!< encountered error
+ };
+
+ Status playback(const void* data, size_t length);
+
+private:
+ SkCanvas* fCanvas;
+ class SkGPipeState* fState;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class SkGPipeWriter {
+public:
+ SkGPipeWriter();
+ ~SkGPipeWriter();
+
+ bool isRecording() const { return NULL != fCanvas; }
+ SkCanvas* startRecording();
+ void endRecording();
+
+ size_t flatten(void* buffer);
+
+private:
+ class SkGPipeCanvas* fCanvas;
+ SkWriter32 fWriter;
+};
+
+#endif