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

Side by Side Diff: src/core/SkAutoPixmapStorage.h

Issue 1821303002: Remove SkPixmap::release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | src/core/SkAutoPixmapStorage.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 2016 Google Inc. 3 * Copyright 2016 Google Inc.
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 #ifndef SkAutoPixmapStorage_DEFINED 9 #ifndef SkAutoPixmapStorage_DEFINED
10 #define SkAutoPixmapStorage_DEFINED 10 #define SkAutoPixmapStorage_DEFINED
(...skipping 28 matching lines...) Expand all
39 * alloc/tryAlloc was called. 39 * alloc/tryAlloc was called.
40 */ 40 */
41 static size_t AllocSize(const SkImageInfo& info, size_t* rowBytes); 41 static size_t AllocSize(const SkImageInfo& info, size_t* rowBytes);
42 42
43 /** 43 /**
44 * Returns an SkData object wrapping the allocated pixels memory, and resets the pixmap. 44 * Returns an SkData object wrapping the allocated pixels memory, and resets the pixmap.
45 * If the storage hasn't been allocated, the result is NULL. 45 * If the storage hasn't been allocated, the result is NULL.
46 */ 46 */
47 const SkData* SK_WARN_UNUSED_RESULT detachPixelsAsData(); 47 const SkData* SK_WARN_UNUSED_RESULT detachPixelsAsData();
48 48
49 /**
50 * Whereas 'reset' frees the backing memory and then clears the SkPixmap,
51 * this entry point disowns the backing memory before clearing so the memory
52 * isn't freed. It can be used when the Pixmap has been installed into
53 * an SkBitmap and the SkBitmap should manage the memory's lifetime.
54 */
55 void release();
56
57 // We wrap these so we can clear our internal storage 49 // We wrap these so we can clear our internal storage
58 50
59 void reset() { 51 void reset() {
60 this->freeStorage(); 52 this->freeStorage();
61 this->INHERITED::reset(); 53 this->INHERITED::reset();
62 } 54 }
63 void reset(const SkImageInfo& info, const void* addr, size_t rb, SkColorTabl e* ctable = NULL) { 55 void reset(const SkImageInfo& info, const void* addr, size_t rb, SkColorTabl e* ctable = NULL) {
64 this->freeStorage(); 56 this->freeStorage();
65 this->INHERITED::reset(info, addr, rb, ctable); 57 this->INHERITED::reset(info, addr, rb, ctable);
66 } 58 }
(...skipping 11 matching lines...) Expand all
78 70
79 void freeStorage() { 71 void freeStorage() {
80 sk_free(fStorage); 72 sk_free(fStorage);
81 fStorage = nullptr; 73 fStorage = nullptr;
82 } 74 }
83 75
84 typedef SkPixmap INHERITED; 76 typedef SkPixmap INHERITED;
85 }; 77 };
86 78
87 #endif 79 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkAutoPixmapStorage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698