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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: New serialization method Created 7 years, 3 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 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 SkPixelRef_DEFINED 10 #ifndef SkPixelRef_DEFINED
(...skipping 27 matching lines...) Expand all
38 38
39 /** \class SkPixelRef 39 /** \class SkPixelRef
40 40
41 This class is the smart container for pixel memory, and is used with 41 This class is the smart container for pixel memory, and is used with
42 SkBitmap. A pixelref is installed into a bitmap, and then the bitmap can 42 SkBitmap. A pixelref is installed into a bitmap, and then the bitmap can
43 access the actual pixel memory by calling lockPixels/unlockPixels. 43 access the actual pixel memory by calling lockPixels/unlockPixels.
44 44
45 This class can be shared/accessed between multiple threads. 45 This class can be shared/accessed between multiple threads.
46 */ 46 */
47 class SK_API SkPixelRef : public SkFlattenable { 47 class SK_API SkPixelRef : public SkFlattenable {
48 typedef SkFlattenable INHERITED;
49
48 public: 50 public:
49 SK_DECLARE_INST_COUNT(SkPixelRef) 51 SK_DECLARE_INST_COUNT(SkPixelRef)
50 52
51 explicit SkPixelRef(SkBaseMutex* mutex = NULL); 53 explicit SkPixelRef(SkBaseMutex* mutex = NULL);
52 54
53 /** Return the pixel memory returned from lockPixels, or null if the 55 /** Return the pixel memory returned from lockPixels, or null if the
54 lockCount is 0. 56 lockCount is 0.
55 */ 57 */
56 void* pixels() const { return fPixels; } 58 void* pixels() const { return fPixels; }
57 59
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 virtual void globalRef(void* data=NULL); 202 virtual void globalRef(void* data=NULL);
201 203
202 /** 204 /**
203 * Release a "global" ref on this object. 205 * Release a "global" ref on this object.
204 * The default implementation just calls unref(), but subclasses can overri de 206 * The default implementation just calls unref(), but subclasses can overri de
205 * this method to implement additional behavior. 207 * this method to implement additional behavior.
206 */ 208 */
207 virtual void globalUnref(); 209 virtual void globalUnref();
208 #endif 210 #endif
209 211
212 SK_DEFINE_FLATTENABLE_TYPE(SkPixelRef)
213
210 protected: 214 protected:
211 /** Called when the lockCount goes from 0 to 1. The caller will have already 215 /** Called when the lockCount goes from 0 to 1. The caller will have already
212 acquire a mutex for thread safety, so this method need not do that. 216 acquire a mutex for thread safety, so this method need not do that.
213 */ 217 */
214 virtual void* onLockPixels(SkColorTable**) = 0; 218 virtual void* onLockPixels(SkColorTable**) = 0;
215 /** Called when the lock count goes from 1 to 0. The caller will have 219 /** Called when the lock count goes from 1 to 0. The caller will have
216 already acquire a mutex for thread safety, so this method need not do 220 already acquire a mutex for thread safety, so this method need not do
217 that. 221 that.
218 */ 222 */
219 virtual void onUnlockPixels() = 0; 223 virtual void onUnlockPixels() = 0;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 friend class SkBitmap; 269 friend class SkBitmap;
266 270
267 SkString fURI; 271 SkString fURI;
268 272
269 // can go from false to true, but never from true to false 273 // can go from false to true, but never from true to false
270 bool fIsImmutable; 274 bool fIsImmutable;
271 // only ever set in constructor, const after that 275 // only ever set in constructor, const after that
272 bool fPreLocked; 276 bool fPreLocked;
273 277
274 void setMutex(SkBaseMutex* mutex); 278 void setMutex(SkBaseMutex* mutex);
275
276 typedef SkFlattenable INHERITED;
277 }; 279 };
278 280
279 #endif 281 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698