aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/android/SkBitmapRegionCodec.cpp2
-rw-r--r--src/codec/SkBmpRLECodec.cpp2
-rw-r--r--src/codec/SkBmpRLECodec.h22
-rw-r--r--src/codec/SkBmpStandardCodec.cpp2
-rw-r--r--src/codec/SkBmpStandardCodec.h20
-rw-r--r--src/codec/SkPngCodec.cpp2
-rw-r--r--src/codec/SkPngCodec.h16
-rw-r--r--src/codec/SkWbmpCodec.h8
-rw-r--r--src/effects/GrCircleBlurFragmentProcessor.cpp8
-rw-r--r--src/effects/SkBlurMaskFilter.cpp5
-rw-r--r--src/effects/SkColorCubeFilter.cpp7
-rw-r--r--src/effects/SkLightingImageFilter.cpp15
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp6
-rw-r--r--src/effects/SkTableColorFilter.cpp4
-rw-r--r--src/effects/gradients/SkGradientShader.cpp11
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h8
-rw-r--r--src/fonts/SkFontMgr_indirect.cpp10
-rw-r--r--src/image/SkImage.cpp4
-rw-r--r--src/image/SkImageShader.cpp9
-rw-r--r--src/image/SkImage_Gpu.cpp2
-rw-r--r--src/image/SkSurface_Raster.cpp6
-rw-r--r--src/pdf/SkPDFDevice.cpp2
-rw-r--r--src/ports/SkFontHost_mac.cpp2
-rw-r--r--src/ports/SkFontHost_win.cpp2
-rw-r--r--src/ports/SkFontMgr_FontConfigInterface.cpp4
-rw-r--r--src/ports/SkFontMgr_android.cpp6
-rw-r--r--src/ports/SkFontMgr_custom.cpp2
-rw-r--r--src/ports/SkFontMgr_fontconfig.cpp4
-rw-r--r--src/ports/SkFontMgr_win_dw.cpp6
-rw-r--r--src/ports/SkRemotableFontMgr_win_dw.cpp4
-rw-r--r--src/svg/SkSVGCanvas.cpp4
-rw-r--r--src/svg/SkSVGDevice.cpp4
-rw-r--r--src/utils/SkCanvasStateUtils.cpp8
-rw-r--r--src/utils/SkWhitelistTypefaces.cpp4
-rw-r--r--src/xps/SkDocument_XPS.cpp2
35 files changed, 112 insertions, 111 deletions
diff --git a/src/android/SkBitmapRegionCodec.cpp b/src/android/SkBitmapRegionCodec.cpp
index 7c51fc80d3..973e3c9470 100644
--- a/src/android/SkBitmapRegionCodec.cpp
+++ b/src/android/SkBitmapRegionCodec.cpp
@@ -60,7 +60,7 @@ bool SkBitmapRegionCodec::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocat
dstColorType, dstAlphaType, colorSpace);
// Construct a color table for the decode if necessary
- SkAutoTUnref<SkColorTable> colorTable(nullptr);
+ sk_sp<SkColorTable> colorTable(nullptr);
int maxColors = 256;
SkPMColor colors[256];
if (kIndex_8_SkColorType == dstColorType) {
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index b8013093fb..0bc6f60542 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -291,7 +291,7 @@ SkCodec::Result SkBmpRLECodec::onPrepareToDecode(const SkImageInfo& dstInfo,
}
// Copy the color table to the client if necessary
- copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount);
+ copy_color_table(dstInfo, fColorTable.get(), inputColorPtr, inputColorCount);
// Initialize a buffer for encoded RLE data
fRLEBytes = fOrigRLEBytes;
diff --git a/src/codec/SkBmpRLECodec.h b/src/codec/SkBmpRLECodec.h
index 5f348618a9..7cb3e9b292 100644
--- a/src/codec/SkBmpRLECodec.h
+++ b/src/codec/SkBmpRLECodec.h
@@ -95,23 +95,23 @@ private:
SkSampler* getSampler(bool createIfNecessary) override;
- SkAutoTUnref<SkColorTable> fColorTable; // owned
+ sk_sp<SkColorTable> fColorTable;
// fNumColors is the number specified in the header, or 0 if not present in the header.
- const uint32_t fNumColors;
- const uint32_t fBytesPerColor;
- const uint32_t fOffset;
- std::unique_ptr<uint8_t[]> fStreamBuffer;
- size_t fRLEBytes;
- const size_t fOrigRLEBytes;
- uint32_t fCurrRLEByte;
- int fSampleX;
- std::unique_ptr<SkSampler> fSampler;
+ const uint32_t fNumColors;
+ const uint32_t fBytesPerColor;
+ const uint32_t fOffset;
+ std::unique_ptr<uint8_t[]> fStreamBuffer;
+ size_t fRLEBytes;
+ const size_t fOrigRLEBytes;
+ uint32_t fCurrRLEByte;
+ int fSampleX;
+ std::unique_ptr<SkSampler> fSampler;
// Scanline decodes allow the client to ask for a single scanline at a time.
// This can be tricky when the RLE encoding instructs the decoder to jump down
// multiple lines. This field keeps track of lines that need to be skipped
// on subsequent calls to decodeRows().
- int fLinesToSkip;
+ int fLinesToSkip;
typedef SkBmpCodec INHERITED;
};
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 9b346f3be6..004c2571d5 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -215,7 +215,7 @@ SkCodec::Result SkBmpStandardCodec::onPrepareToDecode(const SkImageInfo& dstInfo
}
// Copy the color table to the client if necessary
- copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount);
+ copy_color_table(dstInfo, fColorTable.get(), inputColorPtr, inputColorCount);
// Initialize a swizzler
this->initializeSwizzler(dstInfo, options);
diff --git a/src/codec/SkBmpStandardCodec.h b/src/codec/SkBmpStandardCodec.h
index 12c12e8893..61b2792404 100644
--- a/src/codec/SkBmpStandardCodec.h
+++ b/src/codec/SkBmpStandardCodec.h
@@ -84,17 +84,17 @@ private:
*/
void decodeIcoMask(SkStream* stream, const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes);
- SkAutoTUnref<SkColorTable> fColorTable; // owned
+ sk_sp<SkColorTable> fColorTable;
// fNumColors is the number specified in the header, or 0 if not present in the header.
- const uint32_t fNumColors;
- const uint32_t fBytesPerColor;
- const uint32_t fOffset;
- std::unique_ptr<SkSwizzler> fSwizzler;
- std::unique_ptr<uint8_t[]> fSrcBuffer;
- const bool fIsOpaque;
- const bool fInIco;
- const size_t fAndMaskRowBytes; // only used for fInIco decodes
- bool fXformOnDecode;
+ const uint32_t fNumColors;
+ const uint32_t fBytesPerColor;
+ const uint32_t fOffset;
+ std::unique_ptr<SkSwizzler> fSwizzler;
+ std::unique_ptr<uint8_t[]> fSrcBuffer;
+ const bool fIsOpaque;
+ const bool fInIco;
+ const size_t fAndMaskRowBytes; // only used for fInIco decodes
+ bool fXformOnDecode;
typedef SkBmpCodec INHERITED;
};
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 8297dd49be..3cf972dc76 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -1084,7 +1084,7 @@ bool SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const Options& opt
}
// Copy the color table to the client if they request kIndex8 mode.
- copy_color_table(dstInfo, fColorTable, ctable, ctableCount);
+ copy_color_table(dstInfo, fColorTable.get(), ctable, ctableCount);
this->initializeSwizzler(dstInfo, options);
return true;
diff --git a/src/codec/SkPngCodec.h b/src/codec/SkPngCodec.h
index 2c427cac95..590a631a20 100644
--- a/src/codec/SkPngCodec.h
+++ b/src/codec/SkPngCodec.h
@@ -91,16 +91,16 @@ protected:
SkPMColor* ctable, int* ctableCount) override;
Result onIncrementalDecode(int*) override;
- SkAutoTUnref<SkPngChunkReader> fPngChunkReader;
- voidp fPng_ptr;
- voidp fInfo_ptr;
+ sk_sp<SkPngChunkReader> fPngChunkReader;
+ voidp fPng_ptr;
+ voidp fInfo_ptr;
// These are stored here so they can be used both by normal decoding and scanline decoding.
- SkAutoTUnref<SkColorTable> fColorTable; // May be unpremul.
- std::unique_ptr<SkSwizzler> fSwizzler;
- SkAutoTMalloc<uint8_t> fStorage;
- uint32_t* fColorXformSrcRow;
- const int fBitDepth;
+ sk_sp<SkColorTable> fColorTable; // May be unpremul.
+ std::unique_ptr<SkSwizzler> fSwizzler;
+ SkAutoTMalloc<uint8_t> fStorage;
+ uint32_t* fColorXformSrcRow;
+ const int fBitDepth;
private:
diff --git a/src/codec/SkWbmpCodec.h b/src/codec/SkWbmpCodec.h
index 3c8df02388..6946ea0a66 100644
--- a/src/codec/SkWbmpCodec.h
+++ b/src/codec/SkWbmpCodec.h
@@ -46,12 +46,12 @@ private:
SkWbmpCodec(int width, int height, const SkEncodedInfo&, SkStream*);
- const size_t fSrcRowBytes;
+ const size_t fSrcRowBytes;
// Used for scanline decodes:
- std::unique_ptr<SkSwizzler> fSwizzler;
- SkAutoTUnref<SkColorTable> fColorTable;
- SkAutoTMalloc<uint8_t> fSrcBuffer;
+ std::unique_ptr<SkSwizzler> fSwizzler;
+ sk_sp<SkColorTable> fColorTable;
+ SkAutoTMalloc<uint8_t> fSrcBuffer;
int onGetScanlines(void* dst, int count, size_t dstRowBytes) override;
bool onSkipScanlines(int count) override;
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index eaa8ba9ac1..d5ed6b712a 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -335,13 +335,13 @@ sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(GrTextureProvider
const SkRect& circle, float sigma) {
float solidRadius;
float textureRadius;
- SkAutoTUnref<GrTexture> profile(create_profile_texture(textureProvider, circle, sigma,
- &solidRadius, &textureRadius));
+ sk_sp<GrTexture> profile(create_profile_texture(textureProvider, circle, sigma,
+ &solidRadius, &textureRadius));
if (!profile) {
return nullptr;
}
- return sk_sp<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(circle, textureRadius,
- solidRadius, profile));
+ return sk_sp<GrFragmentProcessor>(
+ new GrCircleBlurFragmentProcessor(circle, textureRadius, solidRadius, profile.get()));
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index dcacf82afc..0a98fa8c3a 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -777,7 +777,7 @@ public:
return nullptr;
}
- SkAutoTUnref<GrTexture> blurProfile(CreateBlurProfileTexture(textureProvider, sigma));
+ sk_sp<GrTexture> blurProfile(CreateBlurProfileTexture(textureProvider, sigma));
if (!blurProfile) {
return nullptr;
}
@@ -800,8 +800,9 @@ public:
} else {
precision = kDefault_GrSLPrecision;
}
+
return sk_sp<GrFragmentProcessor>(
- new GrRectBlurEffect(rect, sigma, blurProfile, precision));
+ new GrRectBlurEffect(rect, sigma, blurProfile.get(), precision));
}
const SkRect& getRect() const { return fRect; }
diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp
index 2a921d8e50..2c8ab6f225 100644
--- a/src/effects/SkColorCubeFilter.cpp
+++ b/src/effects/SkColorCubeFilter.cpp
@@ -313,18 +313,17 @@ sk_sp<GrFragmentProcessor> SkColorCubeFilter::asFragmentProcessor(GrContext* con
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fIsMipMapped = false;
- SkAutoTUnref<GrTexture> textureCube(
- context->textureProvider()->findAndRefTextureByUniqueKey(key));
+ sk_sp<GrTexture> textureCube(context->textureProvider()->findAndRefTextureByUniqueKey(key));
if (!textureCube) {
textureCube.reset(context->textureProvider()->createTexture(
desc, SkBudgeted::kYes, fCubeData->data(), 0));
if (textureCube) {
- context->textureProvider()->assignUniqueKeyToTexture(key, textureCube);
+ context->textureProvider()->assignUniqueKeyToTexture(key, textureCube.get());
} else {
return nullptr;
}
}
- return sk_sp<GrFragmentProcessor>(GrColorCubeEffect::Make(textureCube));
+ return sk_sp<GrFragmentProcessor>(GrColorCubeEffect::Make(textureCube.get()));
}
#endif
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index fc106911b7..703930d6e7 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1763,7 +1763,7 @@ sk_sp<GrFragmentProcessor> GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa
GrTexture* tex = d->fTextures[texIdx];
SkScalar surfaceScale = d->fRandom->nextSScalar1();
SkScalar kd = d->fRandom->nextUScalar1();
- SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom));
+ sk_sp<SkImageFilterLight> light(create_random_light(d->fRandom));
SkMatrix matrix;
for (int i = 0; i < 9; i++) {
matrix[i] = d->fRandom->nextUScalar1();
@@ -1773,7 +1773,8 @@ sk_sp<GrFragmentProcessor> GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa
d->fRandom->nextRangeU(0, tex->width()),
d->fRandom->nextRangeU(0, tex->height()));
BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundaryModeCount);
- return GrDiffuseLightingEffect::Make(tex, light, surfaceScale, matrix, kd, mode, &srcBounds);
+ return GrDiffuseLightingEffect::Make(tex, light.get(), surfaceScale, matrix, kd, mode,
+ &srcBounds);
}
@@ -1899,10 +1900,10 @@ void GrGLLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman,
float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
pdman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->height());
pdman.set1f(fSurfaceScaleUni, lighting.surfaceScale());
- SkAutoTUnref<SkImageFilterLight> transformedLight(
- lighting.light()->transform(lighting.filterMatrix()));
+ sk_sp<SkImageFilterLight> transformedLight(
+ lighting.light()->transform(lighting.filterMatrix()));
fDomain.setData(pdman, lighting.domain(), texture->origin());
- fLight->setData(pdman, transformedLight);
+ fLight->setData(pdman, transformedLight.get());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1981,7 +1982,7 @@ sk_sp<GrFragmentProcessor> GrSpecularLightingEffect::TestCreate(GrProcessorTestD
SkScalar surfaceScale = d->fRandom->nextSScalar1();
SkScalar ks = d->fRandom->nextUScalar1();
SkScalar shininess = d->fRandom->nextUScalar1();
- SkAutoTUnref<SkImageFilterLight> light(create_random_light(d->fRandom));
+ sk_sp<SkImageFilterLight> light(create_random_light(d->fRandom));
SkMatrix matrix;
for (int i = 0; i < 9; i++) {
matrix[i] = d->fRandom->nextUScalar1();
@@ -1992,7 +1993,7 @@ sk_sp<GrFragmentProcessor> GrSpecularLightingEffect::TestCreate(GrProcessorTestD
d->fRandom->nextRangeU(0, tex->width()),
d->fRandom->nextRangeU(0, tex->height()));
return GrSpecularLightingEffect::Make(d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx],
- light, surfaceScale, matrix, ks, shininess, mode,
+ light.get(), surfaceScale, matrix, ks, shininess, mode,
&srcBounds);
}
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 06bf8135ca..87db93d303 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -924,10 +924,10 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(const AsFPAr
SkPerlinNoiseShader::PaintingData* paintingData =
new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
- SkAutoTUnref<GrTexture> permutationsTexture(
+ sk_sp<GrTexture> permutationsTexture(
GrRefCachedBitmapTexture(args.fContext, paintingData->getPermutationsBitmap(),
GrTextureParams::ClampNoFilter(), args.fGammaTreatment));
- SkAutoTUnref<GrTexture> noiseTexture(
+ sk_sp<GrTexture> noiseTexture(
GrRefCachedBitmapTexture(args.fContext, paintingData->getNoiseBitmap(),
GrTextureParams::ClampNoFilter(), args.fGammaTreatment));
@@ -940,7 +940,7 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(const AsFPAr
fNumOctaves,
fStitchTiles,
paintingData,
- permutationsTexture, noiseTexture,
+ permutationsTexture.get(), noiseTexture.get(),
m));
return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
}
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 75910882c4..289dee7aee 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -470,7 +470,7 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, SkBitmap b
desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->caps());
GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc);
int row = atlas->lockRow(bitmap);
- SkAutoTUnref<GrTexture> texture;
+ sk_sp<GrTexture> texture;
if (-1 == row) {
atlas = nullptr;
texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams::ClampNoFilter(),
@@ -479,7 +479,7 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, SkBitmap b
texture.reset(SkRef(atlas->getTexture()));
}
- return sk_sp<GrFragmentProcessor>(new ColorTableEffect(texture, atlas, row, flags));
+ return sk_sp<GrFragmentProcessor>(new ColorTableEffect(texture.get(), atlas, row, flags));
}
ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row,
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 96817a0ed1..0bd9c8748d 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -666,7 +666,7 @@ void SkGradientShaderBase::initLinearBitmap(SkBitmap* bitmap) const {
* The gradient holds a cache for the most recent value of alpha. Successive
* callers with the same alpha value will share the same cache.
*/
-SkGradientShaderBase::GradientShaderCache* SkGradientShaderBase::refCache(U8CPU alpha,
+sk_sp<SkGradientShaderBase::GradientShaderCache> SkGradientShaderBase::refCache(U8CPU alpha,
bool dither) const {
SkAutoMutexAcquire ama(fCacheMutex);
if (!fCache || fCache->getAlpha() != alpha || fCache->getDither() != dither) {
@@ -675,7 +675,6 @@ SkGradientShaderBase::GradientShaderCache* SkGradientShaderBase::refCache(U8CPU
// Increment the ref counter inside the mutex to ensure the returned pointer is still valid.
// Otherwise, the pointer may have been overwritten on a different thread before the object's
// ref count was incremented.
- fCache.get()->ref();
return fCache;
}
@@ -691,7 +690,7 @@ SK_DECLARE_STATIC_MUTEX(gGradientCacheMutex);
void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap,
GradientBitmapType bitmapType) const {
// our caller assumes no external alpha, so we ensure that our cache is built with 0xFF
- SkAutoTUnref<GradientShaderCache> cache(this->refCache(0xFF, true));
+ sk_sp<GradientShaderCache> cache(this->refCache(0xFF, true));
// build our key: [numColors + colors[] + {positions[]} + flags + colorType ]
int count = 1 + fColorCount + 1 + 1;
@@ -1662,14 +1661,14 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args) {
fCoordTransform.reset(*args.fMatrix, fAtlas->getTexture(), params.filterMode());
fTextureAccess.reset(fAtlas->getTexture(), params);
} else {
- SkAutoTUnref<GrTexture> texture(
+ sk_sp<GrTexture> texture(
GrRefCachedBitmapTexture(args.fContext, bitmap, params,
SkSourceGammaTreatment::kRespect));
if (!texture) {
return;
}
- fCoordTransform.reset(*args.fMatrix, texture, params.filterMode());
- fTextureAccess.reset(texture, params);
+ fCoordTransform.reset(*args.fMatrix, texture.get(), params.filterMode());
+ fTextureAccess.reset(texture.get(), params);
fYCoord = SK_ScalarHalf;
}
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index cbffea1f2f..2e447ca1d7 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -167,7 +167,7 @@ public:
uint8_t fFlags;
bool fDither;
- SkAutoTUnref<GradientShaderCache> fCache;
+ sk_sp<GradientShaderCache> fCache;
private:
typedef SkShader::Context INHERITED;
@@ -267,9 +267,9 @@ public:
private:
bool fColorsAreOpaque;
- GradientShaderCache* refCache(U8CPU alpha, bool dither) const;
- mutable SkMutex fCacheMutex;
- mutable SkAutoTUnref<GradientShaderCache> fCache;
+ sk_sp<GradientShaderCache> refCache(U8CPU alpha, bool dither) const;
+ mutable SkMutex fCacheMutex;
+ mutable sk_sp<GradientShaderCache> fCache;
void initCommon();
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp
index 41447ac995..f594e2d888 100644
--- a/src/fonts/SkFontMgr_indirect.cpp
+++ b/src/fonts/SkFontMgr_indirect.cpp
@@ -55,9 +55,9 @@ public:
return this->matchStyleCSS3(pattern);
}
private:
- SkAutoTUnref<const SkFontMgr_Indirect> fOwner;
+ sk_sp<const SkFontMgr_Indirect> fOwner;
int fFamilyIndex;
- SkAutoTUnref<SkRemotableFontIdentitySet> fData;
+ sk_sp<SkRemotableFontIdentitySet> fData;
};
void SkFontMgr_Indirect::set_up_family_names(const SkFontMgr_Indirect* self) {
@@ -97,7 +97,7 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i
SkAutoMutexAcquire ama(fDataCacheMutex);
- SkAutoTUnref<SkTypeface> dataTypeface;
+ sk_sp<SkTypeface> dataTypeface;
int dataTypefaceIndex = 0;
for (int i = 0; i < fDataCache.count(); ++i) {
const DataEntry& entry = fDataCache[i];
@@ -135,7 +135,7 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i
return nullptr;
}
- SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream.release(), id.fTtcIndex));
+ sk_sp<SkTypeface> typeface(fImpl->createFromStream(stream.release(), id.fTtcIndex));
if (typeface.get() == nullptr) {
return nullptr;
}
@@ -186,7 +186,7 @@ SkTypeface* SkFontMgr_Indirect::onCreateFromData(SkData* data, int ttcIndex) con
SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
SkFontStyle style) const {
- SkAutoTUnref<SkTypeface> face(this->matchFamilyStyle(familyName, style));
+ sk_sp<SkTypeface> face(this->matchFamilyStyle(familyName, style));
if (nullptr == face.get()) {
face.reset(this->matchFamilyStyle(nullptr, style));
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 334984dfcb..22cb5cb540 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -109,7 +109,7 @@ SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
}
SkData* SkImage::encode(SkPixelSerializer* serializer) const {
- SkAutoTUnref<SkPixelSerializer> defaultSerializer;
+ sk_sp<SkPixelSerializer> defaultSerializer;
SkPixelSerializer* effectiveSerializer = serializer;
if (!effectiveSerializer) {
defaultSerializer.reset(SkImageEncoder::CreatePixelSerializer());
@@ -321,7 +321,7 @@ sk_sp<SkImage> SkImage::makeWithFilter(const SkImageFilter* filter, const SkIRec
return nullptr;
}
- SkAutoTUnref<SkImageFilterCache> cache(
+ sk_sp<SkImageFilterCache> cache(
SkImageFilterCache::Create(SkImageFilterCache::kDefaultTransientSize));
SkImageFilter::OutputProperties outputProperties(as_IB(this)->onImageInfo().colorSpace());
SkImageFilter::Context context(SkMatrix::I(), clipBounds, cache.get(), outputProperties);
diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp
index a1882ab665..f58228c56c 100644
--- a/src/image/SkImageShader.cpp
+++ b/src/image/SkImageShader.cpp
@@ -210,8 +210,8 @@ sk_sp<GrFragmentProcessor> SkImageShader::asFragmentProcessor(const AsFPArgs& ar
GrSkFilterQualityToGrFilterMode(args.fFilterQuality, *args.fViewMatrix, this->getLocalMatrix(),
&doBicubic);
GrTextureParams params(tm, textureFilterMode);
- SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(args.fContext, params,
- args.fGammaTreatment));
+ sk_sp<GrTexture> texture(as_IB(fImage)->asTextureRef(args.fContext, params,
+ args.fGammaTreatment));
if (!texture) {
return nullptr;
}
@@ -221,9 +221,10 @@ sk_sp<GrFragmentProcessor> SkImageShader::asFragmentProcessor(const AsFPArgs& ar
args.fDstColorSpace);
sk_sp<GrFragmentProcessor> inner;
if (doBicubic) {
- inner = GrBicubicEffect::Make(texture, std::move(colorSpaceXform), matrix, tm);
+ inner = GrBicubicEffect::Make(texture.get(), std::move(colorSpaceXform), matrix, tm);
} else {
- inner = GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform), matrix, params);
+ inner = GrSimpleTextureEffect::Make(texture.get(), std::move(colorSpaceXform),
+ matrix, params);
}
if (GrPixelConfigIsAlphaOnly(texture->config())) {
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index e993002234..5e2d1a5018 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -663,7 +663,7 @@ sk_sp<SkImage> SkImage::MakeFromDeferredTextureImageData(GrContext* context, con
if (!context || context->uniqueID() != dti->fContextUniqueID) {
return nullptr;
}
- SkAutoTUnref<SkColorTable> colorTable;
+ sk_sp<SkColorTable> colorTable;
if (dti->fColorTableCnt) {
SkASSERT(dti->fColorTableData);
colorTable.reset(new SkColorTable(dti->fColorTableData, dti->fColorTableCnt));
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index c27e1bc91d..987ff2bbb0 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -208,12 +208,12 @@ sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, size_t rowBytes,
return nullptr;
}
- SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, rowBytes, nullptr));
- if (nullptr == pr.get()) {
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, rowBytes, nullptr));
+ if (!pr) {
return nullptr;
}
if (rowBytes) {
SkASSERT(pr->rowBytes() == rowBytes);
}
- return sk_make_sp<SkSurface_Raster>(pr, props);
+ return sk_make_sp<SkSurface_Raster>(pr.get(), props);
}
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 88bcc8444e..a04b380005 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -2289,7 +2289,7 @@ void SkPDFDevice::drawSpecial(const SkDraw& draw, SkSpecialImage* srcImg, int x,
SkMatrix matrix = *draw.fMatrix;
matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y);
- SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache());
+ sk_sp<SkImageFilterCache> cache(this->getImageFilterCache());
// TODO: Should PDF be operating in a specified color space? For now, run the filter
// in the same color space as the source (this is different from all other backends).
SkImageFilter::OutputProperties outputProperties(srcImg->getColorSpace());
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 6023375152..a9b9a2a70e 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -2317,7 +2317,7 @@ protected:
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
const SkFontStyle& fontStyle) const override {
- SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName));
+ sk_sp<SkFontStyleSet> sset(this->matchFamily(familyName));
return sset->matchStyle(fontStyle);
}
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index a3264a8924..77465ceff4 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2435,7 +2435,7 @@ protected:
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
const SkFontStyle& fontstyle) const override {
// could be in base impl
- SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName));
+ sk_sp<SkFontStyleSet> sset(this->matchFamily(familyName));
return sset->matchStyle(fontstyle);
}
diff --git a/src/ports/SkFontMgr_FontConfigInterface.cpp b/src/ports/SkFontMgr_FontConfigInterface.cpp
index 404ae9842e..a8838046c5 100644
--- a/src/ports/SkFontMgr_FontConfigInterface.cpp
+++ b/src/ports/SkFontMgr_FontConfigInterface.cpp
@@ -114,7 +114,7 @@ private:
SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return nullptr; }
std::unique_ptr<Request> fRequest;
- SkAutoTUnref<SkTypeface> fFace;
+ sk_sp<SkTypeface> fFace;
};
SkResourceCache fCachedResults;
@@ -133,7 +133,7 @@ public:
const Result& result = static_cast<const Result&>(rec);
SkTypeface** face = static_cast<SkTypeface**>(context);
- *face = result.fFace;
+ *face = result.fFace.get();
return true;
}, &face);
return SkSafeRef(face);
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 3a84ecad8b..116bc01549 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -237,7 +237,7 @@ public:
}
private:
- SkTArray<SkAutoTUnref<SkTypeface_AndroidSystem>, true> fStyles;
+ SkTArray<sk_sp<SkTypeface_AndroidSystem>, true> fStyles;
friend struct NameToFamily;
friend class SkFontMgr_Android;
@@ -323,7 +323,7 @@ protected:
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
const SkFontStyle& style) const override {
- SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName));
+ sk_sp<SkFontStyleSet> sset(this->matchFamily(familyName));
return sset->matchStyle(style);
}
@@ -331,7 +331,7 @@ protected:
const SkFontStyle& style) const override {
for (int i = 0; i < fStyleSets.count(); ++i) {
for (int j = 0; j < fStyleSets[i]->fStyles.count(); ++j) {
- if (fStyleSets[i]->fStyles[j] == typeface) {
+ if (fStyleSets[i]->fStyles[j].get() == typeface) {
return fStyleSets[i]->matchStyle(style);
}
}
diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
index 9a8aa4946f..c081064fad 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -237,7 +237,7 @@ protected:
SkTypeface* onMatchFamilyStyle(const char familyName[],
const SkFontStyle& fontStyle) const override
{
- SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName));
+ sk_sp<SkFontStyleSet> sset(this->matchFamily(familyName));
return sset->matchStyle(fontStyle);
}
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index 1f00558709..3592feccfb 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -581,7 +581,7 @@ class SkFontMgr_fontconfig : public SkFontMgr {
}
private:
- SkAutoTUnref<const SkFontMgr_fontconfig> fFontMgr;
+ sk_sp<const SkFontMgr_fontconfig> fFontMgr;
SkAutoFcFontSet fFontSet;
};
@@ -944,7 +944,7 @@ protected:
}
SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
- SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, style));
+ sk_sp<SkTypeface> typeface(this->matchFamilyStyle(familyName, style));
if (typeface.get()) {
return typeface.release();
}
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index cd0b665c35..547cbe3639 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -340,7 +340,7 @@ public:
SkTypeface* matchStyle(const SkFontStyle& pattern) override;
private:
- SkAutoTUnref<const SkFontMgr_DirectWrite> fFontMgr;
+ sk_sp<const SkFontMgr_DirectWrite> fFontMgr;
SkTScopedComPtr<IDWriteFontFamily> fFontFamily;
};
@@ -509,7 +509,7 @@ SkFontStyleSet* SkFontMgr_DirectWrite::onMatchFamily(const char familyName[]) co
SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyle(const char familyName[],
const SkFontStyle& fontstyle) const {
- SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName));
+ sk_sp<SkFontStyleSet> sset(this->matchFamily(familyName));
return sset->matchStyle(fontstyle);
}
@@ -634,7 +634,7 @@ public:
protected:
ULONG fRefCount;
- SkAutoTUnref<const SkFontMgr_DirectWrite> fOuter;
+ sk_sp<const SkFontMgr_DirectWrite> fOuter;
UINT32 fCharacter;
SkTypeface* fResolvedTypeface;
};
diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp
index a4c895ad0d..c07c81fdae 100644
--- a/src/ports/SkRemotableFontMgr_win_dw.cpp
+++ b/src/ports/SkRemotableFontMgr_win_dw.cpp
@@ -148,7 +148,7 @@ public:
int count = fontFamily->GetFontCount();
SkFontIdentity* fontIds;
- SkAutoTUnref<SkRemotableFontIdentitySet> fontIdSet(
+ sk_sp<SkRemotableFontIdentitySet> fontIdSet(
new SkRemotableFontIdentitySet(count, &fontIds));
for (int fontIndex = 0; fontIndex < count; ++fontIndex) {
SkTScopedComPtr<IDWriteFont> font;
@@ -365,7 +365,7 @@ public:
protected:
ULONG fRefCount;
- SkAutoTUnref<const SkRemotableFontMgr_DirectWrite> fOuter;
+ sk_sp<const SkRemotableFontMgr_DirectWrite> fOuter;
UINT32 fCharacter;
SkFontIdentity fIdentity;
};
diff --git a/src/svg/SkSVGCanvas.cpp b/src/svg/SkSVGCanvas.cpp
index b6634b8a1d..d3511c031f 100644
--- a/src/svg/SkSVGCanvas.cpp
+++ b/src/svg/SkSVGCanvas.cpp
@@ -11,7 +11,7 @@
SkCanvas* SkSVGCanvas::Create(const SkRect& bounds, SkXMLWriter* writer) {
// TODO: pass full bounds to the device
SkISize size = bounds.roundOut().size();
- SkAutoTUnref<SkBaseDevice> device(SkSVGDevice::Create(size, writer));
+ sk_sp<SkBaseDevice> device(SkSVGDevice::Create(size, writer));
- return new SkCanvas(device);
+ return new SkCanvas(device.get());
}
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index 203be3ae8b..ffdf034ab1 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -546,7 +546,7 @@ void SkSVGDevice::AutoElement::addTextAttributes(const SkPaint& paint) {
this->addAttribute("font-weight", "bold");
}
- SkAutoTUnref<SkTypeface::LocalizedStrings> familyNameIter(tface->createFamilyNameIterator());
+ sk_sp<SkTypeface::LocalizedStrings> familyNameIter(tface->createFamilyNameIterator());
SkTypeface::LocalizedString familyString;
while (familyNameIter->next(&familyString)) {
if (familySet.contains(familyString.fString)) {
@@ -661,7 +661,7 @@ void SkSVGDevice::drawPath(const SkDraw& draw, const SkPath& path, const SkPaint
void SkSVGDevice::drawBitmapCommon(const SkDraw& draw, const SkBitmap& bm,
const SkPaint& paint) {
- SkAutoTUnref<const SkData> pngData(
+ sk_sp<const SkData> pngData(
SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality));
if (!pngData) {
return;
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 3426126d46..062dc13ed9 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -304,7 +304,7 @@ static SkCanvas* create_canvas_from_canvas_layer(const SkCanvasLayerState& layer
SkASSERT(!bitmap.empty());
SkASSERT(!bitmap.isNull());
- SkAutoTUnref<SkCanvas> canvas(new SkCanvas(bitmap));
+ sk_sp<SkCanvas> canvas(new SkCanvas(bitmap));
// setup the matrix and clip
setup_canvas_from_MC_state(layerState.mcState, canvas.get());
@@ -323,14 +323,14 @@ SkCanvas* SkCanvasStateUtils::CreateFromCanvasState(const SkCanvasState* state)
return nullptr;
}
- SkAutoTUnref<SkCanvasStack> canvas(new SkCanvasStack(state->width, state->height));
+ sk_sp<SkCanvasStack> canvas(new SkCanvasStack(state->width, state->height));
// setup the matrix and clip on the n-way canvas
- setup_canvas_from_MC_state(state_v1->mcState, canvas);
+ setup_canvas_from_MC_state(state_v1->mcState, canvas.get());
// Iterate over the layers and add them to the n-way canvas
for (int i = state_v1->layerCount - 1; i >= 0; --i) {
- SkAutoTUnref<SkCanvas> canvasLayer(create_canvas_from_canvas_layer(state_v1->layers[i]));
+ sk_sp<SkCanvas> canvasLayer(create_canvas_from_canvas_layer(state_v1->layers[i]));
if (!canvasLayer.get()) {
return nullptr;
}
diff --git a/src/utils/SkWhitelistTypefaces.cpp b/src/utils/SkWhitelistTypefaces.cpp
index 007def6d8b..f51a3b3c24 100644
--- a/src/utils/SkWhitelistTypefaces.cpp
+++ b/src/utils/SkWhitelistTypefaces.cpp
@@ -40,7 +40,7 @@ static bool font_name_is_local(const char* fontName, SkFontStyle style) {
static int whitelist_name_index(const SkTypeface* tf) {
SkString fontNameStr;
- SkAutoTUnref<SkTypeface::LocalizedStrings> nameIter(
+ sk_sp<SkTypeface::LocalizedStrings> nameIter(
SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*tf));
SkTypeface::LocalizedString familyNameLocalized;
while (nameIter->next(&familyNameLocalized)) {
@@ -53,7 +53,7 @@ static int whitelist_name_index(const SkTypeface* tf) {
}
}
#if WHITELIST_DEBUG
- SkAutoTUnref<SkTypeface::LocalizedStrings> debugIter(
+ sk_sp<SkTypeface::LocalizedStrings> debugIter(
SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*tf));
while (debugIter->next(&familyNameLocalized)) {
SkDebugf("no match fontName=\"%s\"\n", familyNameLocalized.fString.c_str());
diff --git a/src/xps/SkDocument_XPS.cpp b/src/xps/SkDocument_XPS.cpp
index cb4938be76..e333b5adff 100644
--- a/src/xps/SkDocument_XPS.cpp
+++ b/src/xps/SkDocument_XPS.cpp
@@ -58,7 +58,7 @@ protected:
private:
SkXPSDevice fDevice;
- SkAutoTUnref<SkCanvas> fCanvas;
+ sk_sp<SkCanvas> fCanvas;
SkVector fUnitsPerMeter;
SkVector fPixelsPerMeter;
};