Rename SkBitmapRegionDecoder and Create function
We no longer need to worry about namespace conflicts SkBitmapRegionDecoder in Android (which we are replacing). Additionally, the static Create() function does not need to repeat the name BitmapRegionDecoder. BUG=skia: Review URL: https://codereview.chromium.org/1415243007
This commit is contained in:
parent
aa4ba90792
commit
5cb4885b4c
@ -293,8 +293,8 @@ DM_SRCS = glob(
|
|||||||
"tools/SkBitmapRegionCanvas.h",
|
"tools/SkBitmapRegionCanvas.h",
|
||||||
"tools/SkBitmapRegionCodec.cpp",
|
"tools/SkBitmapRegionCodec.cpp",
|
||||||
"tools/SkBitmapRegionCodec.h",
|
"tools/SkBitmapRegionCodec.h",
|
||||||
"tools/SkBitmapRegionDecoderInterface.cpp",
|
"tools/SkBitmapRegionDecoder.cpp",
|
||||||
"tools/SkBitmapRegionDecoderInterface.h",
|
"tools/SkBitmapRegionDecoder.h",
|
||||||
"tools/SkBitmapRegionSampler.cpp",
|
"tools/SkBitmapRegionSampler.cpp",
|
||||||
"tools/SkBitmapRegionSampler.h",
|
"tools/SkBitmapRegionSampler.h",
|
||||||
"tools/flags/*.cpp",
|
"tools/flags/*.cpp",
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "SkOSFile.h"
|
#include "SkOSFile.h"
|
||||||
|
|
||||||
BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* encoded,
|
BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* encoded,
|
||||||
SkBitmapRegionDecoderInterface::Strategy strategy, SkColorType colorType,
|
SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType,
|
||||||
uint32_t sampleSize, const SkIRect& subset)
|
uint32_t sampleSize, const SkIRect& subset)
|
||||||
: fBRD(nullptr)
|
: fBRD(nullptr)
|
||||||
, fData(SkRef(encoded))
|
, fData(SkRef(encoded))
|
||||||
@ -24,13 +24,13 @@ BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData*
|
|||||||
// Choose a useful name for the region decoding strategy
|
// Choose a useful name for the region decoding strategy
|
||||||
const char* strategyName;
|
const char* strategyName;
|
||||||
switch (strategy) {
|
switch (strategy) {
|
||||||
case SkBitmapRegionDecoderInterface::kOriginal_Strategy:
|
case SkBitmapRegionDecoder::kOriginal_Strategy:
|
||||||
strategyName = "Original";
|
strategyName = "Original";
|
||||||
break;
|
break;
|
||||||
case SkBitmapRegionDecoderInterface::kCanvas_Strategy:
|
case SkBitmapRegionDecoder::kCanvas_Strategy:
|
||||||
strategyName = "Canvas";
|
strategyName = "Canvas";
|
||||||
break;
|
break;
|
||||||
case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy:
|
case SkBitmapRegionDecoder::kAndroidCodec_Strategy:
|
||||||
strategyName = "AndroidCodec";
|
strategyName = "AndroidCodec";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -57,7 +57,7 @@ bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BitmapRegionDecoderBench::onDelayedSetup() {
|
void BitmapRegionDecoderBench::onDelayedSetup() {
|
||||||
fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(fData, fStrategy));
|
fBRD.reset(SkBitmapRegionDecoder::Create(fData, fStrategy));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) {
|
void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#define BitmapRegionDecoderBench_DEFINED
|
#define BitmapRegionDecoderBench_DEFINED
|
||||||
|
|
||||||
#include "Benchmark.h"
|
#include "Benchmark.h"
|
||||||
#include "SkBitmapRegionDecoderInterface.h"
|
#include "SkBitmapRegionDecoder.h"
|
||||||
#include "SkData.h"
|
#include "SkData.h"
|
||||||
#include "SkImageInfo.h"
|
#include "SkImageInfo.h"
|
||||||
#include "SkRefCnt.h"
|
#include "SkRefCnt.h"
|
||||||
@ -27,7 +27,7 @@ class BitmapRegionDecoderBench : public Benchmark {
|
|||||||
public:
|
public:
|
||||||
// Calls encoded->ref()
|
// Calls encoded->ref()
|
||||||
BitmapRegionDecoderBench(const char* basename, SkData* encoded,
|
BitmapRegionDecoderBench(const char* basename, SkData* encoded,
|
||||||
SkBitmapRegionDecoderInterface::Strategy strategy, SkColorType colorType,
|
SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType,
|
||||||
uint32_t sampleSize, const SkIRect& subset);
|
uint32_t sampleSize, const SkIRect& subset);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -38,9 +38,9 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SkString fName;
|
SkString fName;
|
||||||
SkAutoTDelete<SkBitmapRegionDecoderInterface> fBRD;
|
SkAutoTDelete<SkBitmapRegionDecoder> fBRD;
|
||||||
SkAutoTUnref<SkData> fData;
|
SkAutoTUnref<SkData> fData;
|
||||||
const SkBitmapRegionDecoderInterface::Strategy fStrategy;
|
const SkBitmapRegionDecoder::Strategy fStrategy;
|
||||||
const SkColorType fColorType;
|
const SkColorType fColorType;
|
||||||
const uint32_t fSampleSize;
|
const uint32_t fSampleSize;
|
||||||
const SkIRect fSubset;
|
const SkIRect fSubset;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "SubsetZoomBench.h"
|
#include "SubsetZoomBench.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
|
||||||
#include "SkBitmapRegionDecoderInterface.h"
|
#include "SkBitmapRegionDecoder.h"
|
||||||
#include "SkBBoxHierarchy.h"
|
#include "SkBBoxHierarchy.h"
|
||||||
#include "SkCanvas.h"
|
#include "SkCanvas.h"
|
||||||
#include "SkCodec.h"
|
#include "SkCodec.h"
|
||||||
@ -588,11 +588,11 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool
|
|||||||
return true;
|
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,
|
SkColorType colorType, uint32_t sampleSize, uint32_t minOutputSize, int* width,
|
||||||
int* height) {
|
int* height) {
|
||||||
SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(
|
SkAutoTDelete<SkBitmapRegionDecoder> brd(
|
||||||
SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(encoded, strategy));
|
SkBitmapRegionDecoder::Create(encoded, strategy));
|
||||||
if (nullptr == brd.get()) {
|
if (nullptr == brd.get()) {
|
||||||
// This is indicates that subset decoding is not supported for a particular image format.
|
// This is indicates that subset decoding is not supported for a particular image format.
|
||||||
return false;
|
return false;
|
||||||
@ -956,12 +956,12 @@ public:
|
|||||||
// Run the BRDBenches
|
// Run the BRDBenches
|
||||||
// We will benchmark multiple BRD strategies.
|
// We will benchmark multiple BRD strategies.
|
||||||
static const struct {
|
static const struct {
|
||||||
SkBitmapRegionDecoderInterface::Strategy fStrategy;
|
SkBitmapRegionDecoder::Strategy fStrategy;
|
||||||
const char* fName;
|
const char* fName;
|
||||||
} strategies[] = {
|
} strategies[] = {
|
||||||
{ SkBitmapRegionDecoderInterface::kOriginal_Strategy, "BRD" },
|
{ SkBitmapRegionDecoder::kOriginal_Strategy, "BRD" },
|
||||||
{ SkBitmapRegionDecoderInterface::kCanvas_Strategy, "BRD_canvas" },
|
{ SkBitmapRegionDecoder::kCanvas_Strategy, "BRD_canvas" },
|
||||||
{ SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy, "BRD_android_codec" },
|
{ SkBitmapRegionDecoder::kAndroidCodec_Strategy, "BRD_android_codec" },
|
||||||
};
|
};
|
||||||
|
|
||||||
// We intend to create benchmarks that model the use cases in
|
// We intend to create benchmarks that model the use cases in
|
||||||
@ -986,10 +986,10 @@ public:
|
|||||||
fBenchType = strategies[fCurrentBRDStrategy].fName;
|
fBenchType = strategies[fCurrentBRDStrategy].fName;
|
||||||
|
|
||||||
const SkString& path = fImages[fCurrentBRDImage];
|
const SkString& path = fImages[fCurrentBRDImage];
|
||||||
const SkBitmapRegionDecoderInterface::Strategy strategy =
|
const SkBitmapRegionDecoder::Strategy strategy =
|
||||||
strategies[fCurrentBRDStrategy].fStrategy;
|
strategies[fCurrentBRDStrategy].fStrategy;
|
||||||
|
|
||||||
if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy) {
|
if (SkBitmapRegionDecoder::kOriginal_Strategy == strategy) {
|
||||||
// Disable png and jpeg for SkImageDecoder:
|
// Disable png and jpeg for SkImageDecoder:
|
||||||
if (!FLAGS_jpgBuildTileIndex) {
|
if (!FLAGS_jpgBuildTileIndex) {
|
||||||
if (path.endsWith("JPEG") || path.endsWith("JPG") ||
|
if (path.endsWith("JPEG") || path.endsWith("JPG") ||
|
||||||
|
30
dm/DM.cpp
30
dm/DM.cpp
@ -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) {
|
CodecSrc::DstColorType dstColorType) {
|
||||||
switch (strategy) {
|
switch (strategy) {
|
||||||
case SkBitmapRegionDecoderInterface::kCanvas_Strategy:
|
case SkBitmapRegionDecoder::kCanvas_Strategy:
|
||||||
if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) {
|
if (CodecSrc::kGetFromCanvas_DstColorType == dstColorType) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case SkBitmapRegionDecoderInterface::kOriginal_Strategy:
|
case SkBitmapRegionDecoder::kOriginal_Strategy:
|
||||||
switch (dstColorType) {
|
switch (dstColorType) {
|
||||||
case CodecSrc::kGetFromCanvas_DstColorType:
|
case CodecSrc::kGetFromCanvas_DstColorType:
|
||||||
case CodecSrc::kIndex8_Always_DstColorType:
|
case CodecSrc::kIndex8_Always_DstColorType:
|
||||||
@ -398,7 +398,7 @@ static bool brd_color_type_supported(SkBitmapRegionDecoderInterface::Strategy st
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy:
|
case SkBitmapRegionDecoder::kAndroidCodec_Strategy:
|
||||||
switch (dstColorType) {
|
switch (dstColorType) {
|
||||||
case CodecSrc::kGetFromCanvas_DstColorType:
|
case CodecSrc::kGetFromCanvas_DstColorType:
|
||||||
case CodecSrc::kIndex8_Always_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) {
|
CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleSize) {
|
||||||
SkString folder;
|
SkString folder;
|
||||||
switch (strategy) {
|
switch (strategy) {
|
||||||
case SkBitmapRegionDecoderInterface::kCanvas_Strategy:
|
case SkBitmapRegionDecoder::kCanvas_Strategy:
|
||||||
folder.append("brd_canvas");
|
folder.append("brd_canvas");
|
||||||
break;
|
break;
|
||||||
case SkBitmapRegionDecoderInterface::kOriginal_Strategy:
|
case SkBitmapRegionDecoder::kOriginal_Strategy:
|
||||||
folder.append("brd_sample");
|
folder.append("brd_sample");
|
||||||
break;
|
break;
|
||||||
case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy:
|
case SkBitmapRegionDecoder::kAndroidCodec_Strategy:
|
||||||
folder.append("brd_android_codec");
|
folder.append("brd_android_codec");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -466,10 +466,10 @@ static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str
|
|||||||
|
|
||||||
static void push_brd_srcs(Path path) {
|
static void push_brd_srcs(Path path) {
|
||||||
|
|
||||||
const SkBitmapRegionDecoderInterface::Strategy strategies[] = {
|
const SkBitmapRegionDecoder::Strategy strategies[] = {
|
||||||
SkBitmapRegionDecoderInterface::kCanvas_Strategy,
|
SkBitmapRegionDecoder::kCanvas_Strategy,
|
||||||
SkBitmapRegionDecoderInterface::kOriginal_Strategy,
|
SkBitmapRegionDecoder::kOriginal_Strategy,
|
||||||
SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy,
|
SkBitmapRegionDecoder::kAndroidCodec_Strategy,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test on a variety of sampleSizes, making sure to include:
|
// Test on a variety of sampleSizes, making sure to include:
|
||||||
@ -492,12 +492,12 @@ static void push_brd_srcs(Path path) {
|
|||||||
BRDSrc::kDivisor_Mode,
|
BRDSrc::kDivisor_Mode,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) {
|
for (SkBitmapRegionDecoder::Strategy strategy : strategies) {
|
||||||
|
|
||||||
// We disable png testing for kOriginal_Strategy because the implementation leaks
|
// We disable png testing for kOriginal_Strategy because the implementation leaks
|
||||||
// memory in our forked libpng.
|
// memory in our forked libpng.
|
||||||
// TODO (msarett): Decide if we want to test pngs in this mode and how we might do this.
|
// 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"))) {
|
(path.endsWith(".png") || path.endsWith(".PNG"))) {
|
||||||
continue;
|
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.
|
// 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
|
// 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.
|
// 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(".jpg") || path.endsWith(".JPG") ||
|
||||||
path.endsWith(".jpeg") || path.endsWith(".JPEG")) && !SkIsPow2(sampleSize)) {
|
path.endsWith(".jpeg") || path.endsWith(".JPEG")) && !SkIsPow2(sampleSize)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -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)
|
CodecSrc::DstColorType dstColorType, uint32_t sampleSize)
|
||||||
: fPath(path)
|
: fPath(path)
|
||||||
, fStrategy(strategy)
|
, fStrategy(strategy)
|
||||||
@ -82,13 +82,13 @@ bool BRDSrc::veto(SinkFlags flags) const {
|
|||||||
|| flags.approach != SinkFlags::kDirect;
|
|| flags.approach != SinkFlags::kDirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SkBitmapRegionDecoderInterface* create_brd(Path path,
|
static SkBitmapRegionDecoder* create_brd(Path path,
|
||||||
SkBitmapRegionDecoderInterface::Strategy strategy) {
|
SkBitmapRegionDecoder::Strategy strategy) {
|
||||||
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
|
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
|
||||||
if (!encoded) {
|
if (!encoded) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(encoded, strategy);
|
return SkBitmapRegionDecoder::Create(encoded, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error BRDSrc::draw(SkCanvas* canvas) const {
|
Error BRDSrc::draw(SkCanvas* canvas) const {
|
||||||
@ -108,7 +108,7 @@ Error BRDSrc::draw(SkCanvas* canvas) const {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(create_brd(fPath, fStrategy));
|
SkAutoTDelete<SkBitmapRegionDecoder> brd(create_brd(fPath, fStrategy));
|
||||||
if (nullptr == brd.get()) {
|
if (nullptr == brd.get()) {
|
||||||
return Error::Nonfatal(SkStringPrintf("Could not create brd for %s.", fPath.c_str()));
|
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 {
|
SkISize BRDSrc::size() const {
|
||||||
SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(create_brd(fPath, fStrategy));
|
SkAutoTDelete<SkBitmapRegionDecoder> brd(create_brd(fPath, fStrategy));
|
||||||
if (brd) {
|
if (brd) {
|
||||||
return SkISize::Make(SkTMax(1, brd->width() / (int) fSampleSize),
|
return SkISize::Make(SkTMax(1, brd->width() / (int) fSampleSize),
|
||||||
SkTMax(1, brd->height() / (int) fSampleSize));
|
SkTMax(1, brd->height() / (int) fSampleSize));
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "SkBBHFactory.h"
|
#include "SkBBHFactory.h"
|
||||||
#include "SkBBoxHierarchy.h"
|
#include "SkBBoxHierarchy.h"
|
||||||
#include "SkBitmap.h"
|
#include "SkBitmap.h"
|
||||||
#include "SkBitmapRegionDecoderInterface.h"
|
#include "SkBitmapRegionDecoder.h"
|
||||||
#include "SkCanvas.h"
|
#include "SkCanvas.h"
|
||||||
#include "SkData.h"
|
#include "SkData.h"
|
||||||
#include "SkGPipe.h"
|
#include "SkGPipe.h"
|
||||||
@ -163,7 +163,7 @@ public:
|
|||||||
kDivisor_Mode,
|
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;
|
Error draw(SkCanvas*) const override;
|
||||||
SkISize size() const override;
|
SkISize size() const override;
|
||||||
@ -171,7 +171,7 @@ public:
|
|||||||
bool veto(SinkFlags) const override;
|
bool veto(SinkFlags) const override;
|
||||||
private:
|
private:
|
||||||
Path fPath;
|
Path fPath;
|
||||||
SkBitmapRegionDecoderInterface::Strategy fStrategy;
|
SkBitmapRegionDecoder::Strategy fStrategy;
|
||||||
Mode fMode;
|
Mode fMode;
|
||||||
CodecSrc::DstColorType fDstColorType;
|
CodecSrc::DstColorType fDstColorType;
|
||||||
uint32_t fSampleSize;
|
uint32_t fSampleSize;
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
'sources': [
|
'sources': [
|
||||||
'../tools/SkBitmapRegionCanvas.cpp',
|
'../tools/SkBitmapRegionCanvas.cpp',
|
||||||
'../tools/SkBitmapRegionCodec.cpp',
|
'../tools/SkBitmapRegionCodec.cpp',
|
||||||
'../tools/SkBitmapRegionDecoderInterface.cpp',
|
'../tools/SkBitmapRegionDecoder.cpp',
|
||||||
'../tools/SkBitmapRegionSampler.cpp',
|
'../tools/SkBitmapRegionSampler.cpp',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
|
@ -573,8 +573,8 @@ DM_SRCS = ['dm/DM.cpp',
|
|||||||
'tools/SkBitmapRegionCanvas.h',
|
'tools/SkBitmapRegionCanvas.h',
|
||||||
'tools/SkBitmapRegionCodec.cpp',
|
'tools/SkBitmapRegionCodec.cpp',
|
||||||
'tools/SkBitmapRegionCodec.h',
|
'tools/SkBitmapRegionCodec.h',
|
||||||
'tools/SkBitmapRegionDecoderInterface.cpp',
|
'tools/SkBitmapRegionDecoder.cpp',
|
||||||
'tools/SkBitmapRegionDecoderInterface.h',
|
'tools/SkBitmapRegionDecoder.h',
|
||||||
'tools/SkBitmapRegionSampler.cpp',
|
'tools/SkBitmapRegionSampler.cpp',
|
||||||
'tools/SkBitmapRegionSampler.h',
|
'tools/SkBitmapRegionSampler.h',
|
||||||
'tools/flags/SkCommandLineFlags.cpp',
|
'tools/flags/SkCommandLineFlags.cpp',
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SkBitmap.h"
|
#include "SkBitmap.h"
|
||||||
#include "SkBitmapRegionDecoderInterface.h"
|
#include "SkBitmapRegionDecoder.h"
|
||||||
#include "SkCodec.h"
|
#include "SkCodec.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
// FIXME (msarett): This implementation does not support WEBP, because WEBP
|
// FIXME (msarett): This implementation does not support WEBP, because WEBP
|
||||||
// does not have a scanline decoder.
|
// does not have a scanline decoder.
|
||||||
class SkBitmapRegionCanvas : public SkBitmapRegionDecoderInterface {
|
class SkBitmapRegionCanvas : public SkBitmapRegionDecoder {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -36,6 +36,6 @@ private:
|
|||||||
|
|
||||||
SkAutoTDelete<SkCodec> fDecoder;
|
SkAutoTDelete<SkCodec> fDecoder;
|
||||||
|
|
||||||
typedef SkBitmapRegionDecoderInterface INHERITED;
|
typedef SkBitmapRegionDecoder INHERITED;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SkBitmap.h"
|
#include "SkBitmap.h"
|
||||||
#include "SkBitmapRegionDecoderInterface.h"
|
#include "SkBitmapRegionDecoder.h"
|
||||||
#include "SkAndroidCodec.h"
|
#include "SkAndroidCodec.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class implements SkBitmapRegionDecoder using an SkAndroidCodec.
|
* This class implements SkBitmapRegionDecoder using an SkAndroidCodec.
|
||||||
*/
|
*/
|
||||||
class SkBitmapRegionCodec : public SkBitmapRegionDecoderInterface {
|
class SkBitmapRegionCodec : public SkBitmapRegionDecoder {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -32,6 +32,6 @@ private:
|
|||||||
|
|
||||||
SkAutoTDelete<SkAndroidCodec> fCodec;
|
SkAutoTDelete<SkAndroidCodec> fCodec;
|
||||||
|
|
||||||
typedef SkBitmapRegionDecoderInterface INHERITED;
|
typedef SkBitmapRegionDecoder INHERITED;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -7,20 +7,20 @@
|
|||||||
|
|
||||||
#include "SkBitmapRegionCanvas.h"
|
#include "SkBitmapRegionCanvas.h"
|
||||||
#include "SkBitmapRegionCodec.h"
|
#include "SkBitmapRegionCodec.h"
|
||||||
#include "SkBitmapRegionDecoderInterface.h"
|
#include "SkBitmapRegionDecoder.h"
|
||||||
#include "SkBitmapRegionSampler.h"
|
#include "SkBitmapRegionSampler.h"
|
||||||
#include "SkAndroidCodec.h"
|
#include "SkAndroidCodec.h"
|
||||||
#include "SkCodec.h"
|
#include "SkCodec.h"
|
||||||
#include "SkCodecPriv.h"
|
#include "SkCodecPriv.h"
|
||||||
#include "SkImageDecoder.h"
|
#include "SkImageDecoder.h"
|
||||||
|
|
||||||
SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(
|
SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create(
|
||||||
SkData* data, Strategy strategy) {
|
SkData* data, Strategy strategy) {
|
||||||
return SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(new SkMemoryStream(data),
|
return SkBitmapRegionDecoder::Create(new SkMemoryStream(data),
|
||||||
strategy);
|
strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(
|
SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create(
|
||||||
SkStreamRewindable* stream, Strategy strategy) {
|
SkStreamRewindable* stream, Strategy strategy) {
|
||||||
SkAutoTDelete<SkStreamRewindable> streamDeleter(stream);
|
SkAutoTDelete<SkStreamRewindable> streamDeleter(stream);
|
||||||
switch (strategy) {
|
switch (strategy) {
|
@ -16,7 +16,7 @@
|
|||||||
* This class aims to provide an interface to test multiple implementations of
|
* This class aims to provide an interface to test multiple implementations of
|
||||||
* SkBitmapRegionDecoder.
|
* SkBitmapRegionDecoder.
|
||||||
*/
|
*/
|
||||||
class SkBitmapRegionDecoderInterface {
|
class SkBitmapRegionDecoder {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum Strategy {
|
enum Strategy {
|
||||||
@ -30,7 +30,7 @@ public:
|
|||||||
* @param strategy Strategy used for scaling and subsetting
|
* @param strategy Strategy used for scaling and subsetting
|
||||||
* @return Tries to create an SkBitmapRegionDecoder, returns NULL on failure
|
* @return Tries to create an SkBitmapRegionDecoder, returns NULL on failure
|
||||||
*/
|
*/
|
||||||
static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder(
|
static SkBitmapRegionDecoder* Create(
|
||||||
SkData* data, Strategy strategy);
|
SkData* data, Strategy strategy);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -38,7 +38,7 @@ public:
|
|||||||
* @param strategy Strategy used for scaling and subsetting
|
* @param strategy Strategy used for scaling and subsetting
|
||||||
* @return Tries to create an SkBitmapRegionDecoder, returns NULL on failure
|
* @return Tries to create an SkBitmapRegionDecoder, returns NULL on failure
|
||||||
*/
|
*/
|
||||||
static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder(
|
static SkBitmapRegionDecoder* Create(
|
||||||
SkStreamRewindable* stream, Strategy strategy);
|
SkStreamRewindable* stream, Strategy strategy);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -73,11 +73,11 @@ public:
|
|||||||
int width() const { return fWidth; }
|
int width() const { return fWidth; }
|
||||||
int height() const { return fHeight; }
|
int height() const { return fHeight; }
|
||||||
|
|
||||||
virtual ~SkBitmapRegionDecoderInterface() {}
|
virtual ~SkBitmapRegionDecoder() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
SkBitmapRegionDecoderInterface(int width, int height)
|
SkBitmapRegionDecoder(int width, int height)
|
||||||
: fWidth(width)
|
: fWidth(width)
|
||||||
, fHeight(height)
|
, fHeight(height)
|
||||||
{}
|
{}
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SkBitmap.h"
|
#include "SkBitmap.h"
|
||||||
#include "SkBitmapRegionDecoderInterface.h"
|
#include "SkBitmapRegionDecoder.h"
|
||||||
#include "SkImageDecoder.h"
|
#include "SkImageDecoder.h"
|
||||||
#include "SkTemplates.h"
|
#include "SkTemplates.h"
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* This class aims to duplicate the current implementation of
|
* This class aims to duplicate the current implementation of
|
||||||
* SkBitmapRegionDecoder in Android.
|
* SkBitmapRegionDecoder in Android.
|
||||||
*/
|
*/
|
||||||
class SkBitmapRegionSampler : public SkBitmapRegionDecoderInterface {
|
class SkBitmapRegionSampler : public SkBitmapRegionDecoder {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -40,6 +40,6 @@ private:
|
|||||||
|
|
||||||
SkAutoTDelete<SkImageDecoder> fDecoder;
|
SkAutoTDelete<SkImageDecoder> fDecoder;
|
||||||
|
|
||||||
typedef SkBitmapRegionDecoderInterface INHERITED;
|
typedef SkBitmapRegionDecoder INHERITED;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user