Hide ctors of SkShader, SkImage & SkColorSpace

To prevent external clients from subclassing.

Change-Id: I60a3833bf64019aea2f537850ca2a1ae38bb8767
Reviewed-on: https://skia-review.googlesource.com/18038
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Florin Malita 2017-05-26 12:54:32 -04:00 committed by Skia Commit-Bot
parent 5addedd59d
commit f7beee7cdd
5 changed files with 15 additions and 11 deletions

View File

@ -164,8 +164,11 @@ public:
*/
static bool Equals(const SkColorSpace* src, const SkColorSpace* dst);
protected:
SkColorSpace() {}
private:
SkColorSpace() = default;
friend class SkColorSpace_Base;
using INHERITED = SkRefCnt;
};
enum class SkTransferFunctionBehavior {

View File

@ -517,10 +517,10 @@ public:
sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> target,
SkTransferFunctionBehavior premulBehavior) const;
protected:
SkImage(int width, int height, uint32_t uniqueID);
private:
SkImage(int width, int height, uint32_t uniqueID);
friend class SkImage_Base;
static sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&,
const GrMipLevel* texels, int mipLevelCount,
SkBudgeted, SkDestinationSurfaceColorMode);

View File

@ -255,10 +255,10 @@ public:
// TODO: clean up clients, move to SkShaderBase.
virtual sk_sp<SkShader> makeAsALocalMatrixShader(SkMatrix* localMatrix) const;
protected:
SkShader() = default;
private:
SkShader() = default;
friend class SkShaderBase;
typedef SkFlattenable INHERITED;
};

View File

@ -24,8 +24,6 @@ class SkRasterPipeline;
class SkShaderBase : public SkShader {
public:
SkShaderBase(const SkMatrix* localMatrix = nullptr);
~SkShaderBase() override;
/**
@ -229,6 +227,8 @@ public:
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
protected:
SkShaderBase(const SkMatrix* localMatrix = nullptr);
void flatten(SkWriteBuffer&) const override;
/**

View File

@ -28,7 +28,6 @@ enum {
class SkImage_Base : public SkImage {
public:
SkImage_Base(int width, int height, uint32_t uniqueID);
virtual ~SkImage_Base();
// User: returns image info for this SkImage.
@ -93,6 +92,8 @@ public:
virtual sk_sp<SkImage> onMakeColorSpace(sk_sp<SkColorSpace>, SkColorType,
SkTransferFunctionBehavior) const = 0;
protected:
SkImage_Base(int width, int height, uint32_t uniqueID);
private:
// Set true by caches when they cache content that's derived from the current pixels.