diff options
-rw-r--r-- | bench/GrResourceCacheBench.cpp | 6 | ||||
-rw-r--r-- | bench/SKPAnimationBench.h | 8 | ||||
-rw-r--r-- | bench/SKPBench.cpp | 8 | ||||
-rw-r--r-- | bench/SKPBench.h | 4 | ||||
-rw-r--r-- | bench/nanobench.cpp | 4 | ||||
-rw-r--r-- | debugger/QT/SkDebuggerGUI.cpp | 2 | ||||
-rw-r--r-- | debugger/QT/SkGLWidget.h | 4 | ||||
-rw-r--r-- | dm/DMSrcSink.cpp | 4 | ||||
-rw-r--r-- | dm/DMSrcSinkAndroid.cpp | 2 | ||||
-rw-r--r-- | example/SkiaSDLExample.cpp | 6 | ||||
-rw-r--r-- | experimental/GLFWTest/glfw_main.cpp | 2 | ||||
-rw-r--r-- | experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp | 13 | ||||
-rw-r--r-- | experimental/SkV8Example/SkV8Example.cpp | 2 | ||||
-rw-r--r-- | fuzz/fuzz.cpp | 2 | ||||
-rw-r--r-- | platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_CreateSkiaPicture.cpp | 2 | ||||
-rw-r--r-- | platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_GaneshPictureRenderer.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleApp.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleLitAtlas.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleXfer.cpp | 8 |
19 files changed, 43 insertions, 42 deletions
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp index 295a5bcec1..903c773f33 100644 --- a/bench/GrResourceCacheBench.cpp +++ b/bench/GrResourceCacheBench.cpp @@ -69,7 +69,7 @@ protected: } void onDraw(int loops, SkCanvas* canvas) override { - SkAutoTUnref<GrContext> context(GrContext::CreateMockContext()); + sk_sp<GrContext> context(GrContext::CreateMockContext()); if (nullptr == context) { return; } @@ -143,14 +143,14 @@ protected: for (int k = 0; k < CACHE_SIZE_COUNT; ++k) { GrUniqueKey key; BenchResource::ComputeKey(k, fKeyData32Count, &key); - SkAutoTUnref<GrGpuResource> resource(cache->findAndRefUniqueResource(key)); + sk_sp<GrGpuResource> resource(cache->findAndRefUniqueResource(key)); SkASSERT(resource); } } } private: - SkAutoTUnref<GrContext> fContext; + sk_sp<GrContext> fContext; SkString fFullName; int fKeyData32Count; typedef Benchmark INHERITED; diff --git a/bench/SKPAnimationBench.h b/bench/SKPAnimationBench.h index c0bef308ec..7701595691 100644 --- a/bench/SKPAnimationBench.h +++ b/bench/SKPAnimationBench.h @@ -40,10 +40,10 @@ protected: void drawPicture() override; private: - SkAutoTUnref<Animation> fAnimation; - WallTimer fAnimationTimer; - SkString fUniqueName; - SkIRect fDevBounds; + sk_sp<Animation> fAnimation; + WallTimer fAnimationTimer; + SkString fUniqueName; + SkIRect fDevBounds; typedef SKPBench INHERITED; }; diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp index add415dcb8..7d92c9e738 100644 --- a/bench/SKPBench.cpp +++ b/bench/SKPBench.cpp @@ -135,7 +135,7 @@ void SKPBench::drawMPDPicture() { SkMatrix trans; trans.setTranslate(-fTileRects[j].fLeft/fScale, -fTileRects[j].fTop/fScale); - mpd.add(fSurfaces[j]->getCanvas(), fPic, &trans); + mpd.add(fSurfaces[j]->getCanvas(), fPic.get(), &trans); } mpd.draw(); @@ -149,7 +149,7 @@ void SKPBench::drawPicture() { for (int j = 0; j < fTileRects.count(); ++j) { const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale, -fTileRects[j].fTop / fScale); - fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, nullptr); + fSurfaces[j]->getCanvas()->drawPicture(fPic.get(), &trans, nullptr); } for (int j = 0; j < fTileRects.count(); ++j) { @@ -190,10 +190,10 @@ void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray< context->freeGpuResources(); context->resetContext(); context->getGpu()->resetShaderCacheForTesting(); - draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame"); + draw_pic_for_stats(canvas, context, fPic.get(), keys, values, "first_frame"); // draw second frame - draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame"); + draw_pic_for_stats(canvas, context, fPic.get(), keys, values, "second_frame"); #endif } diff --git a/bench/SKPBench.h b/bench/SKPBench.h index 1f34a003b2..2874bff8b0 100644 --- a/bench/SKPBench.h +++ b/bench/SKPBench.h @@ -42,12 +42,12 @@ protected: virtual void drawMPDPicture(); virtual void drawPicture(); - const SkPicture* picture() const { return fPic; } + const SkPicture* picture() const { return fPic.get(); } const SkTDArray<SkSurface*>& surfaces() const { return fSurfaces; } const SkTDArray<SkIRect>& tileRects() const { return fTileRects; } private: - SkAutoTUnref<const SkPicture> fPic; + sk_sp<const SkPicture> fPic; const SkIRect fClip; const SkScalar fScale; SkString fName; diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 0651302d0b..25e04bf77d 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -801,9 +801,9 @@ public: fCurrentAnimSKP++; SkString name = SkOSPath::Basename(path.c_str()); - SkAutoTUnref<SKPAnimationBench::Animation> animation( + sk_sp<SKPAnimationBench::Animation> animation( SKPAnimationBench::CreateZoomAnimation(fZoomMax, fZoomPeriodMs)); - return new SKPAnimationBench(name.c_str(), pic.get(), fClip, animation, + return new SKPAnimationBench(name.c_str(), pic.get(), fClip, animation.get(), FLAGS_loopSKP); } } diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index 7e6f2a0b8a..3b84afcdfe 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -281,7 +281,7 @@ void SkDebuggerGUI::saveToFile(const SkString& filename) { SkFILEWStream file(filename.c_str()); sk_sp<SkPicture> copy(fDebugger.copyPicture()); - SkAutoTUnref<SkPixelSerializer> serializer( + sk_sp<SkPixelSerializer> serializer( SkImageEncoder::CreatePixelSerializer()); copy->serialize(&file, serializer); } diff --git a/debugger/QT/SkGLWidget.h b/debugger/QT/SkGLWidget.h index 465e0997ed..870b2834b1 100644 --- a/debugger/QT/SkGLWidget.h +++ b/debugger/QT/SkGLWidget.h @@ -45,8 +45,8 @@ protected: private: void createRenderTarget(); - SkAutoTUnref<const GrGLInterface> fCurIntf; - SkAutoTUnref<GrContext> fCurContext; + sk_sp<const GrGLInterface> fCurIntf; + sk_sp<GrContext> fCurContext; sk_sp<SkSurface> fGpuSurface; SkCanvas* fCanvas; diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index dd54f00e2b..68d12453d4 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -367,7 +367,7 @@ static bool get_decode_info(SkImageInfo* decodeInfo, SkColorType canvasColorType static void draw_to_canvas(SkCanvas* canvas, const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor* colorPtr, int colorCount, CodecSrc::DstColorType dstColorType, SkScalar left = 0, SkScalar top = 0) { - SkAutoTUnref<SkColorTable> colorTable(new SkColorTable(colorPtr, colorCount)); + sk_sp<SkColorTable> colorTable(new SkColorTable(colorPtr, colorCount)); SkBitmap bitmap; bitmap.installPixels(info, pixels, rowBytes, colorTable.get(), nullptr, nullptr); premultiply_if_necessary(bitmap); @@ -1373,7 +1373,7 @@ SVGSink::SVGSink() {} Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { #if defined(SK_XML) std::unique_ptr<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst)); - SkAutoTUnref<SkCanvas> canvas(SkSVGCanvas::Create( + sk_sp<SkCanvas> canvas(SkSVGCanvas::Create( SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size().height())), xmlWriter.get())); return src.draw(canvas); diff --git a/dm/DMSrcSinkAndroid.cpp b/dm/DMSrcSinkAndroid.cpp index 77ec1c9e48..c204b369e6 100644 --- a/dm/DMSrcSinkAndroid.cpp +++ b/dm/DMSrcSinkAndroid.cpp @@ -48,7 +48,7 @@ Error ViaAndroidSDK::draw(const Src& src, Error draw(SkCanvas* canvas) const override { // Pass through HWUI's upper layers to get operational transforms std::unique_ptr<android::Canvas> ac(android::Canvas::create_canvas(canvas)); - SkAutoTUnref<android::uirenderer::SkiaCanvasProxy> scProxy + sk_sp<android::uirenderer::SkiaCanvasProxy> scProxy (new android::uirenderer::SkiaCanvasProxy(ac.get())); // Pass through another proxy to get paint transforms diff --git a/example/SkiaSDLExample.cpp b/example/SkiaSDLExample.cpp index 0072f0f595..3aa42b3518 100644 --- a/example/SkiaSDLExample.cpp +++ b/example/SkiaSDLExample.cpp @@ -183,15 +183,15 @@ int main(int argc, char** argv) { glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // setup GrContext - SkAutoTUnref<const GrGLInterface> interface(GrGLCreateNativeInterface()); + sk_sp<const GrGLInterface> interface(GrGLCreateNativeInterface()); // To use NVPR, comment this out interface.reset(GrGLInterfaceRemoveNVPR(interface)); SkASSERT(interface); // setup contexts - SkAutoTUnref<GrContext> grContext(GrContext::Create(kOpenGL_GrBackend, - (GrBackendContext)interface.get())); + sk_sp<GrContext> grContext(GrContext::Create(kOpenGL_GrBackend, + (GrBackendContext)interface.get())); SkASSERT(grContext); // Wrap the frame buffer object attached to the screen in a Skia render target so Skia can diff --git a/experimental/GLFWTest/glfw_main.cpp b/experimental/GLFWTest/glfw_main.cpp index 21ec33def3..63ea1f1d9f 100644 --- a/experimental/GLFWTest/glfw_main.cpp +++ b/experimental/GLFWTest/glfw_main.cpp @@ -76,7 +76,7 @@ int main(void) { init_skia(kWidth, kHeight); - SkAutoTUnref<SkImage> atlas; + sk_sp<SkImage> atlas; SkRSXform xform[kGrid*kGrid+1]; SkRect tex[kGrid*kGrid+1]; WallTimer timer; diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp index c0652bfa98..fcbf017c43 100644 --- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp +++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp @@ -1321,14 +1321,15 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader2::asFragmentProcessor(const AsFPA if (fType == kImprovedNoise_Type) { GrTextureParams textureParams(SkShader::TileMode::kRepeat_TileMode, GrTextureParams::FilterMode::kNone_FilterMode); - SkAutoTUnref<GrTexture> permutationsTexture( + sk_sp<GrTexture> permutationsTexture( GrRefCachedBitmapTexture(args.fContext, paintingData->getImprovedPermutationsBitmap(), textureParams, args.fGammaTreatment)); - SkAutoTUnref<GrTexture> gradientTexture( + sk_sp<GrTexture> gradientTexture( GrRefCachedBitmapTexture(args.fContext, paintingData->getGradientBitmap(), textureParams, args.fGammaTreatment)); return GrImprovedPerlinNoiseEffect::Make(fNumOctaves, fSeed, paintingData, - permutationsTexture, gradientTexture, m); + permutationsTexture.get(), + gradientTexture.get(), m); } if (0 == fNumOctaves) { @@ -1347,10 +1348,10 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader2::asFragmentProcessor(const AsFPA GrConstColorProcessor::kIgnore_InputMode); } - 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)); @@ -1360,7 +1361,7 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader2::asFragmentProcessor(const AsFPA fNumOctaves, fStitchTiles, paintingData, - permutationsTexture, noiseTexture, + permutationsTexture.get(), noiseTexture.get(), m)); return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); } diff --git a/experimental/SkV8Example/SkV8Example.cpp b/experimental/SkV8Example/SkV8Example.cpp index 5bfd64d6e2..388ef0e187 100644 --- a/experimental/SkV8Example/SkV8Example.cpp +++ b/experimental/SkV8Example/SkV8Example.cpp @@ -108,7 +108,7 @@ void SkV8ExampleWindow::windowSizeChanged() { SkSurface* SkV8ExampleWindow::createSurface() { if (FLAGS_gpu) { // Increase the ref count since callers of createSurface put the - // results in a SkAutoTUnref. + // results in a sk_sp. fCurSurface->ref(); return fCurSurface; } else { diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp index 7aac5dae04..d6534f1aff 100644 --- a/fuzz/fuzz.cpp +++ b/fuzz/fuzz.cpp @@ -145,7 +145,7 @@ int fuzz_img(sk_sp<SkData> bytes, uint8_t scale, uint8_t mode) { decodeInfo = decodeInfo.makeWH(size.width(), size.height()); // Construct a color table for the decode if necessary - SkAutoTUnref<SkColorTable> colorTable(nullptr); + sk_sp<SkColorTable> colorTable(nullptr); SkPMColor* colorPtr = nullptr; int* colorCountPtr = nullptr; int maxColors = 256; diff --git a/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_CreateSkiaPicture.cpp b/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_CreateSkiaPicture.cpp index c5d9759e54..086cd5d42e 100644 --- a/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_CreateSkiaPicture.cpp +++ b/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_CreateSkiaPicture.cpp @@ -29,7 +29,7 @@ JNIEXPORT jlong JNICALL Java_org_skia_canvasproof_CreateSkiaPicture_createImpl (JNIEnv* env, jclass clazz, jobject inputStream, jbyteArray buffer) { JavaInputStream stream(env, buffer, inputStream); #if 0 - SkAutoTUnref<SkPicture> p(SkPicture::CreateFromStream(&stream)); + sk_sp<SkPicture> p(SkPicture::CreateFromStream(&stream)); if (!p) { return 0; } SkPictureRecorder recorder; SkRect bounds = p->cullRect(); diff --git a/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_GaneshPictureRenderer.cpp b/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_GaneshPictureRenderer.cpp index de38919fe5..1bdc655ef2 100644 --- a/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_GaneshPictureRenderer.cpp +++ b/platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_GaneshPictureRenderer.cpp @@ -53,7 +53,7 @@ static void render_picture(GrContext* grContext, namespace { struct GaneshPictureRendererImpl { - SkAutoTUnref<GrContext> fGrContext; + sk_sp<GrContext> fGrContext; void render(int w, int h, const SkPicture* p, const SkMatrix& m) { if (!fGrContext) { // Cache the rendering context between frames. diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 6722429618..75827ffe40 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -241,7 +241,7 @@ public: fActualColorBits = SkTMax(attachmentInfo.fColorBits, 24); SkASSERT(nullptr == fCurIntf); - SkAutoTUnref<const GrGLInterface> glInterface; + sk_sp<const GrGLInterface> glInterface; switch (win->getDeviceType()) { case kRaster_DeviceType: // fallthrough case kGPU_DeviceType: diff --git a/samplecode/SampleLitAtlas.cpp b/samplecode/SampleLitAtlas.cpp index 149da98a02..ee639d3549 100644 --- a/samplecode/SampleLitAtlas.cpp +++ b/samplecode/SampleLitAtlas.cpp @@ -492,7 +492,7 @@ protected: } void onDrawContent(SkCanvas* canvas) override { - canvas->drawDrawable(fDrawable); + canvas->drawDrawable(fDrawable.get()); this->inval(NULL); } @@ -506,7 +506,7 @@ protected: #endif private: - SkAutoTUnref<DrawLitAtlasDrawable> fDrawable; + sk_sp<DrawLitAtlasDrawable> fDrawable; typedef SampleView INHERITED; }; diff --git a/samplecode/SampleXfer.cpp b/samplecode/SampleXfer.cpp index c0ad000501..738541fa37 100644 --- a/samplecode/SampleXfer.cpp +++ b/samplecode/SampleXfer.cpp @@ -153,20 +153,20 @@ class XferDemo : public SampleView { }; SkRect fModeRect[N_Modes]; - SkAutoTUnref<CircDrawable> fDrs[N]; + sk_sp<CircDrawable> fDrs[N]; CircDrawable* fSelected; void addButtons() { SkScalar x = 10; SkScalar y = 10; for (int i = 0; i < N_Modes; ++i) { - SkAutoTUnref<SkView> v(new PushButtonWig(gModes[i].fName, (int)gModes[i].fMode)); + sk_sp<SkView> v(new PushButtonWig(gModes[i].fName, (int)gModes[i].fMode)); v->setSize(70, 25); v->setLoc(x, y); v->setVisibleP(true); v->setEnabledP(true); v->addListenerID(this->getSinkID()); - this->attachChildToFront(v); + this->attachChildToFront(v.get()); fModeRect[i] = SkRect::MakeXYWH(x, y + 28, 70, 2); x += 80; } @@ -227,7 +227,7 @@ protected: fSelected = nullptr; for (int i = N - 1; i >= 0; --i) { if (fDrs[i]->hitTest(x, y)) { - fSelected = fDrs[i]; + fSelected = fDrs[i].get(); break; } } |