diff options
author | Mike Reed <reed@google.com> | 2016-10-31 15:11:04 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-31 19:35:15 +0000 |
commit | 09d9435835f48b06954904f16d14c1c2eeaaad2e (patch) | |
tree | 717ad84a3204cdb81646e0d9dee23977965ce2e5 /src | |
parent | fc49b403eb3353fdefe97672017df10b64dee95a (diff) |
remove lots of legacy flags
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4209
Change-Id: I49ae36a9b2bb51a6470638d3264923ff4a4dea0a
Reviewed-on: https://skia-review.googlesource.com/4209
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkCanvas.cpp | 22 | ||||
-rw-r--r-- | src/core/SkPaint.cpp | 42 | ||||
-rw-r--r-- | src/core/SkPicture.cpp | 25 | ||||
-rw-r--r-- | src/core/SkStream.cpp | 11 | ||||
-rw-r--r-- | src/effects/SkArithmeticModePriv.h | 4 | ||||
-rw-r--r-- | src/effects/SkEmbossMaskFilter.cpp | 9 | ||||
-rw-r--r-- | src/effects/SkXfermodeImageFilter.cpp | 10 | ||||
-rw-r--r-- | src/image/SkImage.cpp | 76 | ||||
-rw-r--r-- | src/image/SkSurface.cpp | 16 |
9 files changed, 4 insertions, 211 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 0fdbc5838d..9bebb5cdd8 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1369,22 +1369,6 @@ bool SkCanvas::onGetProps(SkSurfaceProps* props) const { } } -#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS -const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { - SkPixmap pmap; - if (this->peekPixels(&pmap)) { - if (info) { - *info = pmap.info(); - } - if (rowBytes) { - *rowBytes = pmap.rowBytes(); - } - return pmap.addr(); - } - return nullptr; -} -#endif - bool SkCanvas::peekPixels(SkPixmap* pmap) { return this->onPeekPixels(pmap); } @@ -3385,12 +3369,6 @@ SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { fCanvas->restoreToCount(fSaveCount); } -#ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API -SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* props) { - return this->makeSurface(info, props).release(); -} -#endif - ///////////////////////////////// const SkCanvas::ClipOp SkCanvas::kDifference_Op; diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 621179e6b3..f01df49736 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -367,45 +367,11 @@ MOVE_FIELD(DrawLooper) #undef MOVE_FIELD void SkPaint::setLooper(sk_sp<SkDrawLooper> looper) { fDrawLooper = std::move(looper); } -#define SET_PTR(Field) \ - Sk##Field* SkPaint::set##Field(Sk##Field* f) { \ - this->f##Field.reset(SkSafeRef(f)); \ - return f; \ - } -#ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR -SET_PTR(Typeface) -#endif -#ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR -SET_PTR(Rasterizer) -#endif -SET_PTR(ImageFilter) -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR -SET_PTR(PathEffect) -#endif -#ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR -SET_PTR(MaskFilter) -#endif -#undef SET_PTR - -#ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR -SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) { - fDrawLooper.reset(SkSafeRef(looper)); - return looper; +// TODO: remove this variant +SkImageFilter* SkPaint::setImageFilter(SkImageFilter* imf) { + this->setImageFilter(sk_ref_sp(imf)); + return imf; } -#endif - -#ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT -void SkPaint::setXfermode(sk_sp<SkXfermode> mode) { - this->setBlendMode(mode ? mode->blend() : SkBlendMode::kSrcOver); -} -SkXfermode* SkPaint::getXfermode() const { - return SkXfermode::Peek((SkBlendMode)fBlendMode); -} -SkXfermode* SkPaint::setXfermodeMode(SkXfermode::Mode mode) { - this->setBlendMode((SkBlendMode)mode); - return SkXfermode::Peek((SkBlendMode)mode); -} -#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index 88da70aacf..ae3b70452e 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -24,31 +24,6 @@ static bool g_AllPictureIOSecurityPrecautionsEnabled = false; DECLARE_SKMESSAGEBUS_MESSAGE(SkPicture::DeletionMessage); -#ifdef SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF -class InstallProcImageDeserializer : public SkImageDeserializer { - SkPicture::InstallPixelRefProc fProc; -public: - InstallProcImageDeserializer(SkPicture::InstallPixelRefProc proc) : fProc(proc) {} - - sk_sp<SkImage> makeFromMemory(const void* data, size_t length, const SkIRect* subset) override { - SkBitmap bitmap; - if (fProc(data, length, &bitmap)) { - bitmap.setImmutable(); - return SkImage::MakeFromBitmap(bitmap); - } - return nullptr; - } - sk_sp<SkImage> makeFromData(SkData* data, const SkIRect* subset) override { - return this->makeFromMemory(data->data(), data->size(), subset); - } -}; - -sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, InstallPixelRefProc proc) { - InstallProcImageDeserializer deserializer(proc); - return MakeFromStream(stream, &deserializer); -} -#endif - /* SkPicture impl. This handles generic responsibilities like unique IDs and serialization. */ SkPicture::SkPicture() : fUniqueID(0) {} diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp index e7b3a7a7e5..fc2ba12481 100644 --- a/src/core/SkStream.cpp +++ b/src/core/SkStream.cpp @@ -307,17 +307,6 @@ SkMemoryStream::SkMemoryStream(sk_sp<SkData> data) : fData(std::move(data)) { fOffset = 0; } -#ifdef SK_SUPPORT_LEGACY_STREAM_DATA -SkMemoryStream::SkMemoryStream(SkData* data) { - if (nullptr == data) { - fData = SkData::MakeEmpty(); - } else { - fData = sk_ref_sp(data); - } - fOffset = 0; -} -#endif - void SkMemoryStream::setMemoryOwned(const void* src, size_t size) { fData = SkData::MakeFromMalloc(src, size); fOffset = 0; diff --git a/src/effects/SkArithmeticModePriv.h b/src/effects/SkArithmeticModePriv.h index 10d5a15721..ca469a7233 100644 --- a/src/effects/SkArithmeticModePriv.h +++ b/src/effects/SkArithmeticModePriv.h @@ -15,8 +15,6 @@ struct SkArithmeticParams { bool fEnforcePMColor; }; -#ifndef SK_SUPPORT_LEGACY_ARITHMETICMODE - class SK_API SkArithmeticMode { public: /** @@ -35,5 +33,3 @@ private: }; #endif - -#endif diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp index 5f3952d1ad..5f2e2fdfa9 100644 --- a/src/effects/SkEmbossMaskFilter.cpp +++ b/src/effects/SkEmbossMaskFilter.cpp @@ -17,15 +17,6 @@ sk_sp<SkMaskFilter> SkEmbossMaskFilter::Make(SkScalar blurSigma, const Light& li return sk_sp<SkMaskFilter>(new SkEmbossMaskFilter(blurSigma, light)); } -#ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR -SkMaskFilter* SkBlurMaskFilter::CreateEmboss(const SkScalar direction[3], - SkScalar ambient, SkScalar specular, - SkScalar blurRadius) { - return SkBlurMaskFilter::CreateEmboss(SkBlurMask::ConvertRadiusToSigma(blurRadius), - direction, ambient, specular); -} -#endif - sk_sp<SkMaskFilter> SkBlurMaskFilter::MakeEmboss(SkScalar blurSigma, const SkScalar direction[3], SkScalar ambient, SkScalar specular) { if (direction == nullptr) { diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 7484869ff2..1b3cf8197c 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -73,16 +73,6 @@ sk_sp<SkImageFilter> SkXfermodeImageFilter::Make(SkBlendMode mode, return sk_sp<SkImageFilter>(new SkXfermodeImageFilter_Base(mode, inputs, cropRect)); } -#ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT -sk_sp<SkImageFilter> SkXfermodeImageFilter::Make(sk_sp<SkXfermode> mode, - sk_sp<SkImageFilter> background, - sk_sp<SkImageFilter> foreground, - const SkImageFilter::CropRect* cropRect) { - return Make(mode ? mode->blend() : SkBlendMode::kSrcOver, - std::move(background), std::move(foreground), cropRect); -} -#endif - SkXfermodeImageFilter_Base::SkXfermodeImageFilter_Base(SkBlendMode mode, sk_sp<SkImageFilter> inputs[2], const CropRect* cropRect) diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 986fdec3a4..334984dfcb 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -48,22 +48,6 @@ bool SkImage::peekPixels(SkPixmap* pm) const { return as_IB(this)->onPeekPixels(pm); } -#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS -const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { - SkPixmap pm; - if (this->peekPixels(&pm)) { - if (info) { - *info = pm.info(); - } - if (rowBytes) { - *rowBytes = pm.rowBytes(); - } - return pm.addr(); - } - return nullptr; -} -#endif - bool SkImage::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint chint) const { SkReadPixelsRec rec(dstInfo, dstPixels, dstRowBytes, srcX, srcY); @@ -430,66 +414,6 @@ sk_sp<SkImage> SkImage::makeNonTextureImage() const { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef SK_SUPPORT_LEGACY_IMAGEFACTORY -SkImage* SkImage::NewRasterCopy(const Info& info, const void* pixels, size_t rowBytes, - SkColorTable* ctable) { - return MakeRasterCopy(SkPixmap(info, pixels, rowBytes, ctable)).release(); -} - -SkImage* SkImage::NewRasterData(const Info& info, SkData* pixels, size_t rowBytes) { - return MakeRasterData(info, sk_ref_sp(pixels), rowBytes).release(); -} - -SkImage* SkImage::NewFromRaster(const Info& info, const void* pixels, size_t rowBytes, - RasterReleaseProc proc, ReleaseContext releasectx) { - return MakeFromRaster(SkPixmap(info, pixels, rowBytes), proc, releasectx).release(); -} - -SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) { - return MakeFromBitmap(bm).release(); -} - -SkImage* SkImage::NewFromGenerator(SkImageGenerator* gen, const SkIRect* subset) { - return MakeFromGenerator(gen, subset).release(); -} - -SkImage* SkImage::NewFromEncoded(SkData* encoded, const SkIRect* subset) { - return MakeFromEncoded(sk_ref_sp(encoded), subset).release(); -} - -SkImage* SkImage::NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc, SkAlphaType at, - TextureReleaseProc proc, ReleaseContext releasectx) { - return MakeFromTexture(ctx, desc, at, proc, releasectx).release(); -} - -SkImage* SkImage::NewFromAdoptedTexture(GrContext* ctx, const GrBackendTextureDesc& desc, - SkAlphaType at) { - return MakeFromAdoptedTexture(ctx, desc, at).release(); -} - -SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx, SkYUVColorSpace space, - const GrBackendObject yuvTextureHandles[3], - const SkISize yuvSizes[3], - GrSurfaceOrigin origin) { - return MakeFromYUVTexturesCopy(ctx, space, yuvTextureHandles, yuvSizes, origin).release(); -} - -SkImage* SkImage::NewFromPicture(const SkPicture* picture, const SkISize& dimensions, - const SkMatrix* matrix, const SkPaint* paint) { - return MakeFromPicture(sk_ref_sp(const_cast<SkPicture*>(picture)), dimensions, - matrix, paint).release(); -} - -SkImage* SkImage::NewTextureFromPixmap(GrContext* ctx, const SkPixmap& pmap, SkBudgeted budgeted) { - return MakeTextureFromPixmap(ctx, pmap, budgeted).release(); -} - -SkImage* SkImage::NewFromDeferredTextureImageData(GrContext* ctx, const void* data, - SkBudgeted budgeted) { - return MakeFromDeferredTextureImageData(ctx, data, budgeted).release(); -} -#endif - sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, const GrMipLevel* texels, int mipLevelCount, SkBudgeted) { return nullptr; diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index a0b9059e70..38bab9e32f 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -186,22 +186,6 @@ bool SkSurface::peekPixels(SkPixmap* pmap) { return this->getCanvas()->peekPixels(pmap); } -#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS -const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { - SkPixmap pm; - if (this->peekPixels(&pm)) { - if (info) { - *info = pm.info(); - } - if (rowBytes) { - *rowBytes = pm.rowBytes(); - } - return pm.addr(); - } - return nullptr; -} -#endif - bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY) { return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY); |