diff options
author | reed <reed@chromium.org> | 2014-11-13 03:31:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-13 03:31:41 -0800 |
commit | 5adbf1b57988eaad84d6615395c90a08b7ea225a (patch) | |
tree | 5a3622bb3157de41b5b5ec7d8a2e79891f5534ad /src | |
parent | 8113dd13692bc2e1fe804141d04b2cc5f03a55be (diff) |
Revert of move to modify onCreateDevice virtual (patchset #2 id:20001 of https://codereview.chromium.org/723743002/)
Reason for revert:
mac_chromium_rel_ng unittest failures. speculating caused by this cl.
http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/5262
Original issue's description:
> start to replace onCreateDevice with onCreateCompatibleDevice
>
> the new virtual takes a struct which we can amend in the future w/o having to
> update our subclasses in chrome.
>
> BUG=skia:
> NOTRY=True
>
> Committed: https://skia.googlesource.com/skia/+/b122ee50fb56cf6669fe1668b82c8815896e9943
TBR=fmalita@google.com,fmalita@chromium.org,reed@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/728433002
Diffstat (limited to 'src')
-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 |
7 files changed, 23 insertions, 23 deletions
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 {} |