aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/imagefiltersbase.cpp1
-rw-r--r--include/core/SkImage.h117
-rw-r--r--include/core/SkImageFilter.h22
-rw-r--r--include/core/SkPoint.h11
-rw-r--r--include/core/SkSurface.h85
-rw-r--r--src/core/SkBlurImageFilter.cpp1
-rw-r--r--src/core/SkImageFilterPriv.h24
-rw-r--r--src/core/SkLocalMatrixImageFilter.cpp1
-rw-r--r--src/core/SkMatrixImageFilter.cpp1
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp1
-rw-r--r--src/effects/SkArithmeticImageFilter.cpp1
-rw-r--r--src/effects/SkColorFilterImageFilter.cpp1
-rw-r--r--src/effects/SkComposeImageFilter.cpp1
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp1
-rw-r--r--src/effects/SkDropShadowImageFilter.cpp1
-rw-r--r--src/effects/SkLightingImageFilter.cpp1
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp1
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp1
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp1
-rw-r--r--src/effects/SkOffsetImageFilter.cpp1
-rw-r--r--src/effects/SkPaintImageFilter.cpp1
-rw-r--r--src/effects/SkTileImageFilter.cpp1
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp1
-rw-r--r--tests/ImageFilterTest.cpp1
-rw-r--r--tests/PDFPrimitivesTest.cpp1
25 files changed, 170 insertions, 109 deletions
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp
index 6e347134d3..da26d97d51 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -10,6 +10,7 @@
#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkColorPriv.h"
+#include "SkImageFilterPriv.h"
#include "SkShader.h"
#include "SkBlurImageFilter.h"
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 7aa28eb74d..540f099dfe 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -51,8 +51,8 @@ public:
typedef SkImageInfo Info;
typedef void* ReleaseContext;
- static sk_sp<SkImage> MakeRasterCopy(const SkPixmap&);
- static sk_sp<SkImage> MakeRasterData(const Info&, sk_sp<SkData> pixels, size_t rowBytes);
+ static sk_sp<SkImage> MakeRasterCopy(const SkPixmap& pixmap);
+ static sk_sp<SkImage> MakeRasterData(const Info& info, sk_sp<SkData> pixels, size_t rowBytes);
typedef void (*RasterReleaseProc)(const void* pixels, ReleaseContext);
@@ -63,13 +63,15 @@ public:
*
* Returns NULL if the requested pixmap info is unsupported.
*/
- static sk_sp<SkImage> MakeFromRaster(const SkPixmap&, RasterReleaseProc, ReleaseContext);
+ static sk_sp<SkImage> MakeFromRaster(const SkPixmap& pixmap,
+ RasterReleaseProc rasterReleaseProc,
+ ReleaseContext releaseContext);
/**
* Construct a new image from the specified bitmap. If the bitmap is marked immutable, and
* its pixel memory is shareable, it may be shared instead of copied.
*/
- static sk_sp<SkImage> MakeFromBitmap(const SkBitmap&);
+ static sk_sp<SkImage> MakeFromBitmap(const SkBitmap& bitmap);
/**
* Construct a new SkImage based on the given ImageGenerator. Returns NULL on error.
@@ -77,7 +79,7 @@ public:
*
* If a subset is specified, it must be contained within the generator's bounds.
*/
- static sk_sp<SkImage> MakeFromGenerator(std::unique_ptr<SkImageGenerator>,
+ static sk_sp<SkImage> MakeFromGenerator(std::unique_ptr<SkImageGenerator> imageGenerator,
const SkIRect* subset = nullptr);
/**
@@ -88,7 +90,7 @@ public:
*/
static sk_sp<SkImage> MakeFromEncoded(sk_sp<SkData> encoded, const SkIRect* subset = nullptr);
- typedef void (*TextureReleaseProc)(ReleaseContext);
+ typedef void (*TextureReleaseProc)(ReleaseContext releaseContext);
/**
* Create a new image from the specified descriptor. Note - the caller is responsible for
@@ -96,10 +98,13 @@ public:
*
* Will return NULL if the specified backend texture is unsupported.
*/
- static sk_sp<SkImage> MakeFromTexture(GrContext* ctx,
- const GrBackendTexture& tex, GrSurfaceOrigin origin,
- SkAlphaType at, sk_sp<SkColorSpace> cs) {
- return MakeFromTexture(ctx, tex, origin, at, cs, nullptr, nullptr);
+ static sk_sp<SkImage> MakeFromTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin origin,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace) {
+ return MakeFromTexture(context, backendTexture, origin, alphaType, colorSpace, nullptr,
+ nullptr);
}
/**
@@ -109,10 +114,13 @@ public:
*
* Will return NULL if the specified backend texture is unsupported.
*/
- static sk_sp<SkImage> MakeFromTexture(GrContext*,
- const GrBackendTexture&, GrSurfaceOrigin origin,
- SkAlphaType, sk_sp<SkColorSpace>,
- TextureReleaseProc, ReleaseContext);
+ static sk_sp<SkImage> MakeFromTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin origin,
+ SkAlphaType alphaType,
+ sk_sp<SkColorSpace> colorSpace,
+ TextureReleaseProc textureReleaseProc,
+ ReleaseContext releaseContext);
/**
* Decodes and uploads the encoded data to a GPU backed image using the supplied GrContext.
@@ -127,7 +135,8 @@ public:
* supplied destination color space. The color space of the image itself will be determined
* from the encoded data.
*/
- static sk_sp<SkImage> MakeCrossContextFromEncoded(GrContext*, sk_sp<SkData>, bool buildMips,
+ static sk_sp<SkImage> MakeCrossContextFromEncoded(GrContext* context, sk_sp<SkData> data,
+ bool buildMips,
SkColorSpace* dstColorSpace);
/**
@@ -136,31 +145,34 @@ public:
*
* Will return NULL if the specified backend texture is unsupported.
*/
- static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext*,
- const GrBackendTexture&, GrSurfaceOrigin,
- SkAlphaType = kPremul_SkAlphaType,
- sk_sp<SkColorSpace> = nullptr);
+ static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin surfaceOrigin,
+ SkAlphaType alphaType = kPremul_SkAlphaType,
+ sk_sp<SkColorSpace> colorSpace = nullptr);
/**
* Create a new image by copying the pixels from the specified y, u, v textures. The data
* from the textures is immediately ingested into the image and the textures can be modified or
* deleted after the function returns. The image will have the dimensions of the y texture.
*/
- static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext*, SkYUVColorSpace,
+ static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
const GrBackendObject yuvTextureHandles[3],
const SkISize yuvSizes[3],
- GrSurfaceOrigin,
- sk_sp<SkColorSpace> = nullptr);
+ GrSurfaceOrigin surfaceOrigin,
+ sk_sp<SkColorSpace> colorSpace = nullptr);
/**
* Create a new image by copying the pixels from the specified y and uv textures. The data
* from the textures is immediately ingested into the image and the textures can be modified or
* deleted after the function returns. The image will have the dimensions of the y texture.
*/
- static sk_sp<SkImage> MakeFromNV12TexturesCopy(GrContext*, SkYUVColorSpace,
+ static sk_sp<SkImage> MakeFromNV12TexturesCopy(GrContext* context,
+ SkYUVColorSpace yuvColorSpace,
const GrBackendObject nv12TextureHandles[2],
- const SkISize nv12Sizes[2], GrSurfaceOrigin,
- sk_sp<SkColorSpace> = nullptr);
+ const SkISize nv12Sizes[2],
+ GrSurfaceOrigin surfaceOrigin,
+ sk_sp<SkColorSpace> colorSpace = nullptr);
enum class BitDepth {
kU8,
@@ -171,18 +183,19 @@ public:
* Create a new image from the specified picture.
* On creation of the SkImage, snap the SkPicture to a particular BitDepth and SkColorSpace.
*/
- static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture>, const SkISize& dimensions,
- const SkMatrix*, const SkPaint*, BitDepth,
- sk_sp<SkColorSpace>);
+ static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture> picture, const SkISize& dimensions,
+ const SkMatrix* matrix, const SkPaint* paint,
+ BitDepth bitDepth,
+ sk_sp<SkColorSpace> colorSpace);
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
/**
* Create a new image from the an Android hardware buffer.
* The new image takes a reference on the buffer.
*/
- static sk_sp<SkImage> MakeFromAHardwareBuffer(AHardwareBuffer*,
- SkAlphaType = kPremul_SkAlphaType,
- sk_sp<SkColorSpace> = nullptr);
+ static sk_sp<SkImage> MakeFromAHardwareBuffer(AHardwareBuffer* hardwareBuffer,
+ SkAlphaType alphaType = kPremul_SkAlphaType,
+ sk_sp<SkColorSpace> colorSpace = nullptr);
#endif
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -210,7 +223,7 @@ public:
bool isAlphaOnly() const;
bool isOpaque() const { return SkAlphaTypeIsOpaque(this->alphaType()); }
- sk_sp<SkShader> makeShader(SkShader::TileMode, SkShader::TileMode,
+ sk_sp<SkShader> makeShader(SkShader::TileMode tileMode1, SkShader::TileMode tileMode2,
const SkMatrix* localMatrix = nullptr) const;
/**
* Helper version of makeShader() that specifies Clamp tilemode.
@@ -285,10 +298,10 @@ public:
* - If the requested colortype/alphatype cannot be converted from the image's types.
*/
bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
- int srcX, int srcY, CachingHint = kAllow_CachingHint) const;
+ int srcX, int srcY, CachingHint cachingHint = kAllow_CachingHint) const;
bool readPixels(const SkPixmap& dst, int srcX, int srcY,
- CachingHint = kAllow_CachingHint) const;
+ CachingHint cachingHint = kAllow_CachingHint) const;
/**
* Copy the pixels from this image into the dst pixmap, converting as needed into dst's
@@ -297,7 +310,8 @@ public:
* If dst's dimensions differ from the src dimension, the image will be scaled, applying the
* specified filter-quality.
*/
- bool scalePixels(const SkPixmap& dst, SkFilterQuality, CachingHint = kAllow_CachingHint) const;
+ bool scalePixels(const SkPixmap& dst, SkFilterQuality filterQuality,
+ CachingHint cachingHint = kAllow_CachingHint) const;
/**
* Encode the image's pixels and return the result as SkData.
@@ -305,7 +319,7 @@ public:
* If the image type cannot be encoded, or the requested encoder format is
* not supported, this will return NULL.
*/
- sk_sp<SkData> encodeToData(SkEncodedImageFormat, int quality) const;
+ sk_sp<SkData> encodeToData(SkEncodedImageFormat encodedImageFormat, int quality) const;
/**
* Encode the image and return the result as SkData. This will attempt to reuse existing
@@ -321,7 +335,7 @@ public:
* If no compatible encoded data exists and encoding fails, this method will also
* fail (return NULL).
*/
- sk_sp<SkData> encodeToData(SkPixelSerializer* = nullptr) const;
+ sk_sp<SkData> encodeToData(SkPixelSerializer* pixelSerializer = nullptr) const;
/**
* If the image already has its contents in encoded form (e.g. PNG or JPEG), return that
@@ -331,7 +345,7 @@ public:
*/
sk_sp<SkData> refEncodedData() const;
- const char* toString(SkString*) const;
+ const char* toString(SkString* string) const;
/**
* Return a new image that is a subset of this image. The underlying implementation may
@@ -348,7 +362,7 @@ public:
* required, the returned image may be the same as this image. If this image is from a
* different GrContext, this will fail.
*/
- sk_sp<SkImage> makeTextureImage(GrContext*, SkColorSpace* dstColorSpace) const;
+ sk_sp<SkImage> makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace) const;
/**
* If the image is texture-backed this will make a raster copy of it (or nullptr if reading back
@@ -415,19 +429,20 @@ public:
* does not support color spaces (low bit depth types such as ARGB_4444), then dstColorSpace
* must be null.
*/
- size_t getDeferredTextureImageData(const GrContextThreadSafeProxy&,
- const DeferredTextureImageUsageParams[],
- int paramCnt,
- void* buffer,
- SkColorSpace* dstColorSpace = nullptr,
- SkColorType dstColorType = kN32_SkColorType) const;
+ size_t getDeferredTextureImageData(const GrContextThreadSafeProxy& contextThreadSafeProxy,
+ const DeferredTextureImageUsageParams deferredTextureImageUsageParams[],
+ int paramCnt,
+ void* buffer,
+ SkColorSpace* dstColorSpace = nullptr,
+ SkColorType dstColorType = kN32_SkColorType) const;
/**
* Returns a texture-backed image from data produced in SkImage::getDeferredTextureImageData.
* The context must be the context that provided the proxy passed to
* getDeferredTextureImageData.
*/
- static sk_sp<SkImage> MakeFromDeferredTextureImageData(GrContext*, const void*, SkBudgeted);
+ static sk_sp<SkImage> MakeFromDeferredTextureImageData(GrContext* context, const void* data,
+ SkBudgeted budgeted);
typedef std::function<void(GrBackendTexture)> BackendTextureReleaseProc;
@@ -447,10 +462,10 @@ public:
* If the SkImage is not texture backed, this function will generate a texture with the image's
* contents and return that.
*/
- static bool MakeBackendTextureFromSkImage(GrContext*,
- sk_sp<SkImage>,
- GrBackendTexture*,
- BackendTextureReleaseProc*);
+ static bool MakeBackendTextureFromSkImage(GrContext* context,
+ sk_sp<SkImage> image,
+ GrBackendTexture* backendTexture,
+ BackendTextureReleaseProc* backendTextureReleaseProc);
// Helper functions to convert to SkBitmap
@@ -469,7 +484,7 @@ public:
* On succcess, returns true. On failure, returns false and the bitmap parameter will be reset
* to empty.
*/
- bool asLegacyBitmap(SkBitmap*, LegacyBitmapMode) const;
+ bool asLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode legacyBitmapMode) const;
/**
* Returns true if the image is backed by an image-generator or other src that creates
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 0991bea63f..a1fa789a03 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -101,7 +101,7 @@ public:
* Note: imageBounds is in "device" space, as the output cropped rectangle will be,
* so the matrix is ignored for those. It is only applied the croprect's bounds.
*/
- void applyTo(const SkIRect& imageBounds, const SkMatrix&, bool embiggen,
+ void applyTo(const SkIRect& imageBounds, const SkMatrix& matrix, bool embiggen,
SkIRect* cropped) const;
private:
@@ -130,11 +130,12 @@ public:
* TODO: Right now the imagefilters sometimes return empty result bitmaps/
* specialimages. That doesn't seem quite right.
*/
- sk_sp<SkSpecialImage> filterImage(SkSpecialImage* src, const Context&, SkIPoint* offset) const;
+ sk_sp<SkSpecialImage> filterImage(SkSpecialImage* src, const Context& context,
+ SkIPoint* offset) const;
enum MapDirection {
kForward_MapDirection,
- kReverse_MapDirection
+ kReverse_MapDirection,
};
/**
* Map a device-space rect recursively forward or backward through the
@@ -211,7 +212,7 @@ public:
CropRect getCropRect() const { return fCropRect; }
// Default impl returns union of all input bounds.
- virtual SkRect computeFastBounds(const SkRect&) const;
+ virtual SkRect computeFastBounds(const SkRect& bounds) const;
// Can this filter DAG compute the resulting bounds of an object-space rectangle?
bool canComputeFastBounds() const;
@@ -220,7 +221,7 @@ public:
* If this filter can be represented by another filter + a localMatrix, return that filter,
* else return null.
*/
- sk_sp<SkImageFilter> makeWithLocalMatrix(const SkMatrix&) const;
+ sk_sp<SkImageFilter> makeWithLocalMatrix(const SkMatrix& matrix) const;
/**
* ImageFilters can natively handle scaling and translate components in the CTM. Only some of
@@ -433,15 +434,4 @@ private:
typedef SkFlattenable INHERITED;
};
-/**
- * Helper to unflatten the common data, and return nullptr if we fail.
- */
-#define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
- Common localVar; \
- do { \
- if (!localVar.unflatten(buffer, expectedCount)) { \
- return nullptr; \
- } \
- } while (0)
-
#endif
diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h
index 70437340b6..e2af9dda91 100644
--- a/include/core/SkPoint.h
+++ b/include/core/SkPoint.h
@@ -16,7 +16,8 @@
SkIPoint holds two 16 bit integer coordinates
*/
struct SkIPoint16 {
- int16_t fX, fY;
+ int16_t fX;
+ int16_t fY;
static SkIPoint16 Make(int x, int y) {
SkIPoint16 pt;
@@ -38,7 +39,8 @@ struct SkIPoint16 {
SkIPoint holds two 32 bit integer coordinates
*/
struct SkIPoint {
- int32_t fX, fY;
+ int32_t fX;
+ int32_t fY;
static SkIPoint Make(int32_t x, int32_t y) {
SkIPoint pt;
@@ -154,7 +156,8 @@ struct SkIPoint {
};
struct SK_API SkPoint {
- SkScalar fX, fY;
+ SkScalar fX;
+ SkScalar fY;
static SkPoint Make(SkScalar x, SkScalar y) {
SkPoint pt;
@@ -487,7 +490,7 @@ struct SK_API SkPoint {
enum Side {
kLeft_Side = -1,
kOn_Side = 0,
- kRight_Side = 1
+ kRight_Side = 1,
};
/**
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index dca38ceea5..a1024039dc 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -44,16 +44,18 @@ public:
*
* Callers are responsible for initialiazing the surface pixels.
*/
- static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes,
- const SkSurfaceProps* = nullptr);
+ static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo& imageInfo, void* pixels,
+ size_t rowBytes,
+ const SkSurfaceProps* surfaceProps = nullptr);
/**
* The same as NewRasterDirect, but also accepts a call-back routine, which is invoked
* when the surface is deleted, and is passed the pixel memory and the specified context.
*/
- static sk_sp<SkSurface> MakeRasterDirectReleaseProc(const SkImageInfo&, void* pixels, size_t rowBytes,
- void (*releaseProc)(void* pixels, void* context),
- void* context, const SkSurfaceProps* = nullptr);
+ static sk_sp<SkSurface> MakeRasterDirectReleaseProc(const SkImageInfo& imageInfo, void* pixels,
+ size_t rowBytes,
+ void (*releaseProc)(void* pixels, void* context),
+ void* context, const SkSurfaceProps* surfaceProps = nullptr);
/**
* Return a new surface, with the memory for the pixels automatically allocated and
@@ -64,14 +66,15 @@ public:
* If the requested surface cannot be created, or the request is not a
* supported configuration, NULL will be returned.
*/
- static sk_sp<SkSurface> MakeRaster(const SkImageInfo&, size_t rowBytes, const SkSurfaceProps*);
+ static sk_sp<SkSurface> MakeRaster(const SkImageInfo& imageInfo, size_t rowBytes,
+ const SkSurfaceProps* surfaceProps);
/**
* Allocate a new surface, automatically computing the rowBytes.
*/
- static sk_sp<SkSurface> MakeRaster(const SkImageInfo& info,
+ static sk_sp<SkSurface> MakeRaster(const SkImageInfo& imageInfo,
const SkSurfaceProps* props = nullptr) {
- return MakeRaster(info, 0, props);
+ return MakeRaster(imageInfo, 0, props);
}
/**
@@ -80,8 +83,8 @@ public:
* pixels in SkPMColor format.
*/
static sk_sp<SkSurface> MakeRasterN32Premul(int width, int height,
- const SkSurfaceProps* props = nullptr) {
- return MakeRaster(SkImageInfo::MakeN32Premul(width, height), props);
+ const SkSurfaceProps* surfaceProps = nullptr) {
+ return MakeRaster(SkImageInfo::MakeN32Premul(width, height), surfaceProps);
}
/**
@@ -90,15 +93,17 @@ public:
* of the SkSurface. If sampleCnt > 0, then we will create an intermediate mssa surface which
* we will use for rendering. We then resolve into the passed in texture.
*/
- static sk_sp<SkSurface> MakeFromBackendTexture(GrContext*, const GrBackendTexture&,
+ static sk_sp<SkSurface> MakeFromBackendTexture(GrContext* context,
+ const GrBackendTexture& backendTexture,
GrSurfaceOrigin origin, int sampleCnt,
- sk_sp<SkColorSpace>, const SkSurfaceProps*);
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* surfaceProps);
- static sk_sp<SkSurface> MakeFromBackendRenderTarget(GrContext*,
- const GrBackendRenderTarget&,
- GrSurfaceOrigin origin,
- sk_sp<SkColorSpace>,
- const SkSurfaceProps*);
+ static sk_sp<SkSurface> MakeFromBackendRenderTarget(GrContext* context,
+ const GrBackendRenderTarget& backendRenderTarget,
+ GrSurfaceOrigin origin,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* surfaceProps);
/**
* Used to wrap a pre-existing 3D API texture as a SkSurface. Skia will treat the texture as
@@ -107,12 +112,12 @@ public:
* ownership of the texture and the client must ensure the texture is valid for the lifetime
* of the SkSurface.
*/
- static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext*,
- const GrBackendTexture&,
- GrSurfaceOrigin origin,
- int sampleCnt,
- sk_sp<SkColorSpace>,
- const SkSurfaceProps*);
+ static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext* context,
+ const GrBackendTexture& backendTexture,
+ GrSurfaceOrigin origin,
+ int sampleCnt,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* surfaceProps);
/**
* Return a new surface whose contents will be drawn to an offscreen
@@ -120,23 +125,26 @@ public:
* that this surface may be snapped to an SkImage which will be used with mip maps so we should
* create the backend gpu RenderTarget with mips to avoid a copy later on.
*/
- static sk_sp<SkSurface> MakeRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&,
- int sampleCount, GrSurfaceOrigin,
- const SkSurfaceProps*,
+ static sk_sp<SkSurface> MakeRenderTarget(GrContext* context, SkBudgeted budgeted,
+ const SkImageInfo& imageInfo,
+ int sampleCount, GrSurfaceOrigin surfaceOrigin,
+ const SkSurfaceProps* surfaceProps,
bool shouldCreateWithMips = false);
static sk_sp<SkSurface> MakeRenderTarget(GrContext* context, SkBudgeted budgeted,
- const SkImageInfo& info, int sampleCount,
+ const SkImageInfo& imageInfo, int sampleCount,
const SkSurfaceProps* props) {
- return MakeRenderTarget(context, budgeted, info, sampleCount,
+ return MakeRenderTarget(context, budgeted, imageInfo, sampleCount,
kBottomLeft_GrSurfaceOrigin, props);
}
- static sk_sp<SkSurface> MakeRenderTarget(GrContext* gr, SkBudgeted b, const SkImageInfo& info) {
- if (!info.width() || !info.height()) {
+ static sk_sp<SkSurface> MakeRenderTarget(GrContext* context, SkBudgeted budgeted,
+ const SkImageInfo& imageInfo) {
+ if (!imageInfo.width() || !imageInfo.height()) {
return nullptr;
}
- return MakeRenderTarget(gr, b, info, 0, kBottomLeft_GrSurfaceOrigin, nullptr);
+ return MakeRenderTarget(context, budgeted, imageInfo, 0, kBottomLeft_GrSurfaceOrigin,
+ nullptr);
}
/**
@@ -207,7 +215,7 @@ public:
* The returned texture-handle is only valid until the next draw-call into the surface,
* or the surface is deleted.
*/
- GrBackendObject getTextureHandle(BackendHandleAccess);
+ GrBackendObject getTextureHandle(BackendHandleAccess backendHandleAccess);
/**
* Retrieves the backend API handle of the RenderTarget backing this surface. Callers must
@@ -215,7 +223,8 @@ public:
*
* In OpenGL this will return the FramebufferObject ID.
*/
- bool getRenderTargetHandle(GrBackendObject*, BackendHandleAccess);
+ bool getRenderTargetHandle(GrBackendObject* backendObject,
+ BackendHandleAccess backendHandleAccess);
/**
* Return a canvas that will draw into this surface. This will always
@@ -238,7 +247,7 @@ public:
* ... // draw using canvasB
* canvasA->drawSurface(surfaceB); // <--- this will always be optimal!
*/
- sk_sp<SkSurface> makeSurface(const SkImageInfo&);
+ sk_sp<SkSurface> makeSurface(const SkImageInfo& imageInfo);
/**
* Returns an image of the current state of the surface pixels up to this
@@ -255,7 +264,7 @@ public:
* we'd know that the "snapshot" need only live until we've handed it off
* to the canvas.
*/
- void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);
+ void draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint);
/**
* If the surface has direct access to its pixels (i.e. they are in local
@@ -266,7 +275,7 @@ public:
*
* On failure, returns false and the pixmap parameter is ignored.
*/
- bool peekPixels(SkPixmap*);
+ bool peekPixels(SkPixmap* pixmap);
/**
* Copy the pixels from the surface into the specified pixmap,
@@ -356,8 +365,8 @@ public:
void draw(SkDeferredDisplayList* deferredDisplayList);
protected:
- SkSurface(int width, int height, const SkSurfaceProps*);
- SkSurface(const SkImageInfo&, const SkSurfaceProps*);
+ SkSurface(int width, int height, const SkSurfaceProps* surfaceProps);
+ SkSurface(const SkImageInfo& imageInfo, const SkSurfaceProps* surfaceProps);
// called by subclass if their contents have changed
void dirtyGenerationID() {
diff --git a/src/core/SkBlurImageFilter.cpp b/src/core/SkBlurImageFilter.cpp
index 4bfba17804..bb2da09976 100644
--- a/src/core/SkBlurImageFilter.cpp
+++ b/src/core/SkBlurImageFilter.cpp
@@ -14,6 +14,7 @@
#include "SkBitmap.h"
#include "SkColorData.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkTFitsIn.h"
#include "SkGpuBlurUtils.h"
#include "SkNx.h"
diff --git a/src/core/SkImageFilterPriv.h b/src/core/SkImageFilterPriv.h
new file mode 100644
index 0000000000..dff3e0c68a
--- /dev/null
+++ b/src/core/SkImageFilterPriv.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkImageFilterPriv_DEFINED
+#define SkImageFilterPriv_DEFINED
+
+#include "SkImageFilter.h"
+
+/**
+ * Helper to unflatten the common data, and return nullptr if we fail.
+ */
+#define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
+ Common localVar; \
+ do { \
+ if (!localVar.unflatten(buffer, expectedCount)) { \
+ return nullptr; \
+ } \
+ } while (0)
+
+#endif
diff --git a/src/core/SkLocalMatrixImageFilter.cpp b/src/core/SkLocalMatrixImageFilter.cpp
index 255ab7686e..000684cd2f 100644
--- a/src/core/SkLocalMatrixImageFilter.cpp
+++ b/src/core/SkLocalMatrixImageFilter.cpp
@@ -6,6 +6,7 @@
*/
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkLocalMatrixImageFilter.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
diff --git a/src/core/SkMatrixImageFilter.cpp b/src/core/SkMatrixImageFilter.cpp
index 513045148e..3531d183cc 100644
--- a/src/core/SkMatrixImageFilter.cpp
+++ b/src/core/SkMatrixImageFilter.cpp
@@ -9,6 +9,7 @@
#include "SkCanvas.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkSpecialSurface.h"
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index e7dfa5f252..435594423f 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -9,6 +9,7 @@
#include "SkBitmap.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkWriteBuffer.h"
diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp
index a4d6ffe7dd..0a85cdacc2 100644
--- a/src/effects/SkArithmeticImageFilter.cpp
+++ b/src/effects/SkArithmeticImageFilter.cpp
@@ -8,6 +8,7 @@
#include "SkArithmeticImageFilter.h"
#include "SkCanvas.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkNx.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 6e81bf3025..50861fe78b 100644
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -10,6 +10,7 @@
#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkSpecialSurface.h"
diff --git a/src/effects/SkComposeImageFilter.cpp b/src/effects/SkComposeImageFilter.cpp
index ad841d0ed9..f49870eabe 100644
--- a/src/effects/SkComposeImageFilter.cpp
+++ b/src/effects/SkComposeImageFilter.cpp
@@ -7,6 +7,7 @@
#include "SkComposeImageFilter.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkWriteBuffer.h"
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 09aaf7cc4b..14a1f66053 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -9,6 +9,7 @@
#include "SkBitmap.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkWriteBuffer.h"
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index 7d0d90587e..ab1b2a5c7e 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -10,6 +10,7 @@
#include "SkBlurImageFilter.h"
#include "SkCanvas.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkSpecialSurface.h"
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 06a658f770..b538afbf56 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -9,6 +9,7 @@
#include "SkBitmap.h"
#include "SkColorData.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkPoint3.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index dd5714ba75..c5b3396c90 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -10,6 +10,7 @@
#include "SkBitmap.h"
#include "SkColorData.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkWriteBuffer.h"
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index a31ee3db33..de73353219 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -9,6 +9,7 @@
#include "SkBitmap.h"
#include "SkColorData.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkWriteBuffer.h"
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 07c420b9f4..8b0f13a860 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -10,6 +10,7 @@
#include "SkBitmap.h"
#include "SkColorData.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkOpts.h"
#include "SkReadBuffer.h"
#include "SkRect.h"
diff --git a/src/effects/SkOffsetImageFilter.cpp b/src/effects/SkOffsetImageFilter.cpp
index 0c2949f0e3..3852523c11 100644
--- a/src/effects/SkOffsetImageFilter.cpp
+++ b/src/effects/SkOffsetImageFilter.cpp
@@ -8,6 +8,7 @@
#include "SkOffsetImageFilter.h"
#include "SkColorSpaceXformer.h"
#include "SkCanvas.h"
+#include "SkImageFilterPriv.h"
#include "SkMatrix.h"
#include "SkPaint.h"
#include "SkReadBuffer.h"
diff --git a/src/effects/SkPaintImageFilter.cpp b/src/effects/SkPaintImageFilter.cpp
index 5e47e82471..efae89b029 100644
--- a/src/effects/SkPaintImageFilter.cpp
+++ b/src/effects/SkPaintImageFilter.cpp
@@ -8,6 +8,7 @@
#include "SkPaintImageFilter.h"
#include "SkCanvas.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkSpecialSurface.h"
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp
index 59e6e29fee..a90f98d781 100644
--- a/src/effects/SkTileImageFilter.cpp
+++ b/src/effects/SkTileImageFilter.cpp
@@ -9,6 +9,7 @@
#include "SkColorSpaceXformer.h"
#include "SkCanvas.h"
#include "SkImage.h"
+#include "SkImageFilterPriv.h"
#include "SkMatrix.h"
#include "SkOffsetImageFilter.h"
#include "SkPaint.h"
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 111dc61a56..57c4c575fa 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -10,6 +10,7 @@
#include "SkCanvas.h"
#include "SkColorData.h"
#include "SkColorSpaceXformer.h"
+#include "SkImageFilterPriv.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkSpecialSurface.h"
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 59f0f2853b..0433d0167c 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -18,6 +18,7 @@
#include "SkFlattenableSerialization.h"
#include "SkGradientShader.h"
#include "SkImage.h"
+#include "SkImageFilterPriv.h"
#include "SkImageSource.h"
#include "SkLightingImageFilter.h"
#include "SkMatrixConvolutionImageFilter.h"
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 8c6b03cebf..19e403530f 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -16,6 +16,7 @@
#include "SkDocument.h"
#include "SkDeflate.h"
#include "SkImageEncoder.h"
+#include "SkImageFilterPriv.h"
#include "SkMakeUnique.h"
#include "SkMatrix.h"
#include "SkPDFCanon.h"