Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: include/core/SkMallocPixelRef.h

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: new signature: PixelRefFactory to go along with installPixels Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef SkMallocPixelRef_DEFINED 9 #ifndef SkMallocPixelRef_DEFINED
10 #define SkMallocPixelRef_DEFINED 10 #define SkMallocPixelRef_DEFINED
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 * Returns NULL on failure. 71 * Returns NULL on failure.
72 */ 72 */
73 static SkMallocPixelRef* NewWithData(const SkImageInfo& info, 73 static SkMallocPixelRef* NewWithData(const SkImageInfo& info,
74 size_t rowBytes, 74 size_t rowBytes,
75 SkColorTable* ctable, 75 SkColorTable* ctable,
76 SkData* data, 76 SkData* data,
77 size_t offset = 0); 77 size_t offset = 0);
78 78
79 void* getAddr() const { return fStorage; } 79 void* getAddr() const { return fStorage; }
80 80
81 class PRFactory : public SkPixelRefFactory {
82 public:
83 virtual SkPixelRef* create(const SkImageInfo&,
84 SkColorTable*) SK_OVERRIDE;
85 };
86
81 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef) 87 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef)
82 88
83 protected: 89 protected:
84 // The ownPixels version of this constructor is deprecated. 90 // The ownPixels version of this constructor is deprecated.
85 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, 91 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*,
86 bool ownPixels); 92 bool ownPixels);
87 SkMallocPixelRef(SkFlattenableReadBuffer& buffer); 93 SkMallocPixelRef(SkFlattenableReadBuffer& buffer);
88 virtual ~SkMallocPixelRef(); 94 virtual ~SkMallocPixelRef();
89 95
90 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; 96 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
91 virtual void onUnlockPixels() SK_OVERRIDE; 97 virtual void onUnlockPixels() SK_OVERRIDE;
92 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 98 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
93 virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE; 99 virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE;
94 100
95 private: 101 private:
96 void* fStorage; 102 void* fStorage;
97 SkColorTable* fCTable; 103 SkColorTable* fCTable;
98 size_t fRB; 104 size_t fRB;
99 ReleaseProc fReleaseProc; 105 ReleaseProc fReleaseProc;
100 void* fReleaseProcContext; 106 void* fReleaseProcContext;
101 107
102 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, 108 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*,
103 ReleaseProc proc, void* context); 109 ReleaseProc proc, void* context);
104 110
105 typedef SkPixelRef INHERITED; 111 typedef SkPixelRef INHERITED;
106 }; 112 };
107 113
108 114
109 #endif 115 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | include/core/SkPixelRef.h » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698