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

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

Issue 784643002: Replace EncodeBitmap with an interface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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;
27 class SkStream; 28 class SkStream;
28 class SkWStream; 29 class SkWStream;
29 30
30 struct SkPictInfo; 31 struct SkPictInfo;
31 32
32 class SkRecord; 33 class SkRecord;
33 34
34 namespace SkRecords { 35 namespace SkRecords {
35 class CollectLayers; 36 class CollectLayers;
36 }; 37 };
37 38
39 //#define SK_LEGACY_ENCODE_BITMAP
40
38 /** \class SkPicture 41 /** \class SkPicture
39 42
40 The SkPicture class records the drawing commands made to a canvas, to 43 The SkPicture class records the drawing commands made to a canvas, to
41 be played back at a later time. 44 be played back at a later time.
42 */ 45 */
43 class SK_API SkPicture : public SkNVRefCnt<SkPicture> { 46 class SK_API SkPicture : public SkNVRefCnt<SkPicture> {
44 public: 47 public:
45 // AccelData provides a base class for device-specific acceleration 48 // AccelData provides a base class for device-specific acceleration
46 // data. It is added to the picture via EXPERIMENTAL_addAccelData. 49 // data. It is added to the picture via EXPERIMENTAL_addAccelData.
47 class AccelData : public SkRefCnt { 50 class AccelData : public SkRefCnt {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 137
135 /** 138 /**
136 * Function to encode an SkBitmap to an SkData. A function with this 139 * Function to encode an SkBitmap to an SkData. A function with this
137 * signature can be passed to serialize() and SkWriteBuffer. 140 * signature can be passed to serialize() and SkWriteBuffer.
138 * Returning NULL will tell the SkWriteBuffer to use 141 * Returning NULL will tell the SkWriteBuffer to use
139 * SkBitmap::flatten() to store the bitmap. 142 * SkBitmap::flatten() to store the bitmap.
140 * 143 *
141 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. 144 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0.
142 * @return SkData If non-NULL, holds encoded data representing the passed 145 * @return SkData If non-NULL, holds encoded data representing the passed
143 * in bitmap. The caller is responsible for calling unref(). 146 * 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.
144 */ 150 */
145 typedef SkData* (*EncodeBitmap)(size_t* pixelRefOffset, const SkBitmap& bm); 151 typedef SkData* (*EncodeBitmap)(size_t* pixelRefOffset, const SkBitmap& bm);
146 152
153 #ifdef SK_LEGACY_ENCODE_BITMAP
147 /** 154 /**
148 * Serialize to a stream. If non NULL, encoder will be used to encode 155 * Serialize to a stream. If non NULL, encoder will be used to encode
149 * any bitmaps in the picture. 156 * any bitmaps in the picture.
150 * encoder will never be called with a NULL pixelRefOffset. 157 * encoder will never be called with a NULL pixelRefOffset.
158 * DEPRECATED - use serialize(SkWStream*, SkPixelSerializer* serializer)
159 * instead.
151 */ 160 */
152 void serialize(SkWStream*, EncodeBitmap encoder = NULL) const; 161 void serialize(SkWStream* wStream, EncodeBitmap encoder) 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;
153 171
154 /** 172 /**
155 * Serialize to a buffer. 173 * Serialize to a buffer.
156 */ 174 */
157 void flatten(SkWriteBuffer&) const; 175 void flatten(SkWriteBuffer&) const;
158 176
159 /** 177 /**
160 * Returns true if any bitmaps may be produced when this SkPicture 178 * Returns true if any bitmaps may be produced when this SkPicture
161 * is replayed. 179 * is replayed.
162 */ 180 */
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 316
299 friend class SkPictureRecorder; // SkRecord-based constructor. 317 friend class SkPictureRecorder; // SkRecord-based constructor.
300 friend class GrLayerHoister; // access to fRecord 318 friend class GrLayerHoister; // access to fRecord
301 friend class ReplaceDraw; 319 friend class ReplaceDraw;
302 friend class SkPictureUtils; 320 friend class SkPictureUtils;
303 friend class SkRecordedDrawable; 321 friend class SkRecordedDrawable;
304 }; 322 };
305 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize); 323 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize);
306 324
307 #endif 325 #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