| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 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 SkPixmap_DEFINED | 8 #ifndef SkPixmap_DEFINED |
| 9 #define SkPixmap_DEFINED | 9 #define SkPixmap_DEFINED |
| 10 | 10 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 /** | 204 /** |
| 205 * Allocate memory for the pixels needed to match the specified Info and fi
ll out the pixmap | 205 * Allocate memory for the pixels needed to match the specified Info and fi
ll out the pixmap |
| 206 * to point to that memory. The storage will be freed when this object is d
estroyed, | 206 * to point to that memory. The storage will be freed when this object is d
estroyed, |
| 207 * or if another call to tryAlloc() or alloc() is made. | 207 * or if another call to tryAlloc() or alloc() is made. |
| 208 * | 208 * |
| 209 * If the memory cannot be allocated, calls sk_throw(). | 209 * If the memory cannot be allocated, calls sk_throw(). |
| 210 */ | 210 */ |
| 211 void alloc(const SkImageInfo&); | 211 void alloc(const SkImageInfo&); |
| 212 | 212 |
| 213 /** | 213 /** |
| 214 * Gets the size and optionally the rowBytes that would be allocated by SkAu
toPixmapStorage if |
| 215 * alloc/tryAlloc was called. |
| 216 */ |
| 217 static size_t AllocSize(const SkImageInfo& info, size_t* rowBytes); |
| 218 |
| 219 /** |
| 214 * Returns an SkData object wrapping the allocated pixels memory, and reset
s the pixmap. | 220 * Returns an SkData object wrapping the allocated pixels memory, and reset
s the pixmap. |
| 215 * If the storage hasn't been allocated, the result is NULL. | 221 * If the storage hasn't been allocated, the result is NULL. |
| 216 */ | 222 */ |
| 217 const SkData* SK_WARN_UNUSED_RESULT detachPixelsAsData(); | 223 const SkData* SK_WARN_UNUSED_RESULT detachPixelsAsData(); |
| 218 | 224 |
| 219 // We wrap these so we can clear our internal storage | 225 // We wrap these so we can clear our internal storage |
| 220 | 226 |
| 221 void reset() { | 227 void reset() { |
| 222 this->freeStorage(); | 228 this->freeStorage(); |
| 223 this->INHERITED::reset(); | 229 this->INHERITED::reset(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 private: | 294 private: |
| 289 void (*fUnlockProc)(void*); | 295 void (*fUnlockProc)(void*); |
| 290 void* fUnlockContext; | 296 void* fUnlockContext; |
| 291 SkPixmap fPixmap; | 297 SkPixmap fPixmap; |
| 292 bool fIsLocked; | 298 bool fIsLocked; |
| 293 | 299 |
| 294 friend class SkBitmap; | 300 friend class SkBitmap; |
| 295 }; | 301 }; |
| 296 | 302 |
| 297 #endif | 303 #endif |
| OLD | NEW |