diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBBoxHierarchyRecord.cpp | 2 | ||||
-rw-r--r-- | src/core/SkBBoxHierarchyRecord.h | 2 | ||||
-rw-r--r-- | src/core/SkBBoxRecord.h | 2 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 58 | ||||
-rw-r--r-- | src/core/SkDevice.cpp | 202 | ||||
-rw-r--r-- | src/core/SkDeviceImageFilterProxy.h | 6 | ||||
-rw-r--r-- | src/core/SkPicture.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 4 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 4 |
9 files changed, 142 insertions, 140 deletions
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp index 61a82cef3d..9c02468ae1 100644 --- a/src/core/SkBBoxHierarchyRecord.cpp +++ b/src/core/SkBBoxHierarchyRecord.cpp @@ -11,7 +11,7 @@ SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags, SkBBoxHierarchy* h, - SkBaseDevice* device) + SkDevice* device) : INHERITED(recordFlags, device) { fStateTree = SkNEW(SkPictureStateTree); fBoundingHierarchy = h; diff --git a/src/core/SkBBoxHierarchyRecord.h b/src/core/SkBBoxHierarchyRecord.h index 7284ab04ec..27da3c9188 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, - SkBaseDevice*); + SkDevice*); virtual void handleBBox(const SkRect& bounds) SK_OVERRIDE; diff --git a/src/core/SkBBoxRecord.h b/src/core/SkBBoxRecord.h index fa8b282247..7859df1b02 100644 --- a/src/core/SkBBoxRecord.h +++ b/src/core/SkBBoxRecord.h @@ -19,7 +19,7 @@ class SkBBoxRecord : public SkPictureRecord { public: - SkBBoxRecord(uint32_t recordFlags, SkBaseDevice* device) + SkBBoxRecord(uint32_t recordFlags, SkDevice* device) : INHERITED(recordFlags, device) { } virtual ~SkBBoxRecord() { } diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index a8a1d99662..c59cd04016 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -129,7 +129,7 @@ void SkCanvas::predrawNotify() { /////////////////////////////////////////////////////////////////////////////// -/* This is the record we keep for each SkBaseDevice that the user installs. +/* This is the record we keep for each SkDevice 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; - SkBaseDevice* fDevice; + SkDevice* fDevice; SkRasterClip fClip; const SkMatrix* fMatrix; SkPaint* fPaint; // may be null (in the future) - DeviceCM(SkBaseDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas) + DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas) : fNext(NULL) { if (NULL != device) { device->ref(); @@ -315,7 +315,7 @@ public: return false; } - SkBaseDevice* getDevice() const { return fDevice; } + SkDevice* 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: //////////////////////////////////////////////////////////////////////////// -SkBaseDevice* SkCanvas::init(SkBaseDevice* device) { +SkDevice* SkCanvas::init(SkDevice* device) { fBounder = NULL; fLocalBoundsCompareType.setEmpty(); fLocalBoundsCompareTypeDirty = true; @@ -511,7 +511,7 @@ SkCanvas::SkCanvas() this->init(NULL); } -SkCanvas::SkCanvas(SkBaseDevice* device) +SkCanvas::SkCanvas(SkDevice* 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(SkBitmapDevice, (bitmap)))->unref(); + this->init(SkNEW_ARGS(SkDevice, (bitmap)))->unref(); } SkCanvas::~SkCanvas() { @@ -564,37 +564,37 @@ SkMetaData& SkCanvas::getMetaData() { /////////////////////////////////////////////////////////////////////////////// void SkCanvas::flush() { - SkBaseDevice* device = this->getDevice(); + SkDevice* device = this->getDevice(); if (device) { device->flush(); } } SkISize SkCanvas::getDeviceSize() const { - SkBaseDevice* d = this->getDevice(); + SkDevice* d = this->getDevice(); return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0); } -SkBaseDevice* SkCanvas::getDevice() const { +SkDevice* SkCanvas::getDevice() const { // return root device MCRec* rec = (MCRec*) fMCStack.front(); SkASSERT(rec && rec->fLayer); return rec->fLayer->fDevice; } -SkBaseDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const { +SkDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const { if (updateMatrixClip) { const_cast<SkCanvas*>(this)->updateDeviceCMCache(); } return fMCRec->fTopLayer->fDevice; } -SkBaseDevice* SkCanvas::setDevice(SkBaseDevice* device) { +SkDevice* SkCanvas::setDevice(SkDevice* device) { // return root device SkDeque::F2BIter iter(fMCStack); MCRec* rec = (MCRec*)iter.next(); SkASSERT(rec && rec->fLayer); - SkBaseDevice* rootDevice = rec->fLayer->fDevice; + SkDevice* rootDevice = rec->fLayer->fDevice; if (rootDevice == device) { return device; @@ -644,7 +644,7 @@ SkBaseDevice* SkCanvas::setDevice(SkBaseDevice* device) { bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y, Config8888 config8888) { - SkBaseDevice* device = this->getDevice(); + SkDevice* device = this->getDevice(); if (!device) { return false; } @@ -652,7 +652,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, } bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) { - SkBaseDevice* device = this->getDevice(); + SkDevice* 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) { - SkBaseDevice* device = this->getDevice(); + SkDevice* 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) { - SkBaseDevice* device = canvas->getLayerDevice(i); + SkDevice* 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); - SkBaseDevice* device; + SkDevice* 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(SkBaseDevice* srcDev, int x, int y, +void SkCanvas::internalDrawDevice(SkDevice* srcDev, int x, int y, const SkPaint* paint) { SkPaint tmp; if (NULL == paint) { @@ -991,7 +991,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) while (iter.next()) { - SkBaseDevice* dstDev = iter.fDevice; + SkDevice* dstDev = iter.fDevice; paint = &looper.paint(); SkImageFilter* filter = paint->getImageFilter(); SkIPoint pos = { x - iter.getX(), y - iter.getY() }; @@ -1164,7 +1164,7 @@ static bool clipPathHelper(const SkCanvas* canvas, SkRasterClip* currClip, return currClip->op(clip, op); } } else { - const SkBaseDevice* device = canvas->getDevice(); + const SkDevice* device = canvas->getDevice(); if (!device) { return currClip->setEmpty(); } @@ -1358,7 +1358,7 @@ bool SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) { #ifdef SK_DEBUG void SkCanvas::validateClip() const { // construct clipRgn from the clipstack - const SkBaseDevice* device = this->getDevice(); + const SkDevice* device = this->getDevice(); if (!device) { SkASSERT(this->getTotalClip().isEmpty()); return; @@ -1543,10 +1543,10 @@ const SkRegion& SkCanvas::getTotalClip() const { return fMCRec->fRasterClip->forceGetBW(); } -SkBaseDevice* SkCanvas::createLayerDevice(SkBitmap::Config config, +SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config, int width, int height, bool isOpaque) { - SkBaseDevice* device = this->getTopDevice(); + SkDevice* device = this->getTopDevice(); if (device) { return device->createCompatibleDeviceForSaveLayer(config, width, height, isOpaque); @@ -1555,10 +1555,10 @@ SkBaseDevice* SkCanvas::createLayerDevice(SkBitmap::Config config, } } -SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config, +SkDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config, int width, int height, bool isOpaque) { - SkBaseDevice* device = this->getDevice(); + SkDevice* device = this->getDevice(); if (device) { return device->createCompatibleDevice(config, width, height, isOpaque); } else { @@ -1874,8 +1874,8 @@ void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, class SkDeviceFilteredPaint { public: - SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) { - SkBaseDevice::TextFlags flags; + SkDeviceFilteredPaint(SkDevice* device, const SkPaint& paint) { + SkDevice::TextFlags flags; if (device->filterTextFlags(paint, &flags)) { SkPaint* newPaint = fLazy.set(paint); newPaint->setFlags(flags.fFlags); @@ -2203,7 +2203,7 @@ void SkCanvas::LayerIter::next() { fDone = !fImpl->next(); } -SkBaseDevice* SkCanvas::LayerIter::device() const { +SkDevice* SkCanvas::LayerIter::device() const { return fImpl->getDevice(); } diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 428c9cae37..d06f6e677d 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -15,8 +15,7 @@ #include "SkRRect.h" #include "SkShader.h" -SK_DEFINE_INST_COUNT(SkBaseDevice) -SK_DEFINE_INST_COUNT(SkBitmapDevice) +SK_DEFINE_INST_COUNT(SkDevice) /////////////////////////////////////////////////////////////////////////////// @@ -25,13 +24,20 @@ SK_DEFINE_INST_COUNT(SkBitmapDevice) /////////////////////////////////////////////////////////////////////////////// -SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) - : fBitmap(bitmap) { +SkDevice::SkDevice(const SkBitmap& bitmap) + : fBitmap(bitmap), fLeakyProperties(SkDeviceProperties::MakeDefault()) +#ifdef SK_DEBUG + , fAttachedToCanvas(false) +#endif +{ + fOrigin.setZero(); + fMetaData = NULL; + SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config()); } -SkBaseDevice::SkBaseDevice() - : fLeakyProperties(SkDeviceProperties::MakeDefault()) +SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties) + : fBitmap(bitmap), fLeakyProperties(deviceProperties) #ifdef SK_DEBUG , fAttachedToCanvas(false) #endif @@ -40,22 +46,15 @@ SkBaseDevice::SkBaseDevice() fMetaData = NULL; } -SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties) - : SkBaseDevice(deviceProperties) - , fBitmap(bitmap) { -} - -SkBaseDevice::SkBaseDevice(const SkDeviceProperties& deviceProperties) - : fLeakyProperties(deviceProperties) +SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque) + : fLeakyProperties(SkDeviceProperties::MakeDefault()) #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); @@ -64,9 +63,15 @@ SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b } } -SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque, - const SkDeviceProperties& deviceProperties) - : SkBaseDevice(deviceProperties) { +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; fBitmap.setConfig(config, width, height); fBitmap.allocPixels(); @@ -76,43 +81,39 @@ SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b } } -SkBaseDevice::~SkBaseDevice() { +SkDevice::~SkDevice() { delete fMetaData; } -SkBitmapDevice::~SkBitmapDevice() { -} - -void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { +void SkDevice::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(); } -SkBaseDevice* SkBaseDevice::createCompatibleDevice(SkBitmap::Config config, - int width, int height, - bool isOpaque) { +SkDevice* SkDevice::createCompatibleDevice(SkBitmap::Config config, + int width, int height, + bool isOpaque) { return this->onCreateCompatibleDevice(config, width, height, isOpaque, kGeneral_Usage); } -SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config, - int width, int height, - bool isOpaque) { +SkDevice* SkDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config, + int width, int height, + bool isOpaque) { return this->onCreateCompatibleDevice(config, width, height, isOpaque, kSaveLayer_Usage); } -SkBaseDevice* SkBitmapDevice::onCreateCompatibleDevice(SkBitmap::Config config, - int width, int height, - bool isOpaque, - Usage usage) { - return SkNEW_ARGS(SkBitmapDevice,(config, width, height, isOpaque, - this->getDeviceProperties())); +SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config, + int width, int height, + bool isOpaque, + Usage usage) { + return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque, fLeakyProperties)); } -SkMetaData& SkBaseDevice::getMetaData() { +SkMetaData& SkDevice::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) { @@ -121,60 +122,61 @@ SkMetaData& SkBaseDevice::getMetaData() { return *fMetaData; } -void SkBitmapDevice::lockPixels() { +void SkDevice::lockPixels() { if (fBitmap.lockPixelsAreWritable()) { fBitmap.lockPixels(); } } -void SkBitmapDevice::unlockPixels() { +void SkDevice::unlockPixels() { if (fBitmap.lockPixelsAreWritable()) { fBitmap.unlockPixels(); } } -const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { - const SkBitmap& bitmap = this->onAccessBitmap(); +const SkBitmap& SkDevice::accessBitmap(bool changePixels) { + const SkBitmap& bitmap = this->onAccessBitmap(&fBitmap); if (changePixels) { bitmap.notifyPixelsChanged(); } return bitmap; } -void SkBitmapDevice::getGlobalBounds(SkIRect* bounds) const { +void SkDevice::getGlobalBounds(SkIRect* bounds) const { if (bounds) { - const SkIPoint& origin = this->getOrigin(); - bounds->setXYWH(origin.x(), origin.y(), + bounds->setXYWH(fOrigin.x(), fOrigin.y(), fBitmap.width(), fBitmap.height()); } } -void SkBitmapDevice::clear(SkColor color) { +void SkDevice::clear(SkColor color) { fBitmap.eraseColor(color); } -const SkBitmap& SkBitmapDevice::onAccessBitmap() { - return fBitmap; +const SkBitmap& SkDevice::onAccessBitmap(SkBitmap* bitmap) {return *bitmap;} + +void SkDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& region, + const SkClipStack& clipStack) { } -bool SkBitmapDevice::canHandleImageFilter(SkImageFilter*) { +bool SkDevice::canHandleImageFilter(SkImageFilter*) { return false; } -bool SkBitmapDevice::filterImage(SkImageFilter* filter, const SkBitmap& src, - const SkMatrix& ctm, SkBitmap* result, - SkIPoint* offset) { +bool SkDevice::filterImage(SkImageFilter* filter, const SkBitmap& src, + const SkMatrix& ctm, SkBitmap* result, + SkIPoint* offset) { return false; } -bool SkBitmapDevice::allowImageFilter(SkImageFilter*) { +bool SkDevice::allowImageFilter(SkImageFilter*) { return true; } /////////////////////////////////////////////////////////////////////////////// -bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, - SkCanvas::Config8888 config8888) { +bool SkDevice::readPixels(SkBitmap* bitmap, int x, int y, + SkCanvas::Config8888 config8888) { if (SkBitmap::kARGB_8888_Config != bitmap->config() || NULL != bitmap->getTexture()) { return false; @@ -218,21 +220,21 @@ bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, } #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) - const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias = + const SkCanvas::Config8888 SkDevice::kPMColorAlias = SkCanvas::kBGRA_Premul_Config8888; #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) - const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias = + const SkCanvas::Config8888 SkDevice::kPMColorAlias = SkCanvas::kRGBA_Premul_Config8888; #else - const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias = + const SkCanvas::Config8888 SkDevice::kPMColorAlias = (SkCanvas::Config8888) -1; #endif #include <SkConfig8888.h> -bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) { +bool SkDevice::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()))); @@ -255,9 +257,9 @@ bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap, return true; } -void SkBitmapDevice::writePixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) { +void SkDevice::writePixels(const SkBitmap& bitmap, + int x, int y, + SkCanvas::Config8888 config8888) { if (bitmap.isNull() || bitmap.getTexture()) { return; } @@ -326,22 +328,22 @@ void SkBitmapDevice::writePixels(const SkBitmap& bitmap, /////////////////////////////////////////////////////////////////////////////// -void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { +void SkDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { draw.drawPaint(paint); } -void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count, - const SkPoint pts[], const SkPaint& paint) { +void SkDevice::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 SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) { +void SkDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) { CHECK_FOR_NODRAW_ANNOTATION(paint); draw.drawRect(r, paint); } -void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { +void SkDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { CHECK_FOR_NODRAW_ANNOTATION(paint); SkPath path; @@ -351,7 +353,7 @@ void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPa this->drawPath(draw, path, paint, NULL, true); } -void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) { +void SkDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) { CHECK_FOR_NODRAW_ANNOTATION(paint); SkPath path; @@ -361,22 +363,22 @@ void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const S this->drawPath(draw, path, paint, NULL, true); } -void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, - const SkPaint& paint, const SkMatrix* prePathMatrix, - bool pathIsMutable) { +void SkDevice::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 SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, - const SkMatrix& matrix, const SkPaint& paint) { +void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, + const SkMatrix& matrix, const SkPaint& paint) { draw.drawBitmap(bitmap, matrix, paint); } -void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, - const SkRect* src, const SkRect& dst, - const SkPaint& paint, - SkCanvas::DrawBitmapRectFlags flags) { +void SkDevice::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; @@ -460,56 +462,56 @@ void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, this->drawRect(draw, *dstPtr, paintWithShader); } -void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, - int x, int y, const SkPaint& paint) { +void SkDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, + int x, int y, const SkPaint& paint) { draw.drawSprite(bitmap, x, y, paint); } -void SkBitmapDevice::drawText(const SkDraw& draw, const void* text, size_t len, - SkScalar x, SkScalar y, const SkPaint& paint) { +void SkDevice::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 SkBitmapDevice::drawPosText(const SkDraw& draw, const void* text, size_t len, - const SkScalar xpos[], SkScalar y, - int scalarsPerPos, const SkPaint& paint) { +void SkDevice::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 SkBitmapDevice::drawTextOnPath(const SkDraw& draw, const void* text, - size_t len, const SkPath& path, - const SkMatrix* matrix, - const SkPaint& paint) { +void SkDevice::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 SkBitmapDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len, - const SkPoint pos[], const SkPaint& paint, - const SkPath& path, const SkMatrix* matrix) { +void SkDevice::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 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) { +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) { draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode, indices, indexCount, paint); } -void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, - int x, int y, const SkPaint& paint) { +void SkDevice::drawDevice(const SkDraw& draw, SkDevice* device, + int x, int y, const SkPaint& paint) { const SkBitmap& src = device->accessBitmap(false); draw.drawSprite(src, x, y, paint); } /////////////////////////////////////////////////////////////////////////////// -bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { +bool SkDevice::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 03fcb68125..98a120cd0d 100644 --- a/src/core/SkDeviceImageFilterProxy.h +++ b/src/core/SkDeviceImageFilterProxy.h @@ -12,9 +12,9 @@ class SkDeviceImageFilterProxy : public SkImageFilter::Proxy { public: - SkDeviceImageFilterProxy(SkBaseDevice* device) : fDevice(device) {} + SkDeviceImageFilterProxy(SkDevice* device) : fDevice(device) {} - virtual SkBaseDevice* createDevice(int w, int h) SK_OVERRIDE { + virtual SkDevice* createDevice(int w, int h) SK_OVERRIDE { return fDevice->createCompatibleDevice(SkBitmap::kARGB_8888_Config, w, h, false); } @@ -28,7 +28,7 @@ public: } private: - SkBaseDevice* fDevice; + SkDevice* fDevice; }; #endif diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index 416b9127ca..097e0ea0c7 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -205,7 +205,7 @@ SkCanvas* SkPicture::beginRecording(int width, int height, SkBitmap bm; bm.setConfig(SkBitmap::kNo_Config, width, height); - SkAutoTUnref<SkBaseDevice> dev(SkNEW_ARGS(SkBitmapDevice, (bm))); + SkAutoTUnref<SkDevice> dev(SkNEW_ARGS(SkDevice, (bm))); // Must be set before calling createBBoxHierarchy fWidth = width; diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index ea1a40f731..0ec9eaf74d 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, SkBaseDevice* device) : +SkPictureRecord::SkPictureRecord(uint32_t flags, SkDevice* 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; } -SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) { +SkDevice* SkPictureRecord::setDevice(SkDevice* device) { SkASSERT(!"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 34cd9255ec..51547a4741 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, SkBaseDevice*); + SkPictureRecord(uint32_t recordFlags, SkDevice*); virtual ~SkPictureRecord(); - virtual SkBaseDevice* setDevice(SkBaseDevice* device) SK_OVERRIDE; + virtual SkDevice* setDevice(SkDevice* device) SK_OVERRIDE; virtual int save(SaveFlags) SK_OVERRIDE; virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE; |