diff options
author | 2016-10-31 15:11:04 -0400 | |
---|---|---|
committer | 2016-10-31 19:35:15 +0000 | |
commit | 09d9435835f48b06954904f16d14c1c2eeaaad2e (patch) | |
tree | 717ad84a3204cdb81646e0d9dee23977965ce2e5 | |
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>
29 files changed, 6 insertions, 584 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index a8db417131..1dcf193535 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -220,9 +220,6 @@ public: * surface, then the new surface is created with default properties. */ sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps* = nullptr); -#ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API - SkSurface* newSurface(const SkImageInfo& info, const SkSurfaceProps* props = NULL); -#endif /** * Return the GPU context of the device that is associated with the canvas. @@ -258,10 +255,6 @@ public: */ bool peekPixels(SkPixmap*); -#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS - const void* peekPixels(SkImageInfo* info, size_t* rowBytes); -#endif - /** * Copy the pixels from the base-layer into the specified buffer (pixels + rowBytes), * converting them into the requested format (SkImageInfo). The base-layer pixels are read @@ -597,11 +590,6 @@ public: @param mode the mode to apply the color in (defaults to SrcOver) */ void drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, SkBlendMode mode = SkBlendMode::kSrcOver); -#ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT - void drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, SkXfermode::Mode mode) { - this->drawARGB(a, r, g, b, (SkBlendMode)mode); - } -#endif /** Fill the entire canvas' bitmap (restricted to the current clip) with the specified color and mode. @@ -609,11 +597,6 @@ public: @param mode the mode to apply the color in (defaults to SrcOver) */ void drawColor(SkColor color, SkBlendMode mode = SkBlendMode::kSrcOver); -#ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT - void drawColor(SkColor color, SkXfermode::Mode mode) { - this->drawColor(color, (SkBlendMode)mode); - } -#endif /** * Helper method for drawing a color in SRC mode, completely replacing all the pixels diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 290996e0a9..53ae04ecb2 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -193,21 +193,6 @@ public: */ bool peekPixels(SkPixmap* pixmap) const; -#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS - /** - * If the image has direct access to its pixels (i.e. they are in local - * RAM) return the (const) address of those pixels, and if not null, return - * the ImageInfo and rowBytes. The returned address is only valid while - * the image object is in scope. - * - * On failure, returns NULL and the info and rowBytes parameters are - * ignored. - * - * DEPRECATED -- use the SkPixmap variant instead - */ - const void* peekPixels(SkImageInfo* info, size_t* rowBytes) const; -#endif - /** * Some images have to perform preliminary work in preparation for drawing. This can be * decoding, uploading to a GPU, or other tasks. These happen automatically when an image @@ -434,40 +419,6 @@ public: */ bool isLazyGenerated() const; - -#ifdef SK_SUPPORT_LEGACY_IMAGEFACTORY - static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowBytes, - SkColorTable* ctable = nullptr); - static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); - static SkImage* NewFromRaster(const Info&, const void* pixels, size_t rowBytes, - RasterReleaseProc, ReleaseContext); - static SkImage* NewFromBitmap(const SkBitmap&); - static SkImage* NewFromGenerator(SkImageGenerator*, const SkIRect* subset = nullptr); - static SkImage* NewFromEncoded(SkData* encoded, const SkIRect* subset = nullptr); - static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc) { - return NewFromTexture(ctx, desc, kPremul_SkAlphaType, nullptr, nullptr); - } - - static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& de, SkAlphaType at) { - return NewFromTexture(ctx, de, at, nullptr, nullptr); - } - static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType, - TextureReleaseProc, ReleaseContext); - static SkImage* NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, - SkAlphaType = kPremul_SkAlphaType); - static SkImage* NewFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, - const GrBackendObject yuvTextureHandles[3], - const SkISize yuvSizes[3], - GrSurfaceOrigin); - static SkImage* NewFromPicture(const SkPicture*, const SkISize& dimensions, - const SkMatrix*, const SkPaint*); - static SkImage* NewTextureFromPixmap(GrContext*, const SkPixmap&, SkBudgeted budgeted); - static SkImage* NewFromDeferredTextureImageData(GrContext*, const void*, SkBudgeted); - - SkImage* newSubset(const SkIRect& subset) const { return this->makeSubset(subset).release(); } - SkImage* newTextureImage(GrContext* ctx) const { return this->makeTextureImage(ctx).release(); } -#endif - protected: SkImage(int width, int height, uint32_t uniqueID); diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 2e4f2f9edd..353c1478d8 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -14,8 +14,6 @@ #include "SkMatrix.h" #include "SkXfermode.h" -//#define SK_SUPPORT_LEGACY_XFERMODE_OBJECT - class SkAutoDescriptor; class SkAutoGlyphCache; class SkColorFilter; @@ -520,32 +518,6 @@ public: */ void setColorFilter(sk_sp<SkColorFilter>); -#ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT - /** Get the paint's xfermode object. - <p /> - The xfermode's reference count is not affected. - @return the paint's xfermode (or NULL) - */ - SkXfermode* getXfermode() const; - - /** Set or clear the xfermode object. - <p /> - Pass NULL to clear any previous xfermode. - As a convenience, the parameter passed is also returned. - If a previous xfermode exists, its reference count is decremented. - If xfermode is not NULL, its reference count is incremented. - @param xfermode May be NULL. The new xfermode to be installed in the - paint - */ - void setXfermode(sk_sp<SkXfermode>); - - /** Create an xfermode based on the specified Mode, and assign it into the - paint, returning the mode that was set. If the Mode is SrcOver, then - the paint's xfermode is set to null. - */ - SkXfermode* setXfermodeMode(SkXfermode::Mode); -#endif - SkBlendMode getBlendMode() const { return (SkBlendMode)fBlendMode; } bool isSrcOver() const { return (SkBlendMode)fBlendMode == SkBlendMode::kSrcOver; } void setBlendMode(SkBlendMode mode) { fBlendMode = (unsigned)mode; } @@ -568,9 +540,6 @@ public: @return effect */ void setPathEffect(sk_sp<SkPathEffect>); -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - SkPathEffect* setPathEffect(SkPathEffect* effect); -#endif /** Get the paint's maskfilter object. <p /> @@ -589,9 +558,6 @@ public: the paint @return maskfilter */ -#ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR - SkMaskFilter* setMaskFilter(SkMaskFilter* maskfilter); -#endif void setMaskFilter(sk_sp<SkMaskFilter>); // These attributes are for text/fonts @@ -615,9 +581,6 @@ public: @return typeface */ void setTypeface(sk_sp<SkTypeface>); -#ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR - SkTypeface* setTypeface(SkTypeface* typeface); -#endif /** Get the paint's rasterizer (or NULL). <p /> @@ -637,9 +600,6 @@ public: the paint. @return rasterizer */ -#ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR - SkRasterizer* setRasterizer(SkRasterizer* rasterizer); -#endif void setRasterizer(sk_sp<SkRasterizer>); SkImageFilter* getImageFilter() const { return fImageFilter.get(); } @@ -662,9 +622,7 @@ public: * @param looper May be NULL. The new looper to be installed in the paint. */ void setDrawLooper(sk_sp<SkDrawLooper>); -#ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR - SkDrawLooper* setLooper(SkDrawLooper* looper); -#endif + void setLooper(sk_sp<SkDrawLooper>); enum Align { diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h index f5ca9183a3..ff3fa01f36 100644 --- a/include/core/SkPathEffect.h +++ b/include/core/SkPathEffect.h @@ -193,12 +193,6 @@ public: return sk_sp<SkPathEffect>(new SkComposePathEffect(outer, inner)); } -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) { - return Make(sk_ref_sp(outer), sk_ref_sp(inner)).release(); - } -#endif - virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; @@ -243,11 +237,6 @@ public: return sk_sp<SkPathEffect>(new SkSumPathEffect(first, second)); } -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { - return Make(sk_ref_sp(first), sk_ref_sp(second)).release(); - } -#endif virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 088e7dc501..8047858b16 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -52,21 +52,6 @@ public: */ typedef bool (*InstallPixelRefProc)(const void* src, size_t length, SkBitmap* dst); -#ifdef SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF - /** - * Recreate a picture that was serialized into a stream. - * @param SkStream Serialized picture data. Ownership is unchanged by this call. - * @param proc Function pointer for installing pixelrefs on SkBitmaps representing the - * encoded bitmap data from the stream. - * @return A new SkPicture representing the serialized data, or NULL if the stream is - * invalid. - */ - static sk_sp<SkPicture> MakeFromStream(SkStream*, InstallPixelRefProc proc); - static sk_sp<SkPicture> MakeFromStream(SkStream* stream, std::nullptr_t) { - return MakeFromStream(stream); - } -#endif - /** * Recreate a picture that was serialized into a stream. * @@ -182,18 +167,6 @@ public: static void SetPictureIOSecurityPrecautionsEnabled_Dangerous(bool set); static bool PictureIOSecurityPrecautionsEnabled(); -#ifdef SK_SUPPORT_LEGACY_PICTURE_PTR - static SkPicture* CreateFromStream(SkStream* stream, InstallPixelRefProc proc) { - return MakeFromStream(stream, proc).release(); - } - static SkPicture* CreateFromStream(SkStream* stream) { - return MakeFromStream(stream).release(); - } - static SkPicture* CreateFromBuffer(SkReadBuffer& rbuf) { - return MakeFromBuffer(rbuf).release(); - } -#endif - private: // Subclass whitelist. SkPicture(); diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h index 890e7ca213..59e8f14504 100644 --- a/include/core/SkPictureRecorder.h +++ b/include/core/SkPictureRecorder.h @@ -99,19 +99,6 @@ public: */ sk_sp<SkDrawable> finishRecordingAsDrawable(uint32_t endFlags = 0); -#ifdef SK_SUPPORT_LEGACY_PICTURE_PTR - SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture() { - return this->finishRecordingAsPicture().release(); - } - SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(const SkRect& cullRect) { - return this->finishRecordingAsPictureWithCull(cullRect).release(); - } - SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable() { - return this->finishRecordingAsDrawable().release(); - } - SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingAsPicture(); } -#endif - private: void reset(); diff --git a/include/core/SkStream.h b/include/core/SkStream.h index 7afce71240..9fbd694cf0 100644 --- a/include/core/SkStream.h +++ b/include/core/SkStream.h @@ -289,14 +289,6 @@ public: /** If copyData is true, the stream makes a private copy of the data. */ SkMemoryStream(const void* data, size_t length, bool copyData = false); -#ifdef SK_SUPPORT_LEGACY_STREAM_DATA - /** Use the specified data as the memory for this stream. - * The stream will call ref() on the data (assuming it is not NULL). - * DEPRECATED - */ - SkMemoryStream(SkData*); -#endif - /** Creates the stream to read from the specified data */ SkMemoryStream(sk_sp<SkData>); @@ -314,22 +306,6 @@ public: sk_sp<SkData> asData() const { return fData; } void setData(sk_sp<SkData>); -#ifdef SK_SUPPORT_LEGACY_STREAM_DATA - /** Return the stream's data in a SkData. - * The caller must call unref() when it is finished using the data. - */ - SkData* copyToData() const { return asData().release(); } - - /** - * Use the specified data as the memory for this stream. - * The stream will call ref() on the data (assuming it is not NULL). - * The function returns the data parameter as a convenience. - */ - SkData* setData(SkData* data) { - this->setData(sk_ref_sp(data)); - return data; - } -#endif void skipToAlign4(); const void* getAtPos(); @@ -414,15 +390,6 @@ public: sk_sp<SkData> snapshotAsData() const; // Return the contents as SkData, and then reset the stream. sk_sp<SkData> detachAsData(); -#ifdef SK_SUPPORT_LEGACY_STREAM_DATA - /** - * Return a copy of the data written so far. This call is responsible for - * calling unref() when they are finished with the data. - */ - SkData* copyToData() const { - return snapshotAsData().release(); - } -#endif /** Reset, returning a reader stream with the current content. */ SkStreamAsset* detachAsStream(); diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index bb3f719754..e6e6ff1b96 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -149,57 +149,6 @@ public: return MakeRenderTarget(gr, b, info, 0, kBottomLeft_GrSurfaceOrigin, nullptr); } -#ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API - static SkSurface* NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes, - const SkSurfaceProps* props = NULL) { - return MakeRasterDirect(info, pixels, rowBytes, props).release(); - } - static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo& info, void* pixels, - size_t rowBytes, - void (*releaseProc)(void* pixels, void* context), - void* context, const SkSurfaceProps* props = NULL){ - return MakeRasterDirectReleaseProc(info, pixels, rowBytes, releaseProc, context, - props).release(); - } - static SkSurface* NewRaster(const SkImageInfo& info, size_t rowBytes, - const SkSurfaceProps* props) { - return MakeRaster(info, rowBytes, props).release(); - } - static SkSurface* NewRaster(const SkImageInfo& info, const SkSurfaceProps* props = NULL) { - return MakeRaster(info, props).release(); - } - static SkSurface* NewRasterN32Premul(int width, int height, - const SkSurfaceProps* props = NULL) { - return NewRaster(SkImageInfo::MakeN32Premul(width, height), props); - } - static SkSurface* NewFromBackendTexture(GrContext* ctx, const GrBackendTextureDesc& desc, - const SkSurfaceProps* props) { - return MakeFromBackendTexture(ctx, desc, props).release(); - } - // Legacy alias - static SkSurface* NewWrappedRenderTarget(GrContext* ctx, const GrBackendTextureDesc& desc, - const SkSurfaceProps* props) { - return NewFromBackendTexture(ctx, desc, props); - } - static SkSurface* NewFromBackendRenderTarget(GrContext* ctx, const GrBackendRenderTargetDesc& d, - const SkSurfaceProps* props) { - return MakeFromBackendRenderTarget(ctx, d, props).release(); - } - static SkSurface* NewFromBackendTextureAsRenderTarget(GrContext* ctx, - const GrBackendTextureDesc& desc, - const SkSurfaceProps* props) { - return MakeFromBackendTextureAsRenderTarget(ctx, desc, props).release(); - } - static SkSurface* NewRenderTarget(GrContext* ctx, SkBudgeted b, const SkImageInfo& info, - int sampleCount, const SkSurfaceProps* props = NULL) { - return MakeRenderTarget(ctx, b, info, sampleCount, props).release(); - } - static SkSurface* NewRenderTarget(GrContext* gr, SkBudgeted b, const SkImageInfo& info) { - return NewRenderTarget(gr, b, info, 0); - } - SkSurface* newSurface(const SkImageInfo& info) { return this->makeSurface(info).release(); } -#endif - int width() const { return fWidth; } int height() const { return fHeight; } @@ -316,15 +265,6 @@ public: }; sk_sp<SkImage> makeImageSnapshot(SkBudgeted, ForceUnique); -#ifdef SK_SUPPORT_LEGACY_IMAGEFACTORY - SkImage* newImageSnapshot(SkBudgeted budgeted = SkBudgeted::kYes) { - return this->makeImageSnapshot(budgeted).release(); - } - SkImage* newImageSnapshot(SkBudgeted budgeted, ForceUnique force) { - return this->makeImageSnapshot(budgeted, force).release(); - } -#endif - /** * Though the caller could get a snapshot image explicitly, and draw that, * it seems that directly drawing a surface into another canvas might be @@ -345,10 +285,6 @@ public: */ bool peekPixels(SkPixmap*); -#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS - const void* peekPixels(SkImageInfo* info, size_t* rowBytes); -#endif - /** * Copy the pixels from the surface into the specified buffer (pixels + rowBytes), * converting them into the requested format (dstInfo). The surface pixels are read diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index c11b76135d..51d5a0b11c 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -95,11 +95,6 @@ public: /** Returns the default typeface, which is never nullptr. */ static sk_sp<SkTypeface> MakeDefault(Style style = SkTypeface::kNormal); -#ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR - static SkTypeface* RefDefault(Style style = SkTypeface::kNormal) { - return MakeDefault(style).release(); - } -#endif /** Creates a new reference to the typeface that most closely matches the requested familyName and fontStyle. This method allows extended font @@ -112,12 +107,6 @@ public: */ static sk_sp<SkTypeface> MakeFromName(const char familyName[], SkFontStyle fontStyle); -#ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR - static SkTypeface* CreateFromName(const char familyName[], Style style) { - return MakeFromName(familyName, SkFontStyle::FromOldStyle(style)).release(); - } -#endif - /** Return the typeface that most closely matches the requested typeface and style. Use this to pick a new style from the same family of the existing typeface. If family is nullptr, this selects from the default font's family. @@ -132,22 +121,12 @@ public: not a valid font file, returns nullptr. */ static sk_sp<SkTypeface> MakeFromFile(const char path[], int index = 0); -#ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR - static SkTypeface* CreateFromFile(const char path[], int index = 0) { - return MakeFromFile(path, index).release(); - } -#endif /** Return a new typeface given a stream. If the stream is not a valid font file, returns nullptr. Ownership of the stream is transferred, so the caller must not reference it again. */ static sk_sp<SkTypeface> MakeFromStream(SkStreamAsset* stream, int index = 0); -#ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR - static SkTypeface* CreateFromStream(SkStreamAsset* stream, int index = 0) { - return MakeFromStream(stream, index).release(); - } -#endif /** Return a new typeface given font data and configuration. If the data is not valid font data, returns nullptr. diff --git a/include/effects/Sk1DPathEffect.h b/include/effects/Sk1DPathEffect.h index d5315a8735..2523264570 100644 --- a/include/effects/Sk1DPathEffect.h +++ b/include/effects/Sk1DPathEffect.h @@ -58,12 +58,6 @@ public: */ static sk_sp<SkPathEffect> Make(const SkPath& path, SkScalar advance, SkScalar phase, Style); -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar phase, Style s) { - return Make(path, advance, phase, s).release(); - } -#endif - virtual bool filterPath(SkPath*, const SkPath&, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/SkArithmeticMode.h b/include/effects/SkArithmeticMode.h index e00ea32cc4..89cca92c55 100644 --- a/include/effects/SkArithmeticMode.h +++ b/include/effects/SkArithmeticMode.h @@ -12,26 +12,6 @@ #include "SkScalar.h" #include "SkXfermode.h" -#ifdef SK_SUPPORT_LEGACY_ARITHMETICMODE - -class SK_API SkArithmeticMode { -public: - /** - * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] - * - * k1=k2=k3=0, k4=1.0 results in returning opaque white - * k1=k3=k4=0, k2=1.0 results in returning the src - * k1=k2=k4=0, k3=1.0 results in returning the dst - */ - static sk_sp<SkXfermode> Make(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, - bool enforcePMColor = true); - - SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); - -private: - SkArithmeticMode(); // can't be instantiated -}; - -#endif +// TODO : remove this header from public #endif diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h index 9b87683f04..a429f50b36 100644 --- a/include/effects/SkBlurDrawLooper.h +++ b/include/effects/SkBlurDrawLooper.h @@ -39,12 +39,6 @@ public: uint32_t flags = kNone_BlurFlag) { return sk_sp<SkDrawLooper>(new SkBlurDrawLooper(color, sigma, dx, dy, flags)); } -#ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR - static SkDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, - uint32_t flags = kNone_BlurFlag) { - return Make(color, sigma, dx, dy, flags).release(); - } -#endif SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const override; diff --git a/include/effects/SkBlurMaskFilter.h b/include/effects/SkBlurMaskFilter.h index dfbae6b689..e32672ac67 100644 --- a/include/effects/SkBlurMaskFilter.h +++ b/include/effects/SkBlurMaskFilter.h @@ -59,20 +59,6 @@ public: static sk_sp<SkMaskFilter> MakeEmboss(SkScalar blurSigma, const SkScalar direction[3], SkScalar ambient, SkScalar specular); -#ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR - static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flags = kNone_BlurFlag){ - return Make(style, sigma, flags).release(); - } - static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar direction[3], - SkScalar ambient, SkScalar specular) { - return MakeEmboss(blurSigma, direction, ambient, specular).release(); - } - SK_ATTR_DEPRECATED("use sigma version") - static SkMaskFilter* CreateEmboss(const SkScalar direction[3], - SkScalar ambient, SkScalar specular, - SkScalar blurRadius); -#endif - static const int kMaxDivisions = 6; // This method computes all the parameters for drawing a partially occluded nine-patched diff --git a/include/effects/SkCornerPathEffect.h b/include/effects/SkCornerPathEffect.h index cf03463530..593f4bea2b 100644 --- a/include/effects/SkCornerPathEffect.h +++ b/include/effects/SkCornerPathEffect.h @@ -24,12 +24,6 @@ public: return sk_sp<SkPathEffect>(new SkCornerPathEffect(radius)); } -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(SkScalar radius) { - return Make(radius).release(); - } -#endif - virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/SkDashPathEffect.h b/include/effects/SkDashPathEffect.h index ccb1a4e440..045bb25d05 100644 --- a/include/effects/SkDashPathEffect.h +++ b/include/effects/SkDashPathEffect.h @@ -38,12 +38,6 @@ public: */ static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase); -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(const SkScalar intervals[], int count, SkScalar phase) { - return Make(intervals, count, phase).release(); - } -#endif - virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/SkDiscretePathEffect.h b/include/effects/SkDiscretePathEffect.h index 78d4516ee6..6709676a8b 100644 --- a/include/effects/SkDiscretePathEffect.h +++ b/include/effects/SkDiscretePathEffect.h @@ -31,12 +31,6 @@ public: */ static sk_sp<SkPathEffect> Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist = 0); -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(SkScalar segLength, SkScalar deviation, uint32_t seedAssist = 0) { - return Make(segLength, deviation, seedAssist).release(); - } -#endif - virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/SkEmbossMaskFilter.h b/include/effects/SkEmbossMaskFilter.h index 8a34282451..395657224c 100644 --- a/include/effects/SkEmbossMaskFilter.h +++ b/include/effects/SkEmbossMaskFilter.h @@ -25,12 +25,6 @@ public: static sk_sp<SkMaskFilter> Make(SkScalar blurSigma, const Light& light); -#ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR - static SkMaskFilter* Create(SkScalar blurSigma, const Light& light) { - return Make(blurSigma, light).release(); - } -#endif - // overrides from SkMaskFilter // This method is not exported to java. SkMask::Format getFormat() const override; diff --git a/include/effects/SkLayerDrawLooper.h b/include/effects/SkLayerDrawLooper.h index a6b5332e92..fd693f7ba0 100644 --- a/include/effects/SkLayerDrawLooper.h +++ b/include/effects/SkLayerDrawLooper.h @@ -143,11 +143,6 @@ public: * also reset the builder, so it can be used to build another looper. */ sk_sp<SkDrawLooper> detach(); -#ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR - SkLayerDrawLooper* detachLooper() { - return (SkLayerDrawLooper*)this->detach().release(); - } -#endif private: Rec* fRecs; diff --git a/include/effects/SkLayerRasterizer.h b/include/effects/SkLayerRasterizer.h index 9ddcd4e6c3..a1b7e2dc0c 100644 --- a/include/effects/SkLayerRasterizer.h +++ b/include/effects/SkLayerRasterizer.h @@ -58,15 +58,6 @@ public: */ sk_sp<SkLayerRasterizer> snapshot() const; -#ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR - SkLayerRasterizer* detachRasterizer() { - return this->detach().release(); - } - SkLayerRasterizer* snapshotRasterizer() const { - return this->snapshot().release(); - } -#endif - private: SkDeque* fLayers; }; diff --git a/include/effects/SkXfermodeImageFilter.h b/include/effects/SkXfermodeImageFilter.h index 4b42428421..7b17eec268 100644 --- a/include/effects/SkXfermodeImageFilter.h +++ b/include/effects/SkXfermodeImageFilter.h @@ -39,16 +39,6 @@ public: nullptr, nullptr); } -#ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT - static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter> background, - sk_sp<SkImageFilter> foreground, - const SkImageFilter::CropRect* cropRect); - static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter> background) { - return Make(std::move(mode), std::move(background), nullptr, nullptr); - } - -#endif - SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); private: 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); |