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

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

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: original write flags were fine Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkPixelRef_DEFINED 8 #ifndef SkPixelRef_DEFINED
9 #define SkPixelRef_DEFINED 9 #define SkPixelRef_DEFINED
10 10
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 * @return default impl returns 0. 321 * @return default impl returns 0.
322 */ 322 */
323 virtual size_t getAllocatedSizeInBytes() const; 323 virtual size_t getAllocatedSizeInBytes() const;
324 324
325 /** Return the mutex associated with this pixelref. This value is assigned 325 /** Return the mutex associated with this pixelref. This value is assigned
326 in the constructor, and cannot change during the lifetime of the object. 326 in the constructor, and cannot change during the lifetime of the object.
327 */ 327 */
328 SkBaseMutex* mutex() const { return fMutex; } 328 SkBaseMutex* mutex() const { return fMutex; }
329 329
330 // serialization 330 // serialization
331 SkPixelRef(SkFlattenableReadBuffer&, SkBaseMutex*); 331 SkPixelRef(SkReadBuffer&, SkBaseMutex*);
332 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 332 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
333 333
334 // only call from constructor. Flags this to always be locked, removing 334 // only call from constructor. Flags this to always be locked, removing
335 // the need to grab the mutex and call onLockPixels/onUnlockPixels. 335 // the need to grab the mutex and call onLockPixels/onUnlockPixels.
336 // Performance tweak to avoid those calls (esp. in multi-thread use case). 336 // Performance tweak to avoid those calls (esp. in multi-thread use case).
337 void setPreLocked(void*, size_t rowBytes, SkColorTable*); 337 void setPreLocked(void*, size_t rowBytes, SkColorTable*);
338 338
339 private: 339 private:
340 SkBaseMutex* fMutex; // must remain in scope for the life of this object 340 SkBaseMutex* fMutex; // must remain in scope for the life of this object
341 341
342 // mostly const. fInfo.fAlpahType can be changed at runtime. 342 // mostly const. fInfo.fAlpahType can be changed at runtime.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 /** 376 /**
377 * Allocate a new pixelref matching the specified ImageInfo, allocating 377 * Allocate a new pixelref matching the specified ImageInfo, allocating
378 * the memory for the pixels. If the ImageInfo requires a ColorTable, 378 * the memory for the pixels. If the ImageInfo requires a ColorTable,
379 * the pixelref will ref() the colortable. 379 * the pixelref will ref() the colortable.
380 * On failure return NULL. 380 * On failure return NULL.
381 */ 381 */
382 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0; 382 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0;
383 }; 383 };
384 384
385 #endif 385 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698