aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBBoxHierarchyRecord.cpp2
-rw-r--r--src/core/SkBBoxHierarchyRecord.h2
-rw-r--r--src/core/SkBBoxRecord.h2
-rw-r--r--src/core/SkCanvas.cpp60
-rw-r--r--src/core/SkDevice.cpp203
-rw-r--r--src/core/SkDeviceImageFilterProxy.h6
-rw-r--r--src/core/SkPicture.cpp4
-rw-r--r--src/core/SkPictureRecord.cpp4
-rw-r--r--src/core/SkPictureRecord.h4
-rw-r--r--src/device/xps/SkXPSDevice.cpp16
-rwxr-xr-xsrc/effects/SkColorFilterImageFilter.cpp2
-rw-r--r--src/effects/SkDropShadowImageFilter.cpp2
-rwxr-xr-xsrc/effects/SkMergeImageFilter.cpp2
-rw-r--r--src/effects/SkRectShaderImageFilter.cpp4
-rwxr-xr-xsrc/effects/SkTestImageFilters.cpp8
-rw-r--r--src/gpu/SkGpuDevice.cpp20
-rw-r--r--src/pdf/SkPDFDevice.cpp16
-rw-r--r--src/pipe/SkGPipeWrite.cpp4
-rw-r--r--src/pipe/utils/SamplePipeControllers.cpp4
-rw-r--r--src/utils/SkDeferredCanvas.cpp52
-rw-r--r--src/utils/SkPictureUtils.cpp17
21 files changed, 218 insertions, 216 deletions
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp
index 9c02468ae1..61a82cef3d 100644
--- a/src/core/SkBBoxHierarchyRecord.cpp
+++ b/src/core/SkBBoxHierarchyRecord.cpp
@@ -11,7 +11,7 @@
SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags,
SkBBoxHierarchy* h,
- SkDevice* device)
+ SkBaseDevice* device)
: INHERITED(recordFlags, device) {
fStateTree = SkNEW(SkPictureStateTree);
fBoundingHierarchy = h;
diff --git a/src/core/SkBBoxHierarchyRecord.h b/src/core/SkBBoxHierarchyRecord.h
index 27da3c9188..7284ab04ec 100644
--- a/src/core/SkBBoxHierarchyRecord.h
+++ b/src/core/SkBBoxHierarchyRecord.h
@@ -20,7 +20,7 @@ class SkBBoxHierarchyRecord : public SkBBoxRecord, public SkBBoxHierarchyClient
public:
/** This will take a ref of h */
SkBBoxHierarchyRecord(uint32_t recordFlags, SkBBoxHierarchy* h,
- SkDevice*);
+ SkBaseDevice*);
virtual void handleBBox(const SkRect& bounds) SK_OVERRIDE;
diff --git a/src/core/SkBBoxRecord.h b/src/core/SkBBoxRecord.h
index 7859df1b02..fa8b282247 100644
--- a/src/core/SkBBoxRecord.h
+++ b/src/core/SkBBoxRecord.h
@@ -19,7 +19,7 @@
class SkBBoxRecord : public SkPictureRecord {
public:
- SkBBoxRecord(uint32_t recordFlags, SkDevice* device)
+ SkBBoxRecord(uint32_t recordFlags, SkBaseDevice* device)
: INHERITED(recordFlags, device) { }
virtual ~SkBBoxRecord() { }
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ff688f5080..7add524260 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -8,8 +8,8 @@
#include "SkCanvas.h"
+#include "SkBitmapDevice.h"
#include "SkBounder.h"
-#include "SkDevice.h"
#include "SkDeviceImageFilterProxy.h"
#include "SkDraw.h"
#include "SkDrawFilter.h"
@@ -129,7 +129,7 @@ void SkCanvas::predrawNotify() {
///////////////////////////////////////////////////////////////////////////////
-/* This is the record we keep for each SkDevice that the user installs.
+/* This is the record we keep for each SkBaseDevice that the user installs.
The clip/matrix/proc are fields that reflect the top of the save/restore
stack. Whenever the canvas changes, it marks a dirty flag, and then before
these are used (assuming we're not on a layer) we rebuild these cache
@@ -138,12 +138,12 @@ void SkCanvas::predrawNotify() {
*/
struct DeviceCM {
DeviceCM* fNext;
- SkDevice* fDevice;
+ SkBaseDevice* fDevice;
SkRasterClip fClip;
const SkMatrix* fMatrix;
SkPaint* fPaint; // may be null (in the future)
- DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
+ DeviceCM(SkBaseDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
: fNext(NULL) {
if (NULL != device) {
device->ref();
@@ -315,7 +315,7 @@ public:
return false;
}
- SkDevice* getDevice() const { return fDevice; }
+ SkBaseDevice* getDevice() const { return fDevice; }
int getX() const { return fDevice->getOrigin().x(); }
int getY() const { return fDevice->getOrigin().y(); }
const SkMatrix& getMatrix() const { return *fMatrix; }
@@ -482,7 +482,7 @@ private:
////////////////////////////////////////////////////////////////////////////
-SkDevice* SkCanvas::init(SkDevice* device) {
+SkBaseDevice* SkCanvas::init(SkBaseDevice* device) {
fBounder = NULL;
fLocalBoundsCompareType.setEmpty();
fLocalBoundsCompareTypeDirty = true;
@@ -511,7 +511,7 @@ SkCanvas::SkCanvas()
this->init(NULL);
}
-SkCanvas::SkCanvas(SkDevice* device)
+SkCanvas::SkCanvas(SkBaseDevice* device)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
inc_canvas();
@@ -522,7 +522,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
inc_canvas();
- this->init(SkNEW_ARGS(SkDevice, (bitmap)))->unref();
+ this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref();
}
SkCanvas::~SkCanvas() {
@@ -564,37 +564,37 @@ SkMetaData& SkCanvas::getMetaData() {
///////////////////////////////////////////////////////////////////////////////
void SkCanvas::flush() {
- SkDevice* device = this->getDevice();
+ SkBaseDevice* device = this->getDevice();
if (device) {
device->flush();
}
}
SkISize SkCanvas::getDeviceSize() const {
- SkDevice* d = this->getDevice();
+ SkBaseDevice* d = this->getDevice();
return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
}
-SkDevice* SkCanvas::getDevice() const {
+SkBaseDevice* SkCanvas::getDevice() const {
// return root device
MCRec* rec = (MCRec*) fMCStack.front();
SkASSERT(rec && rec->fLayer);
return rec->fLayer->fDevice;
}
-SkDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const {
+SkBaseDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const {
if (updateMatrixClip) {
const_cast<SkCanvas*>(this)->updateDeviceCMCache();
}
return fMCRec->fTopLayer->fDevice;
}
-SkDevice* SkCanvas::setDevice(SkDevice* device) {
+SkBaseDevice* SkCanvas::setDevice(SkBaseDevice* device) {
// return root device
SkDeque::F2BIter iter(fMCStack);
MCRec* rec = (MCRec*)iter.next();
SkASSERT(rec && rec->fLayer);
- SkDevice* rootDevice = rec->fLayer->fDevice;
+ SkBaseDevice* rootDevice = rec->fLayer->fDevice;
if (rootDevice == device) {
return device;
@@ -644,7 +644,7 @@ SkDevice* SkCanvas::setDevice(SkDevice* device) {
bool SkCanvas::readPixels(SkBitmap* bitmap,
int x, int y,
Config8888 config8888) {
- SkDevice* device = this->getDevice();
+ SkBaseDevice* device = this->getDevice();
if (!device) {
return false;
}
@@ -652,7 +652,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap,
}
bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
- SkDevice* device = this->getDevice();
+ SkBaseDevice* device = this->getDevice();
if (!device) {
return false;
}
@@ -676,7 +676,7 @@ bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
void SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y,
Config8888 config8888) {
- SkDevice* device = this->getDevice();
+ SkBaseDevice* device = this->getDevice();
if (device) {
if (SkIRect::Intersects(SkIRect::MakeSize(this->getDeviceSize()),
SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()))) {
@@ -748,7 +748,7 @@ static SkBitmap::Config resolve_config(SkCanvas* canvas,
uint32_t configMask = 0;
for (int i = canvas->countLayerDevices() - 1; i >= 0; --i)
{
- SkDevice* device = canvas->getLayerDevice(i);
+ SkBaseDevice* device = canvas->getLayerDevice(i);
if (device->intersects(bounds))
configMask |= 1 << device->config();
}
@@ -849,7 +849,7 @@ int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
bool isOpaque;
SkBitmap::Config config = resolve_config(this, ir, flags, &isOpaque);
- SkDevice* device;
+ SkBaseDevice* device;
if (paint && paint->getImageFilter()) {
device = this->createCompatibleDevice(config, ir.width(), ir.height(),
isOpaque);
@@ -981,7 +981,7 @@ void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap,
LOOPER_END
}
-void SkCanvas::internalDrawDevice(SkDevice* srcDev, int x, int y,
+void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
const SkPaint* paint) {
SkPaint tmp;
if (NULL == paint) {
@@ -991,7 +991,7 @@ void SkCanvas::internalDrawDevice(SkDevice* srcDev, int x, int y,
LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type)
while (iter.next()) {
- SkDevice* dstDev = iter.fDevice;
+ SkBaseDevice* dstDev = iter.fDevice;
paint = &looper.paint();
SkImageFilter* filter = paint->getImageFilter();
SkIPoint pos = { x - iter.getX(), y - iter.getY() };
@@ -1167,7 +1167,7 @@ static bool clipPathHelper(const SkCanvas* canvas, SkRasterClip* currClip,
return currClip->op(clip, op);
}
} else {
- const SkDevice* device = canvas->getDevice();
+ const SkBaseDevice* device = canvas->getDevice();
if (!device) {
return currClip->setEmpty();
}
@@ -1361,7 +1361,7 @@ bool SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) {
#ifdef SK_DEBUG
void SkCanvas::validateClip() const {
// construct clipRgn from the clipstack
- const SkDevice* device = this->getDevice();
+ const SkBaseDevice* device = this->getDevice();
if (!device) {
SkASSERT(this->getTotalClip().isEmpty());
return;
@@ -1546,10 +1546,10 @@ const SkRegion& SkCanvas::getTotalClip() const {
return fMCRec->fRasterClip->forceGetBW();
}
-SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
+SkBaseDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque) {
- SkDevice* device = this->getTopDevice();
+ SkBaseDevice* device = this->getTopDevice();
if (device) {
return device->createCompatibleDeviceForSaveLayer(config, width, height,
isOpaque);
@@ -1558,10 +1558,10 @@ SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
}
}
-SkDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
+SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque) {
- SkDevice* device = this->getDevice();
+ SkBaseDevice* device = this->getDevice();
if (device) {
return device->createCompatibleDevice(config, width, height, isOpaque);
} else {
@@ -1877,8 +1877,8 @@ void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
class SkDeviceFilteredPaint {
public:
- SkDeviceFilteredPaint(SkDevice* device, const SkPaint& paint) {
- SkDevice::TextFlags flags;
+ SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) {
+ SkBaseDevice::TextFlags flags;
if (device->filterTextFlags(paint, &flags)) {
SkPaint* newPaint = fLazy.set(paint);
newPaint->setFlags(flags.fFlags);
@@ -2206,7 +2206,7 @@ void SkCanvas::LayerIter::next() {
fDone = !fImpl->next();
}
-SkDevice* SkCanvas::LayerIter::device() const {
+SkBaseDevice* SkCanvas::LayerIter::device() const {
return fImpl->getDevice();
}
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index d06f6e677d..69b0f6afa1 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -5,6 +5,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkBitmapDevice.h"
#include "SkDevice.h"
#include "SkDeviceProperties.h"
#include "SkDraw.h"
@@ -15,7 +16,8 @@
#include "SkRRect.h"
#include "SkShader.h"
-SK_DEFINE_INST_COUNT(SkDevice)
+SK_DEFINE_INST_COUNT(SkBaseDevice)
+SK_DEFINE_INST_COUNT(SkBitmapDevice)
///////////////////////////////////////////////////////////////////////////////
@@ -24,20 +26,13 @@ SK_DEFINE_INST_COUNT(SkDevice)
///////////////////////////////////////////////////////////////////////////////
-SkDevice::SkDevice(const SkBitmap& bitmap)
- : fBitmap(bitmap), fLeakyProperties(SkDeviceProperties::MakeDefault())
-#ifdef SK_DEBUG
- , fAttachedToCanvas(false)
-#endif
-{
- fOrigin.setZero();
- fMetaData = NULL;
-
+SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
+ : fBitmap(bitmap) {
SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config());
}
-SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
- : fBitmap(bitmap), fLeakyProperties(deviceProperties)
+SkBaseDevice::SkBaseDevice()
+ : fLeakyProperties(SkDeviceProperties::MakeDefault())
#ifdef SK_DEBUG
, fAttachedToCanvas(false)
#endif
@@ -46,15 +41,22 @@ SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& devicePrope
fMetaData = NULL;
}
-SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque)
- : fLeakyProperties(SkDeviceProperties::MakeDefault())
+SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
+ : SkBaseDevice(deviceProperties)
+ , fBitmap(bitmap) {
+}
+
+SkBaseDevice::SkBaseDevice(const SkDeviceProperties& deviceProperties)
+ : fLeakyProperties(deviceProperties)
#ifdef SK_DEBUG
, fAttachedToCanvas(false)
#endif
{
fOrigin.setZero();
fMetaData = NULL;
+}
+SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque) {
fBitmap.setConfig(config, width, height);
fBitmap.allocPixels();
fBitmap.setIsOpaque(isOpaque);
@@ -63,15 +65,9 @@ SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque
}
}
-SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
- const SkDeviceProperties& deviceProperties)
- : fLeakyProperties(deviceProperties)
-#ifdef SK_DEBUG
- , fAttachedToCanvas(false)
-#endif
-{
- fOrigin.setZero();
- fMetaData = NULL;
+SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+ const SkDeviceProperties& deviceProperties)
+ : SkBaseDevice(deviceProperties) {
fBitmap.setConfig(config, width, height);
fBitmap.allocPixels();
@@ -81,39 +77,43 @@ SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque
}
}
-SkDevice::~SkDevice() {
+SkBaseDevice::~SkBaseDevice() {
delete fMetaData;
}
-void SkDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
+SkBitmapDevice::~SkBitmapDevice() {
+}
+
+void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
SkASSERT(bm.width() == fBitmap.width());
SkASSERT(bm.height() == fBitmap.height());
fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config)
fBitmap.lockPixels();
}
-SkDevice* SkDevice::createCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque) {
+SkBaseDevice* SkBaseDevice::createCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque) {
return this->onCreateCompatibleDevice(config, width, height,
isOpaque, kGeneral_Usage);
}
-SkDevice* SkDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
- int width, int height,
- bool isOpaque) {
+SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque) {
return this->onCreateCompatibleDevice(config, width, height,
isOpaque, kSaveLayer_Usage);
}
-SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
- return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque, fLeakyProperties));
+SkBaseDevice* SkBitmapDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
+ return SkNEW_ARGS(SkBitmapDevice,(config, width, height, isOpaque,
+ this->getDeviceProperties()));
}
-SkMetaData& SkDevice::getMetaData() {
+SkMetaData& SkBaseDevice::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
if (NULL == fMetaData) {
@@ -122,61 +122,60 @@ SkMetaData& SkDevice::getMetaData() {
return *fMetaData;
}
-void SkDevice::lockPixels() {
+void SkBitmapDevice::lockPixels() {
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.lockPixels();
}
}
-void SkDevice::unlockPixels() {
+void SkBitmapDevice::unlockPixels() {
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.unlockPixels();
}
}
-const SkBitmap& SkDevice::accessBitmap(bool changePixels) {
- const SkBitmap& bitmap = this->onAccessBitmap(&fBitmap);
+const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
+ const SkBitmap& bitmap = this->onAccessBitmap();
if (changePixels) {
bitmap.notifyPixelsChanged();
}
return bitmap;
}
-void SkDevice::getGlobalBounds(SkIRect* bounds) const {
+void SkBitmapDevice::getGlobalBounds(SkIRect* bounds) const {
if (bounds) {
- bounds->setXYWH(fOrigin.x(), fOrigin.y(),
+ const SkIPoint& origin = this->getOrigin();
+ bounds->setXYWH(origin.x(), origin.y(),
fBitmap.width(), fBitmap.height());
}
}
-void SkDevice::clear(SkColor color) {
+void SkBitmapDevice::clear(SkColor color) {
fBitmap.eraseColor(color);
}
-const SkBitmap& SkDevice::onAccessBitmap(SkBitmap* bitmap) {return *bitmap;}
-
-void SkDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& region,
- const SkClipStack& clipStack) {
+const SkBitmap& SkBitmapDevice::onAccessBitmap() {
+ return fBitmap;
}
-bool SkDevice::canHandleImageFilter(SkImageFilter*) {
+bool SkBitmapDevice::canHandleImageFilter(SkImageFilter*) {
return false;
}
-bool SkDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
- const SkMatrix& ctm, SkBitmap* result,
- SkIPoint* offset) {
+bool SkBitmapDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
+ const SkMatrix& ctm, SkBitmap* result,
+ SkIPoint* offset) {
return false;
}
-bool SkDevice::allowImageFilter(SkImageFilter*) {
+bool SkBitmapDevice::allowImageFilter(SkImageFilter*) {
return true;
}
///////////////////////////////////////////////////////////////////////////////
-bool SkDevice::readPixels(SkBitmap* bitmap, int x, int y,
- SkCanvas::Config8888 config8888) {
+bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y,
+ SkCanvas::Config8888 config8888) {
if (SkBitmap::kARGB_8888_Config != bitmap->config() ||
NULL != bitmap->getTexture()) {
return false;
@@ -220,21 +219,21 @@ bool SkDevice::readPixels(SkBitmap* bitmap, int x, int y,
}
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
- const SkCanvas::Config8888 SkDevice::kPMColorAlias =
+ const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
SkCanvas::kBGRA_Premul_Config8888;
#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
- const SkCanvas::Config8888 SkDevice::kPMColorAlias =
+ const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
SkCanvas::kRGBA_Premul_Config8888;
#else
- const SkCanvas::Config8888 SkDevice::kPMColorAlias =
+ const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
(SkCanvas::Config8888) -1;
#endif
#include <SkConfig8888.h>
-bool SkDevice::onReadPixels(const SkBitmap& bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888) {
+bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap,
+ int x, int y,
+ SkCanvas::Config8888 config8888) {
SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config());
SkASSERT(!bitmap.isNull());
SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height())));
@@ -257,9 +256,9 @@ bool SkDevice::onReadPixels(const SkBitmap& bitmap,
return true;
}
-void SkDevice::writePixels(const SkBitmap& bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888) {
+void SkBitmapDevice::writePixels(const SkBitmap& bitmap,
+ int x, int y,
+ SkCanvas::Config8888 config8888) {
if (bitmap.isNull() || bitmap.getTexture()) {
return;
}
@@ -328,22 +327,22 @@ void SkDevice::writePixels(const SkBitmap& bitmap,
///////////////////////////////////////////////////////////////////////////////
-void SkDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
+void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
draw.drawPaint(paint);
}
-void SkDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
- const SkPoint pts[], const SkPaint& paint) {
+void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
+ const SkPoint pts[], const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
draw.drawPoints(mode, count, pts, paint);
}
-void SkDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
+void SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
draw.drawRect(r, paint);
}
-void SkDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
+void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
SkPath path;
@@ -353,7 +352,7 @@ void SkDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& p
this->drawPath(draw, path, paint, NULL, true);
}
-void SkDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
+void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
SkPath path;
@@ -363,22 +362,22 @@ void SkDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint
this->drawPath(draw, path, paint, NULL, true);
}
-void SkDevice::drawPath(const SkDraw& draw, const SkPath& path,
- const SkPaint& paint, const SkMatrix* prePathMatrix,
- bool pathIsMutable) {
+void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path,
+ const SkPaint& paint, const SkMatrix* prePathMatrix,
+ bool pathIsMutable) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
draw.drawPath(path, paint, prePathMatrix, pathIsMutable);
}
-void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
- const SkMatrix& matrix, const SkPaint& paint) {
+void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
+ const SkMatrix& matrix, const SkPaint& paint) {
draw.drawBitmap(bitmap, matrix, paint);
}
-void SkDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
- const SkRect* src, const SkRect& dst,
- const SkPaint& paint,
- SkCanvas::DrawBitmapRectFlags flags) {
+void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
+ const SkRect* src, const SkRect& dst,
+ const SkPaint& paint,
+ SkCanvas::DrawBitmapRectFlags flags) {
SkMatrix matrix;
SkRect bitmapBounds, tmpSrc, tmpDst;
SkBitmap tmpBitmap;
@@ -462,56 +461,56 @@ void SkDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
this->drawRect(draw, *dstPtr, paintWithShader);
}
-void SkDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
- int x, int y, const SkPaint& paint) {
+void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
+ int x, int y, const SkPaint& paint) {
draw.drawSprite(bitmap, x, y, paint);
}
-void SkDevice::drawText(const SkDraw& draw, const void* text, size_t len,
- SkScalar x, SkScalar y, const SkPaint& paint) {
+void SkBitmapDevice::drawText(const SkDraw& draw, const void* text, size_t len,
+ SkScalar x, SkScalar y, const SkPaint& paint) {
draw.drawText((const char*)text, len, x, y, paint);
}
-void SkDevice::drawPosText(const SkDraw& draw, const void* text, size_t len,
- const SkScalar xpos[], SkScalar y,
- int scalarsPerPos, const SkPaint& paint) {
+void SkBitmapDevice::drawPosText(const SkDraw& draw, const void* text, size_t len,
+ const SkScalar xpos[], SkScalar y,
+ int scalarsPerPos, const SkPaint& paint) {
draw.drawPosText((const char*)text, len, xpos, y, scalarsPerPos, paint);
}
-void SkDevice::drawTextOnPath(const SkDraw& draw, const void* text,
- size_t len, const SkPath& path,
- const SkMatrix* matrix,
- const SkPaint& paint) {
+void SkBitmapDevice::drawTextOnPath(const SkDraw& draw, const void* text,
+ size_t len, const SkPath& path,
+ const SkMatrix* matrix,
+ const SkPaint& paint) {
draw.drawTextOnPath((const char*)text, len, path, matrix, paint);
}
#ifdef SK_BUILD_FOR_ANDROID
-void SkDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
- const SkPoint pos[], const SkPaint& paint,
- const SkPath& path, const SkMatrix* matrix) {
+void SkBitmapDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
+ const SkPoint pos[], const SkPaint& paint,
+ const SkPath& path, const SkMatrix* matrix) {
draw.drawPosTextOnPath((const char*)text, len, pos, paint, path, matrix);
}
#endif
-void SkDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
- int vertexCount,
- const SkPoint verts[], const SkPoint textures[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
+ int vertexCount,
+ const SkPoint verts[], const SkPoint textures[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode,
indices, indexCount, paint);
}
-void SkDevice::drawDevice(const SkDraw& draw, SkDevice* device,
- int x, int y, const SkPaint& paint) {
+void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
+ int x, int y, const SkPaint& paint) {
const SkBitmap& src = device->accessBitmap(false);
draw.drawSprite(src, x, y, paint);
}
///////////////////////////////////////////////////////////////////////////////
-bool SkDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
+bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
// we're cool with the paint as is
return false;
diff --git a/src/core/SkDeviceImageFilterProxy.h b/src/core/SkDeviceImageFilterProxy.h
index 98a120cd0d..03fcb68125 100644
--- a/src/core/SkDeviceImageFilterProxy.h
+++ b/src/core/SkDeviceImageFilterProxy.h
@@ -12,9 +12,9 @@
class SkDeviceImageFilterProxy : public SkImageFilter::Proxy {
public:
- SkDeviceImageFilterProxy(SkDevice* device) : fDevice(device) {}
+ SkDeviceImageFilterProxy(SkBaseDevice* device) : fDevice(device) {}
- virtual SkDevice* createDevice(int w, int h) SK_OVERRIDE {
+ virtual SkBaseDevice* createDevice(int w, int h) SK_OVERRIDE {
return fDevice->createCompatibleDevice(SkBitmap::kARGB_8888_Config,
w, h, false);
}
@@ -28,7 +28,7 @@ public:
}
private:
- SkDevice* fDevice;
+ SkBaseDevice* fDevice;
};
#endif
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index c94641b09b..1aa45284aa 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -11,9 +11,9 @@
#include "SkPicturePlayback.h"
#include "SkPictureRecord.h"
+#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkChunkAlloc.h"
-#include "SkDevice.h"
#include "SkPicture.h"
#include "SkRegion.h"
#include "SkStream.h"
@@ -205,7 +205,7 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
SkBitmap bm;
bm.setConfig(SkBitmap::kNo_Config, width, height);
- SkAutoTUnref<SkDevice> dev(SkNEW_ARGS(SkDevice, (bm)));
+ SkAutoTUnref<SkBaseDevice> dev(SkNEW_ARGS(SkBitmapDevice, (bm)));
// Must be set before calling createBBoxHierarchy
fWidth = width;
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 4134f8dede..92a1448ee0 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -28,7 +28,7 @@ static const uint32_t kSaveSize = 2 * kUInt32Size;
static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect);
-SkPictureRecord::SkPictureRecord(uint32_t flags, SkDevice* device) :
+SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device) :
INHERITED(device),
fBoundingHierarchy(NULL),
fStateTree(NULL),
@@ -138,7 +138,7 @@ static inline uint32_t getPaintOffset(DrawType op, uint32_t opSize) {
return gPaintOffsets[op] * sizeof(uint32_t) + overflow;
}
-SkDevice* SkPictureRecord::setDevice(SkDevice* device) {
+SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) {
SkDEBUGFAIL("eeek, don't try to change the device on a recording canvas");
return this->INHERITED::setDevice(device);
}
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index b900f4f574..a1eb40ab59 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -30,10 +30,10 @@ class SkBBoxHierarchy;
class SkPictureRecord : public SkCanvas {
public:
- SkPictureRecord(uint32_t recordFlags, SkDevice*);
+ SkPictureRecord(uint32_t recordFlags, SkBaseDevice*);
virtual ~SkPictureRecord();
- virtual SkDevice* setDevice(SkDevice* device) SK_OVERRIDE;
+ virtual SkBaseDevice* setDevice(SkBaseDevice* device) SK_OVERRIDE;
virtual int save(SaveFlags) SK_OVERRIDE;
virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE;
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 79bb6efe26..0881a0ffaa 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -111,7 +111,7 @@ static SkBitmap make_fake_bitmap(int width, int height) {
}
SkXPSDevice::SkXPSDevice()
- : SkDevice(make_fake_bitmap(10000, 10000))
+ : SkBitmapDevice(make_fake_bitmap(10000, 10000))
, fCurrentPage(0) {
}
@@ -2375,7 +2375,7 @@ void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len,
d.drawTextOnPath((const char*)text, len, path, matrix, paint);
}
-void SkXPSDevice::drawDevice(const SkDraw& d, SkDevice* dev,
+void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev,
int x, int y,
const SkPaint&) {
SkXPSDevice* that = static_cast<SkXPSDevice*>(dev);
@@ -2407,11 +2407,11 @@ bool SkXPSDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
return false;
}
-SkDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
- if (SkDevice::kGeneral_Usage == usage) {
+SkBaseDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
+ if (SkBaseDevice::kGeneral_Usage == usage) {
return NULL;
SK_CRASH();
//To what stream do we write?
@@ -2425,7 +2425,7 @@ SkDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
}
SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory)
- : SkDevice(make_fake_bitmap(10000, 10000))
+ : SkBitmapDevice(make_fake_bitmap(10000, 10000))
, fCurrentPage(0) {
HRVM(CoCreateInstance(
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 16a36bb4c1..cfda0b7e75 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -111,7 +111,7 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
return false;
}
- SkAutoTUnref<SkDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
SkCanvas canvas(device.get());
SkPaint paint;
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index b8bbfd6f31..75a86689c0 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -46,7 +46,7 @@ bool SkDropShadowImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc))
return false;
- SkAutoTUnref<SkDevice> device(proxy->createDevice(src.width(), src.height()));
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(src.width(), src.height()));
SkCanvas canvas(device.get());
SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(fSigma, fSigma));
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index 0c1388f944..0c47c91aff 100755
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -109,7 +109,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
const int x0 = bounds.left();
const int y0 = bounds.top();
- SkAutoTUnref<SkDevice> dst(proxy->createDevice(bounds.width(), bounds.height()));
+ SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.height()));
if (NULL == dst) {
return false;
}
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index ada861fd5c..2ee1d4a2ed 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -56,8 +56,8 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
return false;
}
- SkAutoTUnref<SkDevice> device(proxy->createDevice(SkScalarCeilToInt(rect.width()),
- SkScalarCeilToInt(rect.height())));
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(SkScalarCeilToInt(rect.width()),
+ SkScalarCeilToInt(rect.height())));
SkCanvas canvas(device.get());
SkPaint paint;
paint.setShader(fShader);
diff --git a/src/effects/SkTestImageFilters.cpp b/src/effects/SkTestImageFilters.cpp
index a919dedd41..788c33a411 100755
--- a/src/effects/SkTestImageFilters.cpp
+++ b/src/effects/SkTestImageFilters.cpp
@@ -9,11 +9,11 @@
// with the following:
//
// SkCanvas canvas(device);
-// SkAutoTUnref<SkDevice> aur(device);
+// SkAutoTUnref<SkBaseDevice> aur(device);
//
class OwnDeviceCanvas : public SkCanvas {
public:
- OwnDeviceCanvas(SkDevice* device) : SkCanvas(device) {
+ OwnDeviceCanvas(SkBaseDevice* device) : SkCanvas(device) {
SkSafeUnref(device);
}
};
@@ -41,7 +41,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
// downsample
{
- SkDevice* dev = proxy->createDevice(dstW, dstH);
+ SkBaseDevice* dev = proxy->createDevice(dstW, dstH);
if (NULL == dev) {
return false;
}
@@ -56,7 +56,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
// upscale
{
- SkDevice* dev = proxy->createDevice(src.width(), src.height());
+ SkBaseDevice* dev = proxy->createDevice(src.width(), src.height());
if (NULL == dev) {
return false;
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index f77fdf70a8..571b8a0a7d 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -161,12 +161,12 @@ SkGpuDevice* SkGpuDevice::Create(GrSurface* surface) {
}
SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture)
-: SkDevice(make_bitmap(context, texture->asRenderTarget())) {
+ : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
this->initFromRenderTarget(context, texture->asRenderTarget(), false);
}
SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget)
-: SkDevice(make_bitmap(context, renderTarget)) {
+ : SkBitmapDevice(make_bitmap(context, renderTarget)) {
this->initFromRenderTarget(context, renderTarget, false);
}
@@ -203,7 +203,7 @@ SkGpuDevice::SkGpuDevice(GrContext* context,
int width,
int height,
int sampleCount)
- : SkDevice(config, width, height, false /*isOpaque*/) {
+ : SkBitmapDevice(config, width, height, false /*isOpaque*/) {
fDrawProcs = NULL;
@@ -1436,7 +1436,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
fContext->drawRectToRect(grPaint, dstRect, paintRect, &m);
}
-static bool filter_texture(SkDevice* device, GrContext* context,
+static bool filter_texture(SkBaseDevice* device, GrContext* context,
GrTexture* texture, SkImageFilter* filter,
int w, int h, const SkMatrix& ctm, SkBitmap* result,
SkIPoint* offset) {
@@ -1537,7 +1537,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
this->drawBitmapCommon(draw, bitmap, &tmpSrc, matrix, paint, flags);
}
-void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device,
+void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
int x, int y, const SkPaint& paint) {
// clear of the source device must occur before CHECK_SHOULD_DRAW
SkGpuDevice* dev = static_cast<SkGpuDevice*>(device);
@@ -1822,10 +1822,10 @@ void SkGpuDevice::flush() {
///////////////////////////////////////////////////////////////////////////////
-SkDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
+SkBaseDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
GrTextureDesc desc;
desc.fConfig = fRenderTarget->config();
desc.fFlags = kRenderTarget_GrTextureFlagBit;
@@ -1858,7 +1858,7 @@ SkDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
SkGpuDevice::SkGpuDevice(GrContext* context,
GrTexture* texture,
bool needClear)
- : SkDevice(make_bitmap(context, texture->asRenderTarget())) {
+ : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
SkASSERT(texture && texture->asRenderTarget());
// This constructor is called from onCreateCompatibleDevice. It has locked the RT in the texture
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index a24c4ecd8a..02dda02451 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -566,10 +566,10 @@ void GraphicStackState::updateDrawingState(const GraphicStateEntry& state) {
}
}
-SkDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
+SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
SkMatrix initialTransform;
initialTransform.reset();
SkISize size = SkISize::Make(width, height);
@@ -672,7 +672,7 @@ static inline SkBitmap makeContentBitmap(const SkISize& contentSize,
// TODO(vandebo) change pageSize to SkSize.
SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
const SkMatrix& initialTransform)
- : SkDevice(makeContentBitmap(contentSize, &initialTransform)),
+ : SkBitmapDevice(makeContentBitmap(contentSize, &initialTransform)),
fPageSize(pageSize),
fContentSize(contentSize),
fLastContentEntry(NULL),
@@ -696,7 +696,7 @@ SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
SkPDFDevice::SkPDFDevice(const SkISize& layerSize,
const SkClipStack& existingClipStack,
const SkRegion& existingClipRegion)
- : SkDevice(makeContentBitmap(layerSize, NULL)),
+ : SkBitmapDevice(makeContentBitmap(layerSize, NULL)),
fPageSize(layerSize),
fContentSize(layerSize),
fExistingClipStack(existingClipStack),
@@ -1153,11 +1153,11 @@ void SkPDFDevice::drawVertices(const SkDraw& d, SkCanvas::VertexMode,
NOT_IMPLEMENTED("drawVerticies", true);
}
-void SkPDFDevice::drawDevice(const SkDraw& d, SkDevice* device, int x, int y,
+void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device, int x, int y,
const SkPaint& paint) {
if ((device->getDeviceCapabilities() & kVector_Capability) == 0) {
// If we somehow get a raster device, do what our parent would do.
- SkDevice::drawDevice(d, device, x, y, paint);
+ INHERITED::drawDevice(d, device, x, y, paint);
return;
}
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index f646babda5..58ba102988 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -7,12 +7,12 @@
*/
#include "SkAnnotation.h"
+#include "SkBitmapDevice.h"
#include "SkBitmapHeap.h"
#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkData.h"
#include "SkDrawLooper.h"
-#include "SkDevice.h"
#include "SkGPipe.h"
#include "SkGPipePriv.h"
#include "SkImageFilter.h"
@@ -432,7 +432,7 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
// We don't allocate pixels for the bitmap
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
- SkDevice* device = SkNEW_ARGS(SkDevice, (bitmap));
+ SkBaseDevice* device = SkNEW_ARGS(SkBitmapDevice, (bitmap));
this->setDevice(device)->unref();
// Tell the reader the appropriate flags to use.
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp
index a23d77537c..1e25cb61c4 100644
--- a/src/pipe/utils/SamplePipeControllers.cpp
+++ b/src/pipe/utils/SamplePipeControllers.cpp
@@ -7,8 +7,8 @@
#include "SamplePipeControllers.h"
+#include "SkBitmapDevice.h"
#include "SkCanvas.h"
-#include "SkDevice.h"
#include "SkGPipe.h"
#include "SkMatrix.h"
@@ -55,7 +55,7 @@ TiledPipeController::TiledPipeController(const SkBitmap& bitmap,
SkDEBUGCODE(bool extracted = )bitmap.extractSubset(&fBitmaps[i], rect);
SkASSERT(extracted);
- SkDevice* device = new SkDevice(fBitmaps[i]);
+ SkBaseDevice* device = new SkBitmapDevice(fBitmaps[i]);
SkCanvas* canvas = new SkCanvas(device);
device->unref();
if (initial != NULL) {
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index e3b761f0e0..4509038eb0 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -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 @@ void DeferredPipeController::playback(bool silent) {
//-----------------------------------------------------------------------------
// 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 @@ public:
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 @@ protected:
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 @@ private:
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(SkDevice* immediateDevice)
}
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 @@ void DeferredDevice::writePixels(const SkBitmap& bitmap,
}
}
-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 @@ SkDeferredCanvas* SkDeferredCanvas::Create(SkSurface* surface) {
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));
}
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index 45d3f1b23a..ce51614654 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
-#include "SkPictureUtils.h"
+#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkData.h"
-#include "SkDevice.h"
+#include "SkPictureUtils.h"
#include "SkPixelRef.h"
-#include "SkShader.h"
#include "SkRRect.h"
+#include "SkShader.h"
class PixelRefSet {
public:
@@ -47,7 +47,7 @@ static void nothing_to_do() {}
* It should never actually draw anything, so there need not be any pixels
* behind its device-bitmap.
*/
-class GatherPixelRefDevice : public SkDevice {
+class GatherPixelRefDevice : public SkBitmapDevice {
private:
PixelRefSet* fPRSet;
@@ -70,7 +70,7 @@ private:
}
public:
- GatherPixelRefDevice(const SkBitmap& bm, PixelRefSet* prset) : SkDevice(bm) {
+ GatherPixelRefDevice(const SkBitmap& bm, PixelRefSet* prset) : SkBitmapDevice(bm) {
fPRSet = prset;
}
@@ -138,7 +138,7 @@ public:
const SkPaint& paint) SK_OVERRIDE {
this->addBitmapFromPaint(paint);
}
- virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
+ virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
const SkPaint&) SK_OVERRIDE {
nothing_to_do();
}
@@ -150,11 +150,14 @@ protected:
not_supported();
return false;
}
+
+private:
+ typedef SkBitmapDevice INHERITED;
};
class NoSaveLayerCanvas : public SkCanvas {
public:
- NoSaveLayerCanvas(SkDevice* device) : INHERITED(device) {}
+ NoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
// turn saveLayer() into save() for speed, should not affect correctness.
virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,