From 48b649060c8d3ae104274703553d7c03a58f3ddd Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 25 Jul 2018 13:28:44 -0400 Subject: remove SkThreadedBMPDevice and friends It is unused, is becoming a maintainence burden and source of bugs, and takes up a lot of time on the *SAN bots. Change-Id: If383eb6e4838ca23140f9e16d518b1bfc655fa12 Reviewed-on: https://skia-review.googlesource.com/143307 Auto-Submit: Mike Klein Commit-Queue: Herb Derby Reviewed-by: Herb Derby --- dm/DM.cpp | 1 - dm/DMSrcSink.cpp | 33 ++------------------------------- dm/DMSrcSink.h | 3 +-- 3 files changed, 3 insertions(+), 34 deletions(-) (limited to 'dm') diff --git a/dm/DM.cpp b/dm/DM.cpp index 83a9f17035..4d62421250 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -906,7 +906,6 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi SINK("rgbx", RasterSink, kRGB_888x_SkColorType); SINK("1010102", RasterSink, kRGBA_1010102_SkColorType); SINK("101010x", RasterSink, kRGB_101010x_SkColorType); - SINK("t8888", ThreadedSink, kN32_SkColorType); SINK("pdf", PDFSink, false, SK_ScalarDefaultRasterDPI); SINK("skp", SKPSink); SINK("pipe", PipeSink); diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index d3f7ab61fe..6ba59620b8 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -56,11 +56,11 @@ #include "SkRecordDraw.h" #include "SkRecorder.h" #include "SkStream.h" +#include "SkSurface.h" #include "SkSurfaceCharacterization.h" #include "SkSwizzler.h" #include "SkTLogic.h" #include "SkTaskGroup.h" -#include "SkThreadedBMPDevice.h" #if defined(SK_BUILD_FOR_WIN) #include "SkAutoCoInitialize.h" #include "SkHRESULT.h" @@ -1804,7 +1804,7 @@ RasterSink::RasterSink(SkColorType colorType, sk_sp colorSpace) : fColorType(colorType) , fColorSpace(std::move(colorSpace)) {} -void RasterSink::allocPixels(const Src& src, SkBitmap* dst) const { +Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const { const SkISize size = src.size(); // If there's an appropriate alpha type for this color type, use it, otherwise use premul. SkAlphaType alphaType = kPremul_SkAlphaType; @@ -1813,42 +1813,13 @@ void RasterSink::allocPixels(const Src& src, SkBitmap* dst) const { dst->allocPixelsFlags(SkImageInfo::Make(size.width(), size.height(), fColorType, alphaType, fColorSpace), SkBitmap::kZeroPixels_AllocFlag); -} -Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const { - this->allocPixels(src, dst); SkCanvas canvas(*dst); return src.draw(&canvas); } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -ThreadedSink::ThreadedSink(SkColorType colorType, sk_sp colorSpace) - : RasterSink(colorType, colorSpace) {} - -Error ThreadedSink::draw(const Src& src, SkBitmap* dst, SkWStream* stream, SkString* str) const { - this->allocPixels(src, dst); - - auto canvas = skstd::make_unique( - sk_make_sp( - *dst, FLAGS_backendTiles, FLAGS_backendThreads)); - Error result = src.draw(canvas.get()); - canvas->flush(); - return result; - - // ??? yuqian: why does the following give me segmentation fault while the above one works? - // The seg fault occurs right in the beginning of ThreadedSink::draw with invalid - // memory address (it would crash without even calling this->allocPixels). - - // SkThreadedBMPDevice device(*dst, tileCnt, FLAGS_cpuThreads, fExecutor.get()); - // SkCanvas canvas(&device); - // Error result = src.draw(&canvas); - // canvas.flush(); - // return result; -} - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - // Handy for front-patching a Src. Do whatever up-front work you need, then call draw_to_canvas(), // passing the Sink draw() arguments, a size, and a function draws into an SkCanvas. // Several examples below. diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index 86c2279439..d42c1868aa 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -441,9 +441,8 @@ public: Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; const char* fileExtension() const override { return "png"; } SinkFlags flags() const override { return SinkFlags{ SinkFlags::kRaster, SinkFlags::kDirect }; } -protected: - void allocPixels(const Src& src, SkBitmap*) const; +private: SkColorType fColorType; sk_sp fColorSpace; }; -- cgit v1.2.3