hide lockpixels api behind flag
guarded by SK_SUPPORT_OBSOLETE_LOCKPIXELS
needs https://codereview.chromium.org/2820873002/# to land first
Bug: skia:6481
Change-Id: I1c39902cbf6fe99f622adfa8192733b95f7fea09
Change-Id: I1c39902cbf6fe99f622adfa8192733b95f7fea09
Reviewed-on: https://skia-review.googlesource.com/13580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 9520210..e19f452 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -217,8 +217,8 @@
* "unknown" pixels.
*/
static bool ComputeIsOpaque(const SkBitmap& bm) {
- SkAutoPixmapUnlock result;
- return bm.requestLock(&result) && result.pixmap().computeIsOpaque();
+ SkPixmap pmap;
+ return bm.peekPixels(&pmap) && pmap.computeIsOpaque();
}
/**
@@ -419,10 +419,11 @@
*/
void setPixelRef(sk_sp<SkPixelRef>, int dx, int dy);
+#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
void lockPixels() const {}
void unlockPixels() const {}
-
bool requestLock(SkAutoPixmapUnlock* result) const;
+#endif
/** Call this to be sure that the bitmap is valid enough to be drawn (i.e.
it has non-null pixels, and if required by its colortype, it has a
@@ -755,26 +756,12 @@
friend class SkBinaryWriteBuffer; // rawpixels
};
+#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
class SkAutoLockPixels : SkNoncopyable {
public:
- SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) {
- fDidLock = doLock;
- if (doLock) {
- bm.lockPixels();
- }
- }
- ~SkAutoLockPixels() {
- if (fDidLock) {
- fBitmap.unlockPixels();
- }
- }
-
-private:
- const SkBitmap& fBitmap;
- bool fDidLock;
+ SkAutoLockPixels(const SkBitmap&, bool = true) {}
};
-//TODO(mtklein): uncomment when 71713004 lands and Chromium's fixed.
-//#define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels)
+#endif
///////////////////////////////////////////////////////////////////////////////