remove unneeded device:lockpixels

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1156073003
This commit is contained in:
reed 2015-05-25 21:21:27 -07:00 committed by Commit bot
parent 61e91966aa
commit cd1d41e7c1
4 changed files with 16 additions and 29 deletions

View File

@ -119,12 +119,8 @@ protected:
bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) override;
bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) override;
void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) override;
/** Called when this device is installed into a Canvas. Balanced by a call
to unlockPixels() when the device is removed from a Canvas.
*/
void lockPixels() override;
void unlockPixels() override;
void onAttachToCanvas(SkCanvas*) override;
void onDetachFromCanvas() override;
private:
friend class SkCanvas;

View File

@ -104,7 +104,6 @@ public:
*/
virtual void onAttachToCanvas(SkCanvas*) {
SkASSERT(!fAttachedToCanvas);
this->lockPixels();
#ifdef SK_DEBUG
fAttachedToCanvas = true;
#endif
@ -118,7 +117,6 @@ public:
*/
virtual void onDetachFromCanvas() {
SkASSERT(fAttachedToCanvas);
this->unlockPixels();
#ifdef SK_DEBUG
fAttachedToCanvas = false;
#endif
@ -251,12 +249,6 @@ protected:
*/
virtual const SkBitmap& onAccessBitmap() = 0;
/** Called when this device is installed into a Canvas. Balanced by a call
to unlockPixels() when the device is removed from a Canvas.
*/
virtual void lockPixels() {}
virtual void unlockPixels() {}
/**
* Override and return true for filters that the device can handle
* intrinsically. Doing so means that SkCanvas will pass-through this

View File

@ -120,18 +120,6 @@ SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa
return SkBitmapDevice::Create(cinfo.fInfo, &leaky);
}
void SkBitmapDevice::lockPixels() {
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.lockPixels();
}
}
void SkBitmapDevice::unlockPixels() {
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.unlockPixels();
}
}
const SkBitmap& SkBitmapDevice::onAccessBitmap() {
return fBitmap;
}
@ -172,6 +160,20 @@ bool SkBitmapDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, s
return fBitmap.readPixels(dstInfo, dstPixels, dstRowBytes, x, y);
}
void SkBitmapDevice::onAttachToCanvas(SkCanvas* canvas) {
INHERITED::onAttachToCanvas(canvas);
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.lockPixels();
}
}
void SkBitmapDevice::onDetachFromCanvas() {
INHERITED::onDetachFromCanvas();
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.unlockPixels();
}
}
///////////////////////////////////////////////////////////////////////////////
void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {

View File

@ -252,9 +252,6 @@ protected:
const SkPaint&) override
{SkASSERT(0);}
void lockPixels() override {}
void unlockPixels() override {}
bool canHandleImageFilter(const SkImageFilter*) override {
return false;
}