xref: /third_party/skia/src/core/SkPixelRefPriv.h (revision cb93a386)
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 *  Return a new SkMallocPixelRef with the provided pixel storage and
8 *  rowBytes. On destruction, ReleaseProc will be called.
9 *
10 *  If ReleaseProc is NULL, the pixels will never be released. This
11 *  can be useful if the pixels were stack allocated. However, such an
12 *  SkMallocPixelRef must not live beyond its pixels (e.g. by copying
13 *  an SkBitmap pointing to it, or drawing to an SkPicture).
14 *
15 *  Returns NULL on failure.
16 */
17sk_sp<SkPixelRef> SkMakePixelRefWithProc(int w, int h, size_t rowBytes, void* addr,
18                                         void (*releaseProc)(void* addr, void* ctx), void* ctx);
19
20#endif  // SkPixelRefPriv_DEFINED
21