aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleUnpremul.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'samplecode/SampleUnpremul.cpp')
-rw-r--r--samplecode/SampleUnpremul.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/samplecode/SampleUnpremul.cpp b/samplecode/SampleUnpremul.cpp
index 4e3e1fae97..fb9735c017 100644
--- a/samplecode/SampleUnpremul.cpp
+++ b/samplecode/SampleUnpremul.cpp
@@ -8,14 +8,13 @@
#include "gm.h"
#include "sk_tool_utils.h"
+#include "DecodeFile.h"
#include "Resources.h"
#include "SampleCode.h"
#include "SkBlurMask.h"
#include "SkBlurDrawLooper.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
-#include "SkForceLinking.h"
-#include "SkImageDecoder.h"
#include "SkOSFile.h"
#include "SkStream.h"
#include "SkString.h"
@@ -24,8 +23,6 @@
#include "SkUtils.h"
#include "SkView.h"
-__SK_FORCE_IMAGE_DECODER_LINKING;
-
/**
* Interprets c as an unpremultiplied color, and returns the
* premultiplied equivalent.
@@ -167,17 +164,7 @@ private:
fDecodeSucceeded = false;
return;
}
- SkFILEStream stream(fCurrFile.c_str());
- SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
- if (nullptr == decoder.get()) {
- fDecodeSucceeded = false;
- return;
- }
- if (!fPremul) {
- decoder->setRequireUnpremultipliedColors(true);
- }
- fDecodeSucceeded = decoder->decode(&stream, &fBitmap, kN32_SkColorType,
- SkImageDecoder::kDecodePixels_Mode) != SkImageDecoder::kFailure;
+ fDecodeSucceeded = decode_file(fCurrFile.c_str(), &fBitmap, kN32_SkColorType, !fPremul);
this->inval(nullptr);
}