1 // Copyright 2019 Google LLC. 2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3 4 #ifndef SkPixelRefPriv_DEFINED 5 #define SkPixelRefPriv_DEFINED 6 7 #include "include/core/SkRefCnt.h" 8 9 #include <cstddef> 10 11 class SkPixelRef; 12 13 /** 14 * Return a new SkMallocPixelRef with the provided pixel storage and 15 * rowBytes. On destruction, ReleaseProc will be called. 16 * 17 * If ReleaseProc is NULL, the pixels will never be released. This 18 * can be useful if the pixels were stack allocated. However, such an 19 * SkMallocPixelRef must not live beyond its pixels (e.g. by copying 20 * an SkBitmap pointing to it, or drawing to an SkPicture). 21 * 22 * Returns NULL on failure. 23 */ 24 sk_sp<SkPixelRef> SkMakePixelRefWithProc(int w, int h, size_t rowBytes, void* addr, 25 void (*releaseProc)(void* addr, void* ctx), void* ctx); 26 27 #endif // SkPixelRefPriv_DEFINED 28