aboutsummaryrefslogtreecommitdiffstats
path: root/include/pipe
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-06-06 17:02:24 -0400
committerDerek Sollenberger <djsollen@google.com>2011-06-07 14:00:04 -0400
commit0b15698a8c76bb8abc1b555c1d91892669b4118f (patch)
tree08732d5fbb7484ce7e10c65c96fb56294053073a /include/pipe
parent9770b0f3d2b5d512daac50c2c9561d2c073cd8d2 (diff)
downloadexternal_skia-0b15698a8c76bb8abc1b555c1d91892669b4118f.zip
external_skia-0b15698a8c76bb8abc1b555c1d91892669b4118f.tar.gz
external_skia-0b15698a8c76bb8abc1b555c1d91892669b4118f.tar.bz2
Skia Merge (revision 1510)
This CL includes bug fixes and closely mirrors the version of Skia used in Chrome M13, which is likely to be our baseline for ICS. The CL also adds source files for the SampleApp which will allow us to execute basic skia tests. The SampleApp requires the utils/views directory in order to run. Finally, we have included the PDF backend for Skia in order to experiment with using it to generate PDF files for certain applications. Note: The SampleApp and PDF code are not built as part of libskia. Change-Id: I1895ccfbd8074e25f19148cc7bd1b4af571fb307
Diffstat (limited to 'include/pipe')
-rw-r--r--include/pipe/SkGPipe.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/include/pipe/SkGPipe.h b/include/pipe/SkGPipe.h
new file mode 100644
index 0000000..897766f
--- /dev/null
+++ b/include/pipe/SkGPipe.h
@@ -0,0 +1,96 @@
+/*
+ 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"
+#include "SkFlattenable.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
+ };
+
+ // data must be 4-byte aligned
+ // length must be a multiple of 4
+ Status playback(const void* data, size_t length, size_t* bytesRead = NULL);
+
+private:
+ SkCanvas* fCanvas;
+ class SkGPipeState* fState;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class SkGPipeController {
+public:
+ /**
+ * Called periodically by the writer, to get a working buffer of RAM to
+ * write into. The actual size of the block is also returned, and must be
+ * actual >= minRequest. If NULL is returned, then actual is ignored and
+ * writing will stop.
+ *
+ * The returned block must be 4-byte aligned, and actual must be a
+ * multiple of 4.
+ * minRequest will always be a multiple of 4.
+ */
+ virtual void* requestBlock(size_t minRequest, size_t* actual) = 0;
+
+ /**
+ * This is called each time some atomic portion of the data has been
+ * written to the block (most recently returned by requestBlock()).
+ * If bytes == 0, then the writer has finished.
+ *
+ * bytes will always be a multiple of 4.
+ */
+ virtual void notifyWritten(size_t bytes) = 0;
+};
+
+class SkGPipeWriter {
+public:
+ SkGPipeWriter();
+ ~SkGPipeWriter();
+
+ bool isRecording() const { return NULL != fCanvas; }
+
+ enum Flags {
+ kCrossProcess_Flag = 1 << 0,
+ };
+
+ SkCanvas* startRecording(SkGPipeController*, uint32_t flags = 0);
+
+ // called in destructor, but can be called sooner once you know there
+ // should be no more drawing calls made into the recording canvas.
+ void endRecording();
+
+private:
+ class SkGPipeCanvas* fCanvas;
+ SkGPipeController* fController;
+ SkFactorySet fFactorySet;
+ SkWriter32 fWriter;
+};
+
+#endif