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