aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-04-14 17:16:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-14 21:54:07 +0000
commitb712089b93fadf3f3b560e9b21803f4c7626c94e (patch)
tree48bda759ca98c4fbf3b3544d54b07d48832043cf /include
parentade76e9236788120d8a1a4a7a252d8f66b8b9b02 (diff)
remove lock tracking in bitmaps -- they are always locked
Bug: skia:6481 Change-Id: I551c9fd5cdf1ea99fc62042d24d638a1021c348d Reviewed-on: https://skia-review.googlesource.com/13473 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmap.h43
1 files changed, 13 insertions, 30 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 0fcfa2b24c..9520210888 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -419,17 +419,8 @@ public:
*/
void setPixelRef(sk_sp<SkPixelRef>, int dx, int dy);
- /** Call this to ensure that the bitmap points to the current pixel address
- in the pixelref. Balance it with a call to unlockPixels(). These calls
- are harmless if there is no pixelref.
- */
- void lockPixels() const;
- /** When you are finished access the pixel memory, call this to balance a
- previous call to lockPixels(). This allows pixelrefs that implement
- cached/deferred image decoding to know when there are active clients of
- a given image.
- */
- void unlockPixels() const;
+ void lockPixels() const {}
+ void unlockPixels() const {}
bool requestLock(SkAutoPixmapUnlock* result) const;
@@ -439,7 +430,7 @@ public:
*/
bool readyToDraw() const {
return this->getPixels() != NULL &&
- (this->colorType() != kIndex_8_SkColorType || fColorTable);
+ (this->colorType() != kIndex_8_SkColorType || this->getColorTable());
}
/** Return the bitmap's colortable, if it uses one (i.e. colorType is
@@ -447,7 +438,7 @@ public:
Otherwise returns NULL. Does not affect the colortable's
reference count.
*/
- SkColorTable* getColorTable() const { return fColorTable; }
+ SkColorTable* getColorTable() const;
/** Returns a non-zero, unique value corresponding to the pixels in our
pixelref. Each time the pixels are changed (and notifyPixelsChanged
@@ -731,14 +722,6 @@ public:
SK_TO_STRING_NONVIRT()
private:
- mutable sk_sp<SkPixelRef> fPixelRef;
- mutable int fPixelLockCount;
- // These are just caches from the locked pixelref
- mutable void* fPixels;
- mutable SkColorTable* fColorTable; // only meaningful for kIndex8
-
- SkIPoint fPixelRefOrigin;
-
enum Flags {
kImageIsVolatile_Flag = 0x02,
#ifdef SK_BUILD_FOR_ANDROID
@@ -750,26 +733,26 @@ private:
#endif
};
- SkImageInfo fInfo;
- uint32_t fRowBytes;
- uint8_t fFlags;
+ sk_sp<SkPixelRef> fPixelRef;
+ void* fPixels;
+ SkIPoint fPixelRefOrigin;
+ SkImageInfo fInfo;
+ uint32_t fRowBytes;
+ uint8_t fFlags;
bool writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior);
-
bool internalCopyTo(SkBitmap* dst, SkColorType ct, Allocator*) const;
/* Unreference any pixelrefs or colortables
*/
void freePixels();
- void updatePixelsFromRef() const;
+ void updatePixelsFromRef();
static void WriteRawPixels(SkWriteBuffer*, const SkBitmap&);
static bool ReadRawPixels(SkReadBuffer*, SkBitmap*);
- friend class SkImage_Raster;
friend class SkReadBuffer; // unflatten, rawpixels
friend class SkBinaryWriteBuffer; // rawpixels
- friend struct SkBitmapProcState;
};
class SkAutoLockPixels : SkNoncopyable {
@@ -820,8 +803,8 @@ inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
SkASSERT(fPixels);
SkASSERT(kIndex_8_SkColorType == this->colorType());
SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)this->height());
- SkASSERT(fColorTable);
- return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
+ SkASSERT(this->getColorTable());
+ return (*this->getColorTable())[*((const uint8_t*)fPixels + y * fRowBytes + x)];
}
#endif