Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: include/pipe/SkGPipe.h

Issue 14230022: Fixes for piping bitmaps with encoded data. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add some asserts and comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkPicture.h ('k') | samplecode/SampleApp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9 8
10 9
11 #ifndef SkGPipe_DEFINED 10 #ifndef SkGPipe_DEFINED
12 #define SkGPipe_DEFINED 11 #define SkGPipe_DEFINED
13 12
13 #include "SkFlattenable.h"
14 #include "SkPicture.h"
14 #include "SkWriter32.h" 15 #include "SkWriter32.h"
15 #include "SkFlattenable.h"
16 16
17 class SkCanvas; 17 class SkCanvas;
18 18
19 // XLib.h might have defined Status already (ugh) 19 // XLib.h might have defined Status already (ugh)
20 #ifdef Status 20 #ifdef Status
21 #undef Status 21 #undef Status
22 #endif 22 #endif
23 23
24 class SkGPipeReader { 24 class SkGPipeReader {
25 public: 25 public:
26 SkGPipeReader(); 26 SkGPipeReader();
27 SkGPipeReader(SkCanvas* target); 27 SkGPipeReader(SkCanvas* target);
28 ~SkGPipeReader(); 28 ~SkGPipeReader();
29 29
30 enum Status { 30 enum Status {
31 kDone_Status, //!< no more data expected from reader 31 kDone_Status, //!< no more data expected from reader
32 kEOF_Status, //!< need more data from reader 32 kEOF_Status, //!< need more data from reader
33 kError_Status, //!< encountered error 33 kError_Status, //!< encountered error
34 kReadAtom_Status//!< finished reading an atom 34 kReadAtom_Status//!< finished reading an atom
35 }; 35 };
36 36
37 enum PlaybackFlags { 37 enum PlaybackFlags {
38 kReadAtom_PlaybackFlag = 0x1, //!< playback a single command from the st ream 38 kReadAtom_PlaybackFlag = 0x1, //!< playback a single command from the st ream
39 kSilent_PlaybackFlag = 0x2, //!< playback without drawing 39 kSilent_PlaybackFlag = 0x2, //!< playback without drawing
40 }; 40 };
41 41
42 void setCanvas(SkCanvas*); 42 void setCanvas(SkCanvas*);
43
44 /**
45 * Set a function for decoding bitmaps that have encoded data.
46 */
47 void setBitmapDecoder(SkPicture::InstallPixelRefProc proc) { fProc = proc; }
48
43 // data must be 4-byte aligned 49 // data must be 4-byte aligned
44 // length must be a multiple of 4 50 // length must be a multiple of 4
45 Status playback(const void* data, size_t length, uint32_t playbackFlags = 0, 51 Status playback(const void* data, size_t length, uint32_t playbackFlags = 0,
46 size_t* bytesRead = NULL); 52 size_t* bytesRead = NULL);
47 private: 53 private:
48 SkCanvas* fCanvas; 54 SkCanvas* fCanvas;
49 class SkGPipeState* fState; 55 class SkGPipeState* fState;
56 SkPicture::InstallPixelRefProc fProc;
50 }; 57 };
51 58
52 /////////////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////////////
53 60
54 class SkGPipeCanvas; 61 class SkGPipeCanvas;
55 62
56 class SkGPipeController { 63 class SkGPipeController {
57 public: 64 public:
58 SkGPipeController() : fCanvas(NULL) {} 65 SkGPipeController() : fCanvas(NULL) {}
59 virtual ~SkGPipeController(); 66 virtual ~SkGPipeController();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 private: 159 private:
153 enum { 160 enum {
154 kDefaultRecordingCanvasSize = 32767, 161 kDefaultRecordingCanvasSize = 32767,
155 }; 162 };
156 163
157 SkGPipeCanvas* fCanvas; 164 SkGPipeCanvas* fCanvas;
158 SkWriter32 fWriter; 165 SkWriter32 fWriter;
159 }; 166 };
160 167
161 #endif 168 #endif
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | samplecode/SampleApp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698