Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkMallocPixelRef.h
1 /*
2  * Copyright 2008 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 
9 #ifndef SkMallocPixelRef_DEFINED
10 #define SkMallocPixelRef_DEFINED
11 
12 #include "SkPixelRef.h"
13 
17 class SK_API SkMallocPixelRef : public SkPixelRef {
18 public:
27  static sk_sp<SkPixelRef> MakeDirect(const SkImageInfo&, void* addr,
28  size_t rowBytes, sk_sp<SkColorTable>);
29 
40  static sk_sp<SkPixelRef> MakeAllocate(const SkImageInfo&, size_t rowBytes, sk_sp<SkColorTable>);
41 
45  static sk_sp<SkPixelRef> MakeZeroed(const SkImageInfo&, size_t rowBytes, sk_sp<SkColorTable>);
46 
59  typedef void (*ReleaseProc)(void* addr, void* context);
60  static sk_sp<SkPixelRef> MakeWithProc(const SkImageInfo& info,
61  size_t rowBytes, sk_sp<SkColorTable>,
62  void* addr, ReleaseProc proc,
63  void* context);
64 
73  static sk_sp<SkPixelRef> MakeWithData(const SkImageInfo& info,
74  size_t rowBytes,
76  sk_sp<SkData> data);
77 
78 protected:
79  ~SkMallocPixelRef() override;
80 
81 private:
82  // Uses alloc to implement NewAllocate or NewZeroed.
83  static sk_sp<SkPixelRef> MakeUsing(void*(*alloc)(size_t),
84  const SkImageInfo&,
85  size_t rowBytes,
87 
88  ReleaseProc fReleaseProc;
89  void* fReleaseProcContext;
90 
91  SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, sk_sp<SkColorTable>,
92  ReleaseProc proc, void* context);
93 
94  typedef SkPixelRef INHERITED;
95 };
96 
97 
98 #endif
Describe an image's dimensions and pixel type.
Definition: SkImageInfo.h:181
This class is the smart container for pixel memory, and is used with SkBitmap.
Definition: SkPixelRef.h:33
We explicitly use the same allocator for our pixels that SkMask does, so that we can freely assign me...
Definition: SkMallocPixelRef.h:17