Revert "Revert of have DeferredDevice inherit from SkBaseDevice (https://codereview.chromium.org/165393006/)"

removed assert from lockPixels(), since that is called during setDevice()

This reverts commit 20bfc5337fa17cff52fb96b13af674c181e2c5a9.

BUG=skia:

Review URL: https://codereview.chromium.org/167003002

git-svn-id: http://skia.googlecode.com/svn/trunk@13454 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2014-02-14 15:23:15 +00:00
parent 97561975ff
commit 284a84d210

View File

@ -137,8 +137,7 @@ void DeferredPipeController::playback(bool silent) {
//-----------------------------------------------------------------------------
// DeferredDevice
//-----------------------------------------------------------------------------
// FIXME: Derive from SkBaseDevice.
class DeferredDevice : public SkBitmapDevice {
class DeferredDevice : public SkBaseDevice {
public:
explicit DeferredDevice(SkSurface* surface);
~DeferredDevice();
@ -163,6 +162,10 @@ public:
virtual uint32_t getDeviceCapabilities() SK_OVERRIDE;
virtual int width() const SK_OVERRIDE;
virtual int height() const SK_OVERRIDE;
virtual SkBitmap::Config config() const SK_OVERRIDE;
virtual bool isOpaque() const SK_OVERRIDE;
virtual SkImageInfo imageInfo() const SK_OVERRIDE;
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
@ -199,9 +202,11 @@ protected:
virtual void drawRect(const SkDraw&, const SkRect& r,
const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
virtual void drawOval(const SkDraw&, const SkRect&, const SkPaint&) SK_OVERRIDE
{SkASSERT(0);}
virtual void drawRRect(const SkDraw&, const SkRRect& rr,
const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
{SkASSERT(0);}
virtual void drawPath(const SkDraw&, const SkPath& path,
const SkPaint& paint,
const SkMatrix* prePathMatrix = NULL,
@ -210,6 +215,10 @@ protected:
virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
const SkMatrix& matrix, const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, const SkRect*,
const SkRect&, const SkPaint&,
SkCanvas::DrawBitmapRectFlags) SK_OVERRIDE
{SkASSERT(0);}
virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap,
int x, int y, const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
@ -234,8 +243,24 @@ protected:
virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
const SkPaint&) SK_OVERRIDE
{SkASSERT(0);}
virtual void lockPixels() SK_OVERRIDE {}
virtual void unlockPixels() SK_OVERRIDE {}
virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE {
return false;
}
virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE {
return false;
}
virtual bool filterImage(const SkImageFilter*, const SkBitmap&,
const SkMatrix&, SkBitmap*, SkIPoint*) SK_OVERRIDE {
return false;
}
private:
virtual void flush() SK_OVERRIDE;
virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE {}
void beginRecording();
void init();
@ -255,12 +280,7 @@ private:
size_t fBitmapSizeThreshold;
};
DeferredDevice::DeferredDevice(SkSurface* surface)
: SkBitmapDevice(SkBitmap::kNo_Config,
surface->getCanvas()->getDevice()->width(),
surface->getCanvas()->getDevice()->height(),
surface->getCanvas()->getDevice()->isOpaque(),
surface->getCanvas()->getDevice()->getDeviceProperties()) {
DeferredDevice::DeferredDevice(SkSurface* surface) {
fMaxRecordingStorageBytes = kDefaultMaxRecordingStorageBytes;
fNotificationClient = NULL;
fImmediateCanvas = NULL;
@ -427,6 +447,18 @@ int DeferredDevice::height() const {
return immediateDevice()->height();
}
SkBitmap::Config DeferredDevice::config() const {
return immediateDevice()->config();
}
bool DeferredDevice::isOpaque() const {
return immediateDevice()->isOpaque();
}
SkImageInfo DeferredDevice::imageInfo() const {
return immediateDevice()->imageInfo();
}
GrRenderTarget* DeferredDevice::accessRenderTarget() {
this->flushPendingCommands(kNormal_PlaybackMode);
return immediateDevice()->accessRenderTarget();