blob: 6198ba9091f4545936a5d56d3941c9f604468752 [file] [log] [blame]
Hal Canarybb108482019-08-14 12:19:20 -04001// 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
Kevin Lubicka27b4172022-09-12 15:29:49 -04006
7#include "include/core/SkRefCnt.h"
8
9#include <cstddef>
10
11class SkPixelRef;
12
Hal Canarybb108482019-08-14 12:19:20 -040013/**
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 */
24sk_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