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

Side by Side Diff: include/core/SkWriteBuffer.h

Issue 787833002: Revert of Replace EncodeBitmap with an interface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « include/core/SkPixelSerializer.h ('k') | src/core/SkPicture.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 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkWriteBuffer_DEFINED 9 #ifndef SkWriteBuffer_DEFINED
10 #define SkWriteBuffer_DEFINED 10 #define SkWriteBuffer_DEFINED
11 11
12 #include "SkData.h" 12 #include "SkData.h"
13 #include "SkPath.h" 13 #include "SkPath.h"
14 #include "SkPicture.h" 14 #include "SkPicture.h"
15 #include "SkPixelSerializer.h"
16 #include "SkRefCnt.h" 15 #include "SkRefCnt.h"
17 #include "SkWriter32.h" 16 #include "SkWriter32.h"
18 17
19 class SkBitmap; 18 class SkBitmap;
20 class SkBitmapHeap; 19 class SkBitmapHeap;
21 class SkFactorySet; 20 class SkFactorySet;
22 class SkFlattenable; 21 class SkFlattenable;
23 class SkNamedFactorySet; 22 class SkNamedFactorySet;
24 class SkRefCntSet; 23 class SkRefCntSet;
25 24
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 80
82 SkFactorySet* setFactoryRecorder(SkFactorySet*); 81 SkFactorySet* setFactoryRecorder(SkFactorySet*);
83 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*); 82 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*);
84 83
85 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } 84 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; }
86 SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); 85 SkRefCntSet* setTypefaceRecorder(SkRefCntSet*);
87 86
88 /** 87 /**
89 * Set an SkBitmapHeap to store bitmaps rather than flattening. 88 * Set an SkBitmapHeap to store bitmaps rather than flattening.
90 * 89 *
91 * Incompatible with an SkPixelSerializer. If an SkPixelSerializer is set, 90 * Incompatible with an EncodeBitmap function. If an EncodeBitmap function i s set, setting an
92 * setting an SkBitmapHeap will set the SkPixelSerializer to NULL in release 91 * SkBitmapHeap will set the function to NULL in release mode and crash in d ebug.
93 * and crash in debug.
94 */ 92 */
95 void setBitmapHeap(SkBitmapHeap*); 93 void setBitmapHeap(SkBitmapHeap*);
96 94
97 /** 95 /**
98 * Set an SkPixelSerializer to store an encoded representation of pixels, 96 * Provide a function to encode an SkBitmap to an SkData. writeBitmap will a ttempt to use
99 * e.g. SkBitmaps. 97 * bitmapEncoder to store the SkBitmap. If the reader does not provide a fun ction to decode, it
98 * will not be able to restore SkBitmaps, but will still be able to read the rest of the stream.
99 * bitmapEncoder will never be called with a NULL pixelRefOffset.
100 * 100 *
101 * Calls ref() on the serializer. 101 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will be set to NULL in
102 * 102 * release and crash in debug.
103 * TODO: Encode SkImage pixels as well.
104 *
105 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will
106 * be set to NULL in release and crash in debug.
107 */ 103 */
108 void setPixelSerializer(SkPixelSerializer*); 104 void setBitmapEncoder(SkPicture::EncodeBitmap bitmapEncoder);
109 105
110 private: 106 private:
111 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } 107 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); }
112 108
113 const uint32_t fFlags; 109 const uint32_t fFlags;
114 SkFactorySet* fFactorySet; 110 SkFactorySet* fFactorySet;
115 SkNamedFactorySet* fNamedFactorySet; 111 SkNamedFactorySet* fNamedFactorySet;
116 SkWriter32 fWriter; 112 SkWriter32 fWriter;
117 113
118 SkBitmapHeap* fBitmapHeap; 114 SkBitmapHeap* fBitmapHeap;
119 SkRefCntSet* fTFSet; 115 SkRefCntSet* fTFSet;
120 116
121 SkAutoTUnref<SkPixelSerializer> fPixelSerializer; 117 SkPicture::EncodeBitmap fBitmapEncoder;
122 }; 118 };
123 119
124 #endif // SkWriteBuffer_DEFINED 120 #endif // SkWriteBuffer_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkPixelSerializer.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698