diff options
-rw-r--r-- | include/core/SkBitmapDevice.h | 2 | ||||
-rw-r--r-- | include/core/SkDevice.h | 12 | ||||
-rw-r--r-- | include/pdf/SkPDFDevice.h | 2 | ||||
-rw-r--r-- | src/core/SkBitmapDevice.cpp | 4 | ||||
-rw-r--r-- | src/core/SkDevice.cpp | 6 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 12 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.h | 2 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 8 | ||||
-rw-r--r-- | src/utils/SkDeferredCanvas.cpp | 8 | ||||
-rw-r--r-- | src/utils/SkPictureUtils.cpp | 6 |
10 files changed, 25 insertions, 37 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h index d9b9a04657..8b87fc88de 100644 --- a/include/core/SkBitmapDevice.h +++ b/include/core/SkBitmapDevice.h @@ -153,7 +153,7 @@ private: // any clip information. virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE; - virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; + virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE; virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 1e39e00526..4a61321ff7 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -340,17 +340,6 @@ protected: void setPixelGeometry(SkPixelGeometry geo); - struct CreateInfo { - CreateInfo(const SkImageInfo& info, Usage usage) : fInfo(info), fUsage(usage) {} - - SkImageInfo fInfo; - Usage fUsage; - }; - virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo& cinfo) { - // call deprecated method until we can update chrome's subclasses - return this->onCreateDevice(cinfo.fInfo, cinfo.fUsage); - } - private: friend class SkCanvas; friend struct DeviceCM; //for setMatrixClip @@ -377,7 +366,6 @@ private: // just called by SkCanvas for imagefilter SkBaseDevice* createCompatibleDeviceForImageFilter(const SkImageInfo&); - // DEPRECATED -- override onCreateCompatibleDevice instead. virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) { return NULL; } diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h index 1e09b72b06..f6f782b99a 100644 --- a/include/pdf/SkPDFDevice.h +++ b/include/pdf/SkPDFDevice.h @@ -259,7 +259,7 @@ private: const SkRegion& existingClipRegion); // override from SkBaseDevice - virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; + virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; void init(); void cleanUp(bool clearFontUsage); diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 0c28feadfc..cc4155a29f 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -111,8 +111,8 @@ void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { fBitmap.lockPixels(); } -SkBaseDevice* SkBitmapDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) { - return SkBitmapDevice::Create(cinfo.fInfo);// &this->getDeviceProperties()); +SkBaseDevice* SkBitmapDevice::onCreateDevice(const SkImageInfo& info, Usage usage) { + return SkBitmapDevice::Create(info);// &this->getDeviceProperties()); } void SkBitmapDevice::lockPixels() { diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 20219a491a..3d5000f569 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -29,15 +29,15 @@ SkBaseDevice::~SkBaseDevice() { } SkBaseDevice* SkBaseDevice::createCompatibleDevice(const SkImageInfo& info) { - return this->onCreateCompatibleDevice(CreateInfo(info, kGeneral_Usage)); + return this->onCreateDevice(info, kGeneral_Usage); } SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(const SkImageInfo& info) { - return this->onCreateCompatibleDevice(CreateInfo(info, kSaveLayer_Usage)); + return this->onCreateDevice(info, kSaveLayer_Usage); } SkBaseDevice* SkBaseDevice::createCompatibleDeviceForImageFilter(const SkImageInfo& info) { - return this->onCreateCompatibleDevice(CreateInfo(info, kImageFilter_Usage)); + return this->onCreateDevice(info, kImageFilter_Usage); } SkMetaData& SkBaseDevice::getMetaData() { diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index d04d2d8185..124f994612 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1751,24 +1751,24 @@ void SkGpuDevice::flush() { /////////////////////////////////////////////////////////////////////////////// -SkBaseDevice* SkGpuDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) { +SkBaseDevice* SkGpuDevice::onCreateDevice(const SkImageInfo& info, Usage usage) { GrSurfaceDesc desc; desc.fConfig = fRenderTarget->config(); desc.fFlags = kRenderTarget_GrSurfaceFlag; - desc.fWidth = cinfo.fInfo.width(); - desc.fHeight = cinfo.fInfo.height(); + desc.fWidth = info.width(); + desc.fHeight = info.height(); desc.fSampleCnt = fRenderTarget->numSamples(); SkAutoTUnref<GrTexture> texture; // Skia's convention is to only clear a device if it is non-opaque. - unsigned flags = cinfo.fInfo.isOpaque() ? 0 : kNeedClear_Flag; + unsigned flags = info.isOpaque() ? 0 : kNeedClear_Flag; // If we're using distance field text, enable in the new device flags |= (fFlags & kDFText_Flag) ? kDFText_Flag : 0; #if CACHE_COMPATIBLE_DEVICE_TEXTURES // layers are never draw in repeat modes, so we can request an approx // match and ignore any padding. - const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == cinfo.fUsage) ? + const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == usage) ? GrContext::kApprox_ScratchTexMatch : GrContext::kExact_ScratchTexMatch; texture.reset(fContext->refScratchTexture(desc, match)); @@ -1779,7 +1779,7 @@ SkBaseDevice* SkGpuDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) { return SkGpuDevice::Create(texture, SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType), flags); } else { SkDebugf("---- failed to create compatible device texture [%d %d]\n", - cinfo.fInfo.width(), cinfo.fInfo.height()); + info.width(), info.height()); return NULL; } } diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index d90ecbcdff..f7ff8c82a4 100644 --- a/src/gpu/SkGpuDevice.h +++ b/src/gpu/SkGpuDevice.h @@ -142,7 +142,7 @@ private: SkGpuDevice(GrSurface*, const SkSurfaceProps&, unsigned flags = 0); - virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; + virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE; diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 4395daca16..b14ca72902 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -567,19 +567,19 @@ void GraphicStackState::updateDrawingState(const GraphicStateEntry& state) { } } -SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) { +SkBaseDevice* SkPDFDevice::onCreateDevice(const SkImageInfo& info, Usage usage) { // PDF does not support image filters, so render them on CPU. // Note that this rendering is done at "screen" resolution (100dpi), not // printer resolution. // FIXME: It may be possible to express some filters natively using PDF // to improve quality and file size (http://skbug.com/3043) - if (kImageFilter_Usage == cinfo.fUsage) { - return SkBitmapDevice::Create(cinfo.fInfo); + if (kImageFilter_Usage == usage) { + return SkBitmapDevice::Create(info); } SkMatrix initialTransform; initialTransform.reset(); - SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); + SkISize size = SkISize::Make(info.width(), info.height()); return SkNEW_ARGS(SkPDFDevice, (size, size, initialTransform)); } diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index c8216e4690..06f7bb089a 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -159,7 +159,7 @@ public: virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE; - virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; + virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE; @@ -463,15 +463,15 @@ const SkBitmap& SkDeferredDevice::onAccessBitmap() { return immediateDevice()->accessBitmap(false); } -SkBaseDevice* SkDeferredDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) { +SkBaseDevice* SkDeferredDevice::onCreateDevice(const SkImageInfo& info, Usage usage) { // Save layer usage not supported, and not required by SkDeferredCanvas. - SkASSERT(cinfo.fUsage != kSaveLayer_Usage); + SkASSERT(usage != kSaveLayer_Usage); // Create a compatible non-deferred device. // We do not create a deferred device because we know the new device // will not be used with a deferred canvas (there is no API for that). // And connecting a SkDeferredDevice to non-deferred canvas can result // in unpredictable behavior. - return immediateDevice()->onCreateCompatibleDevice(cinfo); + return immediateDevice()->createCompatibleDevice(info); } SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) { diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index 3127497ff0..391e5ffc79 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp @@ -157,10 +157,10 @@ protected: virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE { not_supported(); } - virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo& cinfo) SK_OVERRIDE { + virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) SK_OVERRIDE { // we expect to only get called via savelayer, in which case it is fine. - SkASSERT(kSaveLayer_Usage == cinfo.fUsage); - return SkNEW_ARGS(GatherPixelRefDevice, (cinfo.fInfo.width(), cinfo.fInfo.height(), fPRSet)); + SkASSERT(kSaveLayer_Usage == usage); + return SkNEW_ARGS(GatherPixelRefDevice, (info.width(), info.height(), fPRSet)); } virtual void flush() SK_OVERRIDE {} |