diff options
-rw-r--r-- | BUILD.public | 4 | ||||
-rw-r--r-- | bench/BitmapRegionDecoderBench.cpp | 10 | ||||
-rw-r--r-- | bench/BitmapRegionDecoderBench.h | 8 | ||||
-rw-r--r-- | bench/nanobench.cpp | 20 | ||||
-rw-r--r-- | dm/DM.cpp | 30 | ||||
-rw-r--r-- | dm/DMSrcSink.cpp | 12 | ||||
-rw-r--r-- | dm/DMSrcSink.h | 6 | ||||
-rw-r--r-- | gyp/tools.gyp | 2 | ||||
-rw-r--r-- | tools/BUILD.public.expected | 4 | ||||
-rw-r--r-- | tools/SkBitmapRegionCanvas.h | 6 | ||||
-rw-r--r-- | tools/SkBitmapRegionCodec.h | 6 | ||||
-rw-r--r-- | tools/SkBitmapRegionDecoder.cpp (renamed from tools/SkBitmapRegionDecoderInterface.cpp) | 8 | ||||
-rw-r--r-- | tools/SkBitmapRegionDecoder.h (renamed from tools/SkBitmapRegionDecoderInterface.h) | 10 | ||||
-rw-r--r-- | tools/SkBitmapRegionSampler.h | 6 |
14 files changed, 66 insertions, 66 deletions
diff --git a/BUILD.public b/BUILD.public index 9c66d3a111..5d95d2812f 100644 --- a/BUILD.public +++ b/BUILD.public @@ -293,8 +293,8 @@ DM_SRCS = glob( "tools/SkBitmapRegionCanvas.h", "tools/SkBitmapRegionCodec.cpp", "tools/SkBitmapRegionCodec.h", - "tools/SkBitmapRegionDecoderInterface.cpp", - "tools/SkBitmapRegionDecoderInterface.h", + "tools/SkBitmapRegionDecoder.cpp", + "tools/SkBitmapRegionDecoder.h", "tools/SkBitmapRegionSampler.cpp", "tools/SkBitmapRegionSampler.h", "tools/flags/*.cpp", diff --git a/bench/BitmapRegionDecoderBench.cpp b/bench/BitmapRegionDecoderBench.cpp index 70e3e760e0..1d2a0b91f7 100644 --- a/bench/BitmapRegionDecoderBench.cpp +++ b/bench/BitmapRegionDecoderBench.cpp @@ -12,7 +12,7 @@ #include "SkOSFile.h" BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* encoded, - SkBitmapRegionDecoderInterface::Strategy strategy, SkColorType colorType, + SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType, uint32_t sampleSize, const SkIRect& subset) : fBRD(nullptr) , fData(SkRef(encoded)) @@ -24,13 +24,13 @@ BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* // Choose a useful name for the region decoding strategy const char* strategyName; switch (strategy) { - case SkBitmapRegionDecoderInterface::kOriginal_Strategy: + case SkBitmapRegionDecoder::kOriginal_Strategy: strategyName = "Original"; break; - case SkBitmapRegionDecoderInterface::kCanvas_Strategy: + case SkBitmapRegionDecoder::kCanvas_Strategy: strategyName = "Canvas"; break; - case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy: + case SkBitmapRegionDecoder::kAndroidCodec_Strategy: strategyName = "AndroidCodec"; break; default: @@ -57,7 +57,7 @@ bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) { } void BitmapRegionDecoderBench::onDelayedSetup() { - fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(fData, fStrategy)); + fBRD.reset(SkBitmapRegionDecoder::Create(fData, fStrategy)); } void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) { diff --git a/bench/BitmapRegionDecoderBench.h b/bench/BitmapRegionDecoderBench.h index 3f3da6cec9..7c331aee31 100644 --- a/bench/BitmapRegionDecoderBench.h +++ b/bench/BitmapRegionDecoderBench.h @@ -9,7 +9,7 @@ #define BitmapRegionDecoderBench_DEFINED #include "Benchmark.h" -#include "SkBitmapRegionDecoderInterface.h" +#include "SkBitmapRegionDecoder.h" #include "SkData.h" #include "SkImageInfo.h" #include "SkRefCnt.h" @@ -27,7 +27,7 @@ class BitmapRegionDecoderBench : public Benchmark { public: // Calls encoded->ref() BitmapRegionDecoderBench(const char* basename, SkData* encoded, - SkBitmapRegionDecoderInterface::Strategy strategy, SkColorType colorType, + SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType, uint32_t sampleSize, const SkIRect& subset); protected: @@ -38,9 +38,9 @@ protected: private: SkString fName; - SkAutoTDelete<SkBitmapRegionDecoderInterface> fBRD; + SkAutoTDelete<SkBitmapRegionDecoder> fBRD; SkAutoTUnref<SkData> fData; - const SkBitmapRegionDecoderInterface::Strategy fStrategy; + const SkBitmapRegionDecoder::Strategy fStrategy; const SkColorType fColorType; const uint32_t fSampleSize; const SkIRect fSubset; diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 2e566da8e1..264e4a1378 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -26,7 +26,7 @@ #include "SubsetZoomBench.h" #include "Stats.h" -#include "SkBitmapRegionDecoderInterface.h" +#include "SkBitmapRegionDecoder.h" #include "SkBBoxHierarchy.h" #include "SkCanvas.h" #include "SkCodec.h" @@ -588,11 +588,11 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool return true; } -static bool valid_brd_bench(SkData* encoded, SkBitmapRegionDecoderInterface::Strategy strategy, +static bool valid_brd_bench(SkData* encoded, SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType, uint32_t sampleSize, uint32_t minOutputSize, int* width, int* height) { - SkAutoTDelete<SkBitmapRegionDecoderInterface> brd( - SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(encoded, strategy)); + SkAutoTDelete<SkBitmapRegionDecoder> brd( + SkBitmapRegionDecoder::Create(encoded, strategy)); if (nullptr == brd.get()) { // This is indicates that subset decoding is not supported for a particular image format. return false; @@ -956,12 +956,12 @@ public: // Run the BRDBenches // We will benchmark multiple BRD strategies. static const struct { - SkBitmapRegionDecoderInterface::Strategy fStrategy; + SkBitmapRegionDecoder::Strategy fStrategy; const char* fName; } strategies[] = { - { SkBitmapRegionDecoderInterface::kOriginal_Strategy, "BRD" }, - { SkBitmapRegionDecoderInterface::kCanvas_Strategy, "BRD_canvas" }, - { SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy, "BRD_android_codec" }, + { SkBitmapRegionDecoder::kOriginal_Strategy, "BRD" }, + { SkBitmapRegionDecoder::kCanvas_Strategy, "BRD_canvas" }, + { SkBitmapRegionDecoder::kAndroidCodec_Strategy, "BRD_android_codec" }, }; // We intend to create benchmarks that model the use cases in @@ -986,10 +986,10 @@ public: fBenchType = strategies[fCurrentBRDStrategy].fName; const SkString& path = fImages[fCurrentBRDImage]; - const SkBitmapRegionDecoderInterface::Strategy strategy = + const SkBitmapRegionDecoder::Strategy strategy = strategies[fCurrentBRDStrategy].fStrategy; - if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy) { + if (SkBitmapRegionDecoder::kOriginal_Strategy == strategy) { // Disable png and jpeg for SkImageDecoder: if (!FLAGS_jpgBuildTileIndex) { if (path.endsWith("JPEG") || path.endsWith("JPG") || @@ -381,15 +381,15 @@ static void push_codec_srcs(Path path) { } } -static bool brd_color_type_supported(SkBitmapRegionDecoderInterface::Strategy strategy, +static bool brd_color_type_supported(SkBitmapRegionDecoder::Strategy strategy, CodecSrc::DstColorType dstColorType) { switch (strategy) { - case SkBitmapRegionDecoderInterface::kCanvas_Strategy: + case SkBitmapRegionDecoder::kCanvas_Strategy: if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) { return true; } return false; - case SkBitmapRegionDecoderInterface::kOriginal_Strategy: + case SkBitmapRegionDecoder::kOriginal_Strategy: switch (dstColorType) { case CodecSrc::kGetFromCanvas_DstColorType: case CodecSrc::kIndex8_Always_DstColorType: @@ -398,7 +398,7 @@ static bool brd_color_type_supported(SkBitmapRegionDecoderInterface::Strategy st default: return false; } - case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy: + case SkBitmapRegionDecoder::kAndroidCodec_Strategy: switch (dstColorType) { case CodecSrc::kGetFromCanvas_DstColorType: case CodecSrc::kIndex8_Always_DstColorType: @@ -413,17 +413,17 @@ static bool brd_color_type_supported(SkBitmapRegionDecoderInterface::Strategy st } } -static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy strategy, +static void push_brd_src(Path path, SkBitmapRegionDecoder::Strategy strategy, CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleSize) { SkString folder; switch (strategy) { - case SkBitmapRegionDecoderInterface::kCanvas_Strategy: + case SkBitmapRegionDecoder::kCanvas_Strategy: folder.append("brd_canvas"); break; - case SkBitmapRegionDecoderInterface::kOriginal_Strategy: + case SkBitmapRegionDecoder::kOriginal_Strategy: folder.append("brd_sample"); break; - case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy: + case SkBitmapRegionDecoder::kAndroidCodec_Strategy: folder.append("brd_android_codec"); break; default: @@ -466,10 +466,10 @@ static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str static void push_brd_srcs(Path path) { - const SkBitmapRegionDecoderInterface::Strategy strategies[] = { - SkBitmapRegionDecoderInterface::kCanvas_Strategy, - SkBitmapRegionDecoderInterface::kOriginal_Strategy, - SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy, + const SkBitmapRegionDecoder::Strategy strategies[] = { + SkBitmapRegionDecoder::kCanvas_Strategy, + SkBitmapRegionDecoder::kOriginal_Strategy, + SkBitmapRegionDecoder::kAndroidCodec_Strategy, }; // Test on a variety of sampleSizes, making sure to include: @@ -492,12 +492,12 @@ static void push_brd_srcs(Path path) { BRDSrc::kDivisor_Mode, }; - for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { + for (SkBitmapRegionDecoder::Strategy strategy : strategies) { // We disable png testing for kOriginal_Strategy because the implementation leaks // memory in our forked libpng. // TODO (msarett): Decide if we want to test pngs in this mode and how we might do this. - if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && + if (SkBitmapRegionDecoder::kOriginal_Strategy == strategy && (path.endsWith(".png") || path.endsWith(".PNG"))) { continue; } @@ -506,7 +506,7 @@ static void push_brd_srcs(Path path) { // kOriginal_Strategy does not work for jpegs that are scaled to non-powers of two. // We don't need to test this. We know it doesn't work, and it causes images with // uninitialized memory to show up on Gold. - if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && + if (SkBitmapRegionDecoder::kOriginal_Strategy == strategy && (path.endsWith(".jpg") || path.endsWith(".JPG") || path.endsWith(".jpeg") || path.endsWith(".JPEG")) && !SkIsPow2(sampleSize)) { continue; diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 06118765e3..0945d83cf6 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -67,7 +67,7 @@ void GMSrc::modifyGrContextOptions(GrContextOptions* options) const { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -BRDSrc::BRDSrc(Path path, SkBitmapRegionDecoderInterface::Strategy strategy, Mode mode, +BRDSrc::BRDSrc(Path path, SkBitmapRegionDecoder::Strategy strategy, Mode mode, CodecSrc::DstColorType dstColorType, uint32_t sampleSize) : fPath(path) , fStrategy(strategy) @@ -82,13 +82,13 @@ bool BRDSrc::veto(SinkFlags flags) const { || flags.approach != SinkFlags::kDirect; } -static SkBitmapRegionDecoderInterface* create_brd(Path path, - SkBitmapRegionDecoderInterface::Strategy strategy) { +static SkBitmapRegionDecoder* create_brd(Path path, + SkBitmapRegionDecoder::Strategy strategy) { SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); if (!encoded) { return NULL; } - return SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(encoded, strategy); + return SkBitmapRegionDecoder::Create(encoded, strategy); } Error BRDSrc::draw(SkCanvas* canvas) const { @@ -108,7 +108,7 @@ Error BRDSrc::draw(SkCanvas* canvas) const { break; } - SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(create_brd(fPath, fStrategy)); + SkAutoTDelete<SkBitmapRegionDecoder> brd(create_brd(fPath, fStrategy)); if (nullptr == brd.get()) { return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fPath.c_str())); } @@ -210,7 +210,7 @@ Error BRDSrc::draw(SkCanvas* canvas) const { } SkISize BRDSrc::size() const { - SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(create_brd(fPath, fStrategy)); + SkAutoTDelete<SkBitmapRegionDecoder> brd(create_brd(fPath, fStrategy)); if (brd) { return SkISize::Make(SkTMax(1, brd->width() / (int) fSampleSize), SkTMax(1, brd->height() / (int) fSampleSize)); diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index a7cca8396a..78c6b5c564 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -12,7 +12,7 @@ #include "SkBBHFactory.h" #include "SkBBoxHierarchy.h" #include "SkBitmap.h" -#include "SkBitmapRegionDecoderInterface.h" +#include "SkBitmapRegionDecoder.h" #include "SkCanvas.h" #include "SkData.h" #include "SkGPipe.h" @@ -163,7 +163,7 @@ public: kDivisor_Mode, }; - BRDSrc(Path, SkBitmapRegionDecoderInterface::Strategy, Mode, CodecSrc::DstColorType, uint32_t); + BRDSrc(Path, SkBitmapRegionDecoder::Strategy, Mode, CodecSrc::DstColorType, uint32_t); Error draw(SkCanvas*) const override; SkISize size() const override; @@ -171,7 +171,7 @@ public: bool veto(SinkFlags) const override; private: Path fPath; - SkBitmapRegionDecoderInterface::Strategy fStrategy; + SkBitmapRegionDecoder::Strategy fStrategy; Mode fMode; CodecSrc::DstColorType fDstColorType; uint32_t fSampleSize; diff --git a/gyp/tools.gyp b/gyp/tools.gyp index a4f8cfd62a..85a4d281a0 100644 --- a/gyp/tools.gyp +++ b/gyp/tools.gyp @@ -53,7 +53,7 @@ 'sources': [ '../tools/SkBitmapRegionCanvas.cpp', '../tools/SkBitmapRegionCodec.cpp', - '../tools/SkBitmapRegionDecoderInterface.cpp', + '../tools/SkBitmapRegionDecoder.cpp', '../tools/SkBitmapRegionSampler.cpp', ], 'include_dirs': [ diff --git a/tools/BUILD.public.expected b/tools/BUILD.public.expected index 02f86a7388..63d25e3ac2 100644 --- a/tools/BUILD.public.expected +++ b/tools/BUILD.public.expected @@ -573,8 +573,8 @@ DM_SRCS = ['dm/DM.cpp', 'tools/SkBitmapRegionCanvas.h', 'tools/SkBitmapRegionCodec.cpp', 'tools/SkBitmapRegionCodec.h', - 'tools/SkBitmapRegionDecoderInterface.cpp', - 'tools/SkBitmapRegionDecoderInterface.h', + 'tools/SkBitmapRegionDecoder.cpp', + 'tools/SkBitmapRegionDecoder.h', 'tools/SkBitmapRegionSampler.cpp', 'tools/SkBitmapRegionSampler.h', 'tools/flags/SkCommandLineFlags.cpp', diff --git a/tools/SkBitmapRegionCanvas.h b/tools/SkBitmapRegionCanvas.h index 0dfd5b8669..f41d5b9484 100644 --- a/tools/SkBitmapRegionCanvas.h +++ b/tools/SkBitmapRegionCanvas.h @@ -6,7 +6,7 @@ */ #include "SkBitmap.h" -#include "SkBitmapRegionDecoderInterface.h" +#include "SkBitmapRegionDecoder.h" #include "SkCodec.h" /* @@ -16,7 +16,7 @@ */ // FIXME (msarett): This implementation does not support WEBP, because WEBP // does not have a scanline decoder. -class SkBitmapRegionCanvas : public SkBitmapRegionDecoderInterface { +class SkBitmapRegionCanvas : public SkBitmapRegionDecoder { public: /* @@ -36,6 +36,6 @@ private: SkAutoTDelete<SkCodec> fDecoder; - typedef SkBitmapRegionDecoderInterface INHERITED; + typedef SkBitmapRegionDecoder INHERITED; }; diff --git a/tools/SkBitmapRegionCodec.h b/tools/SkBitmapRegionCodec.h index ade72fa936..1739a04378 100644 --- a/tools/SkBitmapRegionCodec.h +++ b/tools/SkBitmapRegionCodec.h @@ -6,13 +6,13 @@ */ #include "SkBitmap.h" -#include "SkBitmapRegionDecoderInterface.h" +#include "SkBitmapRegionDecoder.h" #include "SkAndroidCodec.h" /* * This class implements SkBitmapRegionDecoder using an SkAndroidCodec. */ -class SkBitmapRegionCodec : public SkBitmapRegionDecoderInterface { +class SkBitmapRegionCodec : public SkBitmapRegionDecoder { public: /* @@ -32,6 +32,6 @@ private: SkAutoTDelete<SkAndroidCodec> fCodec; - typedef SkBitmapRegionDecoderInterface INHERITED; + typedef SkBitmapRegionDecoder INHERITED; }; diff --git a/tools/SkBitmapRegionDecoderInterface.cpp b/tools/SkBitmapRegionDecoder.cpp index d009b27f3a..5944c1ab40 100644 --- a/tools/SkBitmapRegionDecoderInterface.cpp +++ b/tools/SkBitmapRegionDecoder.cpp @@ -7,20 +7,20 @@ #include "SkBitmapRegionCanvas.h" #include "SkBitmapRegionCodec.h" -#include "SkBitmapRegionDecoderInterface.h" +#include "SkBitmapRegionDecoder.h" #include "SkBitmapRegionSampler.h" #include "SkAndroidCodec.h" #include "SkCodec.h" #include "SkCodecPriv.h" #include "SkImageDecoder.h" -SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder( +SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create( SkData* data, Strategy strategy) { - return SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(new SkMemoryStream(data), + return SkBitmapRegionDecoder::Create(new SkMemoryStream(data), strategy); } -SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder( +SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create( SkStreamRewindable* stream, Strategy strategy) { SkAutoTDelete<SkStreamRewindable> streamDeleter(stream); switch (strategy) { diff --git a/tools/SkBitmapRegionDecoderInterface.h b/tools/SkBitmapRegionDecoder.h index 8e19e95a0a..618ab16f5d 100644 --- a/tools/SkBitmapRegionDecoderInterface.h +++ b/tools/SkBitmapRegionDecoder.h @@ -16,7 +16,7 @@ * This class aims to provide an interface to test multiple implementations of * SkBitmapRegionDecoder. */ -class SkBitmapRegionDecoderInterface { +class SkBitmapRegionDecoder { public: enum Strategy { @@ -30,7 +30,7 @@ public: * @param strategy Strategy used for scaling and subsetting * @return Tries to create an SkBitmapRegionDecoder, returns NULL on failure */ - static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder( + static SkBitmapRegionDecoder* Create( SkData* data, Strategy strategy); /* @@ -38,7 +38,7 @@ public: * @param strategy Strategy used for scaling and subsetting * @return Tries to create an SkBitmapRegionDecoder, returns NULL on failure */ - static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder( + static SkBitmapRegionDecoder* Create( SkStreamRewindable* stream, Strategy strategy); /* @@ -73,11 +73,11 @@ public: int width() const { return fWidth; } int height() const { return fHeight; } - virtual ~SkBitmapRegionDecoderInterface() {} + virtual ~SkBitmapRegionDecoder() {} protected: - SkBitmapRegionDecoderInterface(int width, int height) + SkBitmapRegionDecoder(int width, int height) : fWidth(width) , fHeight(height) {} diff --git a/tools/SkBitmapRegionSampler.h b/tools/SkBitmapRegionSampler.h index 48bb23f897..3c5a672e80 100644 --- a/tools/SkBitmapRegionSampler.h +++ b/tools/SkBitmapRegionSampler.h @@ -6,7 +6,7 @@ */ #include "SkBitmap.h" -#include "SkBitmapRegionDecoderInterface.h" +#include "SkBitmapRegionDecoder.h" #include "SkImageDecoder.h" #include "SkTemplates.h" @@ -14,7 +14,7 @@ * This class aims to duplicate the current implementation of * SkBitmapRegionDecoder in Android. */ -class SkBitmapRegionSampler : public SkBitmapRegionDecoderInterface { +class SkBitmapRegionSampler : public SkBitmapRegionDecoder { public: /* @@ -40,6 +40,6 @@ private: SkAutoTDelete<SkImageDecoder> fDecoder; - typedef SkBitmapRegionDecoderInterface INHERITED; + typedef SkBitmapRegionDecoder INHERITED; }; |