aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-27 13:41:44 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-27 13:41:44 +0000
commitc84b8335ee4fd864c30a4703afc643cf4b5010d9 (patch)
tree8d022e7b505f7fefdcc44eb2ba8274efbb43d307 /include/core
parent7329dc9976e5a61e2382974884d2e075f4f856f1 (diff)
Reapply "Remove Bitmaps Raw Pixel Support."
This CL reapplies r4722. Now that we have addressed the issues in Chrome tests that were causing asserts to be fired. Review URL: https://codereview.appspot.com/6452050 git-svn-id: http://skia.googlecode.com/svn/trunk@4804 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkBitmap.h16
-rw-r--r--include/core/SkMallocPixelRef.h3
2 files changed, 8 insertions, 11 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 5673fb289f..9ddd702a1f 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -94,10 +94,10 @@ public:
*/
bool empty() const { return 0 == fWidth || 0 == fHeight; }
- /** Return true iff the bitmap has no pixels nor a pixelref. Note: this can
- return true even if the dimensions of the bitmap are > 0 (see empty()).
+ /** Return true iff the bitmap has no pixelref. Note: this can return true even if the
+ dimensions of the bitmap are > 0 (see empty()).
*/
- bool isNull() const { return NULL == fPixels && NULL == fPixelRef; }
+ bool isNull() const { return NULL == fPixelRef; }
/** Return the config for the bitmap.
*/
@@ -361,9 +361,9 @@ public:
SkColorTable* getColorTable() const { return fColorTable; }
/** Returns a non-zero, unique value corresponding to the pixels in our
- pixelref (or raw pixels set via setPixels). Each time the pixels are
- changed (and notifyPixelsChanged is called), a different generation ID
- will be returned.
+ pixelref. Each time the pixels are changed (and notifyPixelsChanged
+ is called), a different generation ID will be returned. Finally, if
+ their is no pixelRef then zero is returned.
*/
uint32_t getGenerationID() const;
@@ -612,10 +612,6 @@ private:
// or a cache of the returned value from fPixelRef->lockPixels()
mutable void* fPixels;
mutable SkColorTable* fColorTable; // only meaningful for kIndex8
- // When there is no pixel ref (setPixels was called) we still need a
- // gen id for SkDevice implementations that may cache a copy of the
- // pixels (e.g. as a gpu texture)
- mutable int fRawPixelGenerationID;
enum Flags {
kImageIsOpaque_Flag = 0x01,
diff --git a/include/core/SkMallocPixelRef.h b/include/core/SkMallocPixelRef.h
index 802e2b2e36..1bf1afc694 100644
--- a/include/core/SkMallocPixelRef.h
+++ b/include/core/SkMallocPixelRef.h
@@ -21,7 +21,7 @@ public:
last owner of this pixelref is gone. If addr is NULL, sk_malloc_throw()
is called to allocate it.
*/
- SkMallocPixelRef(void* addr, size_t size, SkColorTable* ctable);
+ SkMallocPixelRef(void* addr, size_t size, SkColorTable* ctable, bool ownPixels = true);
virtual ~SkMallocPixelRef();
//! Return the allocation size for the pixels
@@ -42,6 +42,7 @@ private:
void* fStorage;
size_t fSize;
SkColorTable* fCTable;
+ bool fOwnPixels;
typedef SkPixelRef INHERITED;
};