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

Unified Diff: src/images/SkImageDecoder_astc.cpp

Issue 670453002: Remove image decoder and encoder autoregistration (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-decoder-01-skpicture
Patch Set: Created 6 years, 1 month 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 | « src/images/SkImageDecoder_astc.h ('k') | src/images/SkImageDecoder_ktx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_astc.cpp
diff --git a/src/images/SkImageDecoder_astc.cpp b/src/images/SkImageDecoder_astc.cpp
index 30f42f05df2980456785feaa457f3b4e7681d389..89c01a5612234c1db8759e572276bcba9275c998 100644
--- a/src/images/SkImageDecoder_astc.cpp
+++ b/src/images/SkImageDecoder_astc.cpp
@@ -4,16 +4,14 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
-#include "SkEndian.h"
+#include "SkImageDecoder_astc.h"
#include "SkColorPriv.h"
-#include "SkImageDecoder.h"
+#include "SkEndian.h"
#include "SkScaledBitmapSampler.h"
#include "SkStream.h"
#include "SkStreamPriv.h"
-#include "SkTypes.h"
-
#include "SkTextureCompressor.h"
+#include "SkTypes.h"
class SkASTCImageDecoder : public SkImageDecoder {
public:
@@ -177,34 +175,18 @@ SkImageDecoder::Result SkASTCImageDecoder::onDecode(SkStream* stream, SkBitmap*
return kSuccess;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-DEFINE_DECODER_CREATOR(ASTCImageDecoder);
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static bool is_astc(SkStreamRewindable* stream) {
+SkImageDecoder::Format SkDetectFormatASTCImageDecoder(SkStreamRewindable* stream) {
// Read the ASTC header and make sure it's valid.
uint32_t magic;
- if (stream->read((void*)&magic, 4) != 4) {
- return false;
- }
-
- return kASTCMagicNumber == SkEndian_SwapLE32(magic);
-}
-
-static SkImageDecoder* sk_libastc_dfactory(SkStreamRewindable* stream) {
- if (is_astc(stream)) {
- return SkNEW(SkASTCImageDecoder);
- }
- return NULL;
-}
-
-static SkImageDecoder_DecodeReg gReg(sk_libastc_dfactory);
-
-static SkImageDecoder::Format get_format_astc(SkStreamRewindable* stream) {
- if (is_astc(stream)) {
+ if (stream->read((void*)&magic, 4) == 4 &&
+ kASTCMagicNumber == SkEndian_SwapLE32(magic)) {
return SkImageDecoder::kASTC_Format;
}
return SkImageDecoder::kUnknown_Format;
}
-static SkImageDecoder_FormatReg gFormatReg(get_format_astc);
+SkImageDecoder* SkCreateASTCImageDecoder(SkImageDecoder::Format format) {
+ SkASSERT(SkImageDecoder::kASTC_Format == format);
+ return SkNEW(SkASTCImageDecoder);
+}
+
« no previous file with comments | « src/images/SkImageDecoder_astc.h ('k') | src/images/SkImageDecoder_ktx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698