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

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

Issue 108663004: make info real in SkPixelRef, and add bitmap::asImageInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/core/SkBitmap.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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR 54 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
55 // DEPRECATED -- use a constructor that takes SkImageInfo 55 // DEPRECATED -- use a constructor that takes SkImageInfo
56 explicit SkPixelRef(SkBaseMutex* mutex = NULL); 56 explicit SkPixelRef(SkBaseMutex* mutex = NULL);
57 #endif 57 #endif
58 58
59 explicit SkPixelRef(const SkImageInfo&); 59 explicit SkPixelRef(const SkImageInfo&);
60 SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex); 60 SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex);
61 virtual ~SkPixelRef(); 61 virtual ~SkPixelRef();
62 62
63 const SkImageInfo& info() const {
64 return fInfo;
65 }
66
63 /** Return the pixel memory returned from lockPixels, or null if the 67 /** Return the pixel memory returned from lockPixels, or null if the
64 lockCount is 0. 68 lockCount is 0.
65 */ 69 */
66 void* pixels() const { return fPixels; } 70 void* pixels() const { return fPixels; }
67 71
68 /** Return the current colorTable (if any) if pixels are locked, or null. 72 /** Return the current colorTable (if any) if pixels are locked, or null.
69 */ 73 */
70 SkColorTable* colorTable() const { return fColorTable; } 74 SkColorTable* colorTable() const { return fColorTable; }
71 75
72 /** 76 /**
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 SkPixelRef(SkFlattenableReadBuffer&, SkBaseMutex*); 288 SkPixelRef(SkFlattenableReadBuffer&, SkBaseMutex*);
285 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 289 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
286 290
287 // only call from constructor. Flags this to always be locked, removing 291 // only call from constructor. Flags this to always be locked, removing
288 // the need to grab the mutex and call onLockPixels/onUnlockPixels. 292 // the need to grab the mutex and call onLockPixels/onUnlockPixels.
289 // Performance tweak to avoid those calls (esp. in multi-thread use case). 293 // Performance tweak to avoid those calls (esp. in multi-thread use case).
290 void setPreLocked(void* pixels, SkColorTable* ctable); 294 void setPreLocked(void* pixels, SkColorTable* ctable);
291 295
292 private: 296 private:
293 SkBaseMutex* fMutex; // must remain in scope for the life of this object 297 SkBaseMutex* fMutex; // must remain in scope for the life of this object
298 SkImageInfo fInfo;
299
294 void* fPixels; 300 void* fPixels;
295 SkColorTable* fColorTable; // we do not track ownership, subclass does 301 SkColorTable* fColorTable; // we do not track ownership, subclass does
296 int fLockCount; 302 int fLockCount;
297 303
298 mutable uint32_t fGenerationID; 304 mutable uint32_t fGenerationID;
299 mutable bool fUniqueGenerationID; 305 mutable bool fUniqueGenerationID;
300 306
301 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owne d 307 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owne d
302 308
303 SkString fURI; 309 SkString fURI;
(...skipping 10 matching lines...) Expand all
314 320
315 // When copying a bitmap to another with the same shape and config, we can s afely 321 // When copying a bitmap to another with the same shape and config, we can s afely
316 // clone the pixelref generation ID too, which makes them equivalent under c aching. 322 // clone the pixelref generation ID too, which makes them equivalent under c aching.
317 friend class SkBitmap; // only for cloneGenID 323 friend class SkBitmap; // only for cloneGenID
318 void cloneGenID(const SkPixelRef&); 324 void cloneGenID(const SkPixelRef&);
319 325
320 typedef SkFlattenable INHERITED; 326 typedef SkFlattenable INHERITED;
321 }; 327 };
322 328
323 #endif 329 #endif
OLDNEW
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698