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

Unified Diff: include/core/SkBitmap.h

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkMallocPixelRef.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkBitmap.h
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index f53a0a7e45a4d98a7eed2104027794cd33029dfc..af0c8b87e7a643fbf7fbf7b193fcb53b8ffcf010 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -18,6 +18,7 @@ struct SkIRect;
struct SkRect;
class SkPaint;
class SkPixelRef;
+class SkPixelRefFactory;
class SkRegion;
class SkString;
@@ -250,6 +251,35 @@ public:
bool setConfig(const SkImageInfo& info, size_t rowBytes = 0);
/**
+ * Allocate a pixelref to match the specified image info. If the Factory
+ * is non-null, call it to allcoate the pixelref. If the ImageInfo requires
+ * a colortable, then ColorTable must be non-null, and will be ref'd.
+ * On failure, the bitmap will be set to empty and return false.
+ */
+ bool allocPixels(const SkImageInfo&, SkPixelRefFactory*, SkColorTable*);
+
+ /**
+ * Allocate a pixelref to match the specified image info, using the default
+ * allocator.
+ * On success, the bitmap's pixels will be "locked", and return true.
+ * On failure, the bitmap will be set to empty and return false.
+ */
+ bool allocPixels(const SkImageInfo& info) {
+ return this->allocPixels(info, NULL, NULL);
+ }
+
+ /**
+ * Install a pixelref that wraps the specified pixels and rowBytes, and
+ * optional ReleaseProc and context. When the pixels are no longer
+ * referenced, if ReleaseProc is not null, it will be called with the
+ * pixels and context as parameters.
+ * On failure, the bitmap will be set to empty and return false.
+ */
+ bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes,
+ void (*ReleaseProc)(void* addr, void* context),
+ void* context);
+
+ /**
* If the bitmap's config can be represented as SkImageInfo, return true,
* and if info is not-null, set it to the bitmap's info. If it cannot be
* represented as SkImageInfo, return false and ignore the info parameter.
@@ -637,7 +667,7 @@ public:
*/
class HeapAllocator : public Allocator {
public:
- virtual bool allocPixelRef(SkBitmap*, SkColorTable*);
+ virtual bool allocPixelRef(SkBitmap*, SkColorTable*) SK_OVERRIDE;
};
class RLEPixels {
« no previous file with comments | « no previous file | include/core/SkMallocPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698