Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: samplecode/SampleUnpremul.cpp

Issue 1812323003: Remove uses of SkImageDecoder from samplecode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleTextBox.cpp ('k') | samplecode/SampleVertices.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleUnpremul.cpp
diff --git a/samplecode/SampleUnpremul.cpp b/samplecode/SampleUnpremul.cpp
index 4e3e1fae97b0967d547b81e9decadcb54a9d7dec..fb9735c017cd771a63762725ab299ad91bf21908 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);
}
« no previous file with comments | « samplecode/SampleTextBox.cpp ('k') | samplecode/SampleVertices.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698