Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: src/utils/SkDeferredCanvas.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pipe/utils/SamplePipeControllers.cpp ('k') | src/utils/SkPictureUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkDeferredCanvas.cpp
===================================================================
--- src/utils/SkDeferredCanvas.cpp (revision 10994)
+++ src/utils/SkDeferredCanvas.cpp (working copy)
@@ -8,9 +8,9 @@
#include "SkDeferredCanvas.h"
+#include "SkBitmapDevice.h"
#include "SkChunkAlloc.h"
#include "SkColorFilter.h"
-#include "SkDevice.h"
#include "SkDrawFilter.h"
#include "SkGPipe.h"
#include "SkPaint.h"
@@ -137,16 +137,16 @@
//-----------------------------------------------------------------------------
// DeferredDevice
//-----------------------------------------------------------------------------
-class DeferredDevice : public SkDevice {
+class DeferredDevice : public SkBitmapDevice {
public:
- explicit DeferredDevice(SkDevice* immediateDevice);
+ explicit DeferredDevice(SkBaseDevice* immediateDevice);
explicit DeferredDevice(SkSurface* surface);
~DeferredDevice();
void setNotificationClient(SkDeferredCanvas::NotificationClient* notificationClient);
SkCanvas* recordingCanvas();
SkCanvas* immediateCanvas() const {return fImmediateCanvas;}
- SkDevice* immediateDevice() const {return fImmediateCanvas->getTopDevice();}
+ SkBaseDevice* immediateDevice() const {return fImmediateCanvas->getTopDevice();}
SkImage* newImageSnapshot();
void setSurface(SkSurface* surface);
bool isFreshFrame();
@@ -165,24 +165,24 @@
virtual int height() const SK_OVERRIDE;
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
- virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) SK_OVERRIDE;
+ virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) SK_OVERRIDE;
virtual void writePixels(const SkBitmap& bitmap, int x, int y,
SkCanvas::Config8888 config8888) SK_OVERRIDE;
protected:
- virtual const SkBitmap& onAccessBitmap(SkBitmap*) SK_OVERRIDE;
+ virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE;
virtual bool onReadPixels(const SkBitmap& bitmap,
int x, int y,
SkCanvas::Config8888 config8888) SK_OVERRIDE;
// The following methods are no-ops on a deferred device
- virtual bool filterTextFlags(const SkPaint& paint, TextFlags*)
- SK_OVERRIDE
- {return false;}
+ virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {
+ return false;
+ }
// None of the following drawing methods should ever get called on the
// deferred device
@@ -234,7 +234,7 @@
SkXfermode* xmode, const uint16_t indices[],
int indexCount, const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
- virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
+ virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
const SkPaint&) SK_OVERRIDE
{SkASSERT(0);}
private:
@@ -258,11 +258,11 @@
size_t fBitmapSizeThreshold;
};
-DeferredDevice::DeferredDevice(SkDevice* immediateDevice)
- : SkDevice(SkBitmap::kNo_Config,
- immediateDevice->width(), immediateDevice->height(),
- immediateDevice->isOpaque(),
- immediateDevice->getDeviceProperties()) {
+DeferredDevice::DeferredDevice(SkBaseDevice* immediateDevice)
+ : SkBitmapDevice(SkBitmap::kNo_Config,
+ immediateDevice->width(), immediateDevice->height(),
+ immediateDevice->isOpaque(),
+ immediateDevice->getDeviceProperties()) {
fSurface = NULL;
fImmediateCanvas = SkNEW_ARGS(SkCanvas, (immediateDevice));
fPipeController.setPlaybackCanvas(fImmediateCanvas);
@@ -270,11 +270,11 @@
}
DeferredDevice::DeferredDevice(SkSurface* surface)
- : SkDevice(SkBitmap::kNo_Config,
- surface->getCanvas()->getDevice()->width(),
- surface->getCanvas()->getDevice()->height(),
- surface->getCanvas()->getDevice()->isOpaque(),
- surface->getCanvas()->getDevice()->getDeviceProperties()) {
+ : SkBitmapDevice(SkBitmap::kNo_Config,
+ surface->getCanvas()->getDevice()->width(),
+ surface->getCanvas()->getDevice()->height(),
+ surface->getCanvas()->getDevice()->isOpaque(),
+ surface->getCanvas()->getDevice()->getDeviceProperties()) {
fMaxRecordingStorageBytes = kDefaultMaxRecordingStorageBytes;
fNotificationClient = NULL;
fImmediateCanvas = NULL;
@@ -492,12 +492,12 @@
}
}
-const SkBitmap& DeferredDevice::onAccessBitmap(SkBitmap*) {
+const SkBitmap& DeferredDevice::onAccessBitmap() {
this->flushPendingCommands(kNormal_PlaybackMode);
return immediateDevice()->accessBitmap(false);
}
-SkDevice* DeferredDevice::onCreateCompatibleDevice(
+SkBaseDevice* DeferredDevice::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage usage) {
@@ -555,7 +555,7 @@
return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice));
}
-SkDeferredCanvas* SkDeferredCanvas::Create(SkDevice* device) {
+SkDeferredCanvas* SkDeferredCanvas::Create(SkBaseDevice* device) {
SkAutoTUnref<DeferredDevice> deferredDevice(SkNEW_ARGS(DeferredDevice, (device)));
return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice));
}
« no previous file with comments | « src/pipe/utils/SamplePipeControllers.cpp ('k') | src/utils/SkPictureUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698