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

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

Issue 784643002: Replace EncodeBitmap with an interface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update comments 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
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"
15 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
16 #include "SkWriter32.h" 17 #include "SkWriter32.h"
17 18
18 class SkBitmap; 19 class SkBitmap;
19 class SkBitmapHeap; 20 class SkBitmapHeap;
20 class SkFactorySet; 21 class SkFactorySet;
21 class SkFlattenable; 22 class SkFlattenable;
22 class SkNamedFactorySet; 23 class SkNamedFactorySet;
23 class SkRefCntSet; 24 class SkRefCntSet;
24 25
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 SkFactorySet* setFactoryRecorder(SkFactorySet*); 82 SkFactorySet* setFactoryRecorder(SkFactorySet*);
82 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*); 83 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*);
83 84
84 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } 85 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; }
85 SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); 86 SkRefCntSet* setTypefaceRecorder(SkRefCntSet*);
86 87
87 /** 88 /**
88 * Set an SkBitmapHeap to store bitmaps rather than flattening. 89 * Set an SkBitmapHeap to store bitmaps rather than flattening.
89 * 90 *
90 * Incompatible with an EncodeBitmap function. If an EncodeBitmap function i s set, setting an 91 * Incompatible with an SkPixelSerializer. If an SkPixelSerializer is set,
91 * SkBitmapHeap will set the function to NULL in release mode and crash in d ebug. 92 * setting an SkBitmapHeap will set the SkPixelSerializer to NULL in release
93 * and crash in debug.
92 */ 94 */
93 void setBitmapHeap(SkBitmapHeap*); 95 void setBitmapHeap(SkBitmapHeap*);
94 96
95 /** 97 /**
96 * Provide a function to encode an SkBitmap to an SkData. writeBitmap will a ttempt to use 98 * Set an SkPixelSerializer to store an encoded representation of pixels,
97 * bitmapEncoder to store the SkBitmap. If the reader does not provide a fun ction to decode, it 99 * e.g. SkBitmaps.
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 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will be set to NULL in 101 * TODO: Encode SkImage pixels as well.
102 * release and crash in debug. 102 *
103 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will
104 * be set to NULL in release and crash in debug.
reed1 2014/12/08 15:51:15 // Calls ref on the serializer. wonder if this gu
scroggo 2014/12/08 18:09:31 Done.
103 */ 105 */
104 void setBitmapEncoder(SkPicture::EncodeBitmap bitmapEncoder); 106 void setPixelSerializer(SkPixelSerializer*);
105 107
106 private: 108 private:
107 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } 109 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); }
108 110
109 const uint32_t fFlags; 111 const uint32_t fFlags;
110 SkFactorySet* fFactorySet; 112 SkFactorySet* fFactorySet;
111 SkNamedFactorySet* fNamedFactorySet; 113 SkNamedFactorySet* fNamedFactorySet;
112 SkWriter32 fWriter; 114 SkWriter32 fWriter;
113 115
114 SkBitmapHeap* fBitmapHeap; 116 SkBitmapHeap* fBitmapHeap;
115 SkRefCntSet* fTFSet; 117 SkRefCntSet* fTFSet;
116 118
117 SkPicture::EncodeBitmap fBitmapEncoder; 119 SkAutoTUnref<SkPixelSerializer> fPixelSerializer;
118 }; 120 };
119 121
120 #endif // SkWriteBuffer_DEFINED 122 #endif // SkWriteBuffer_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698