aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-11-06 08:56:32 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-06 08:56:32 -0800
commit5cb4885b4cd1ac5eb3fc92dac5f5509d7c810464 (patch)
tree8edcbfa75ec122129136503140a85a2b55bdc6e5 /dm
parentaa4ba90792a99eed96ac51006bd478d453a751c4 (diff)
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
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp30
-rw-r--r--dm/DMSrcSink.cpp12
-rw-r--r--dm/DMSrcSink.h6
3 files changed, 24 insertions, 24 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 1aaa1768e1..e552b91e58 100644
--- a/dm/DM.cpp
+++ b/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) {
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;