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

Side by Side Diff: include/core/SkPicture.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 | « gyp/skia_for_chromium_defines.gypi ('k') | include/core/SkPixelSerializer.h » ('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 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
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 9
10 #ifndef SkPicture_DEFINED 10 #ifndef SkPicture_DEFINED
11 #define SkPicture_DEFINED 11 #define SkPicture_DEFINED
12 12
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkDrawPictureCallback.h" 14 #include "SkDrawPictureCallback.h"
15 #include "SkImageDecoder.h" 15 #include "SkImageDecoder.h"
16 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
17 #include "SkTDArray.h" 17 #include "SkTDArray.h"
18 18
19 #if SK_SUPPORT_GPU 19 #if SK_SUPPORT_GPU
20 class GrContext; 20 class GrContext;
21 #endif 21 #endif
22 22
23 class SkBBoxHierarchy; 23 class SkBBoxHierarchy;
24 class SkCanvas; 24 class SkCanvas;
25 class SkData; 25 class SkData;
26 class SkPictureData; 26 class SkPictureData;
27 class SkPixelSerializer;
28 class SkStream; 27 class SkStream;
29 class SkWStream; 28 class SkWStream;
30 29
31 struct SkPictInfo; 30 struct SkPictInfo;
32 31
33 class SkRecord; 32 class SkRecord;
34 33
35 namespace SkRecords { 34 namespace SkRecords {
36 class CollectLayers; 35 class CollectLayers;
37 }; 36 };
38 37
39 //#define SK_LEGACY_ENCODE_BITMAP
40
41 /** \class SkPicture 38 /** \class SkPicture
42 39
43 The SkPicture class records the drawing commands made to a canvas, to 40 The SkPicture class records the drawing commands made to a canvas, to
44 be played back at a later time. 41 be played back at a later time.
45 */ 42 */
46 class SK_API SkPicture : public SkNVRefCnt<SkPicture> { 43 class SK_API SkPicture : public SkNVRefCnt<SkPicture> {
47 public: 44 public:
48 // AccelData provides a base class for device-specific acceleration 45 // AccelData provides a base class for device-specific acceleration
49 // data. It is added to the picture via EXPERIMENTAL_addAccelData. 46 // data. It is added to the picture via EXPERIMENTAL_addAccelData.
50 class AccelData : public SkRefCnt { 47 class AccelData : public SkRefCnt {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 134
138 /** 135 /**
139 * Function to encode an SkBitmap to an SkData. A function with this 136 * Function to encode an SkBitmap to an SkData. A function with this
140 * signature can be passed to serialize() and SkWriteBuffer. 137 * signature can be passed to serialize() and SkWriteBuffer.
141 * Returning NULL will tell the SkWriteBuffer to use 138 * Returning NULL will tell the SkWriteBuffer to use
142 * SkBitmap::flatten() to store the bitmap. 139 * SkBitmap::flatten() to store the bitmap.
143 * 140 *
144 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. 141 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0.
145 * @return SkData If non-NULL, holds encoded data representing the passed 142 * @return SkData If non-NULL, holds encoded data representing the passed
146 * in bitmap. The caller is responsible for calling unref(). 143 * in bitmap. The caller is responsible for calling unref().
147 *
148 * TODO: No longer used by SkPicture (except when SK_LEGACY_ENCODE_BITMAP
149 * is defined. Still used by PDF though. Move into PDF.
150 */ 144 */
151 typedef SkData* (*EncodeBitmap)(size_t* pixelRefOffset, const SkBitmap& bm); 145 typedef SkData* (*EncodeBitmap)(size_t* pixelRefOffset, const SkBitmap& bm);
152 146
153 #ifdef SK_LEGACY_ENCODE_BITMAP
154 /** 147 /**
155 * Serialize to a stream. If non NULL, encoder will be used to encode 148 * Serialize to a stream. If non NULL, encoder will be used to encode
156 * any bitmaps in the picture. 149 * any bitmaps in the picture.
157 * encoder will never be called with a NULL pixelRefOffset. 150 * encoder will never be called with a NULL pixelRefOffset.
158 * DEPRECATED - use serialize(SkWStream*, SkPixelSerializer* serializer)
159 * instead.
160 */ 151 */
161 void serialize(SkWStream* wStream, EncodeBitmap encoder) const; 152 void serialize(SkWStream*, EncodeBitmap encoder = NULL) const;
162 #endif
163
164 /**
165 * Serialize to a stream. If non NULL, serializer will be used to serialize
166 * any bitmaps in the picture.
167 *
168 * TODO: Use serializer to serialize SkImages as well.
169 */
170 void serialize(SkWStream*, SkPixelSerializer* serializer = NULL) const;
171 153
172 /** 154 /**
173 * Serialize to a buffer. 155 * Serialize to a buffer.
174 */ 156 */
175 void flatten(SkWriteBuffer&) const; 157 void flatten(SkWriteBuffer&) const;
176 158
177 /** 159 /**
178 * Returns true if any bitmaps may be produced when this SkPicture 160 * Returns true if any bitmaps may be produced when this SkPicture
179 * is replayed. 161 * is replayed.
180 */ 162 */
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 297
316 friend class SkPictureRecorder; // SkRecord-based constructor. 298 friend class SkPictureRecorder; // SkRecord-based constructor.
317 friend class GrLayerHoister; // access to fRecord 299 friend class GrLayerHoister; // access to fRecord
318 friend class ReplaceDraw; 300 friend class ReplaceDraw;
319 friend class SkPictureUtils; 301 friend class SkPictureUtils;
320 friend class SkRecordedDrawable; 302 friend class SkRecordedDrawable;
321 }; 303 };
322 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize); 304 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize);
323 305
324 #endif 306 #endif
OLDNEW
« no previous file with comments | « gyp/skia_for_chromium_defines.gypi ('k') | include/core/SkPixelSerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698