manually register codecs in DM
We'll want to do this when we've got Google3 refactored to slice out each of these four codecs into its own little target. Small tweaks to make SkPngCodec match the pattern of the rest. Should be harmless to have both the compile-time and runtime registration, right? Change-Id: Ic72394764ac267758dc1023e85f3d0c4b655d420 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213872 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
bc233135e4
commit
9b2633e294
@ -22,6 +22,10 @@
|
|||||||
#include "include/private/SkMutex.h"
|
#include "include/private/SkMutex.h"
|
||||||
#include "include/private/SkSpinlock.h"
|
#include "include/private/SkSpinlock.h"
|
||||||
#include "include/private/SkTHash.h"
|
#include "include/private/SkTHash.h"
|
||||||
|
#include "src/codec/SkIcoCodec.h"
|
||||||
|
#include "src/codec/SkJpegCodec.h"
|
||||||
|
#include "src/codec/SkPngCodec.h"
|
||||||
|
#include "src/codec/SkWebpCodec.h"
|
||||||
#include "src/core/SkColorSpacePriv.h"
|
#include "src/core/SkColorSpacePriv.h"
|
||||||
#include "src/core/SkMD5.h"
|
#include "src/core/SkMD5.h"
|
||||||
#include "src/core/SkOSFile.h"
|
#include "src/core/SkOSFile.h"
|
||||||
@ -1385,6 +1389,11 @@ int main(int argc, char** argv) {
|
|||||||
#endif
|
#endif
|
||||||
CommandLineFlags::Parse(argc, argv);
|
CommandLineFlags::Parse(argc, argv);
|
||||||
|
|
||||||
|
SkCodec::Register( SkIcoCodec::IsIco , SkIcoCodec::MakeFromStream);
|
||||||
|
SkCodec::Register(SkJpegCodec::IsJpeg, SkJpegCodec::MakeFromStream);
|
||||||
|
SkCodec::Register( SkPngCodec::IsPng , SkPngCodec::MakeFromStream);
|
||||||
|
SkCodec::Register(SkWebpCodec::IsWebp, SkWebpCodec::MakeFromStream);
|
||||||
|
|
||||||
initializeEventTracingForTools();
|
initializeEventTracingForTools();
|
||||||
|
|
||||||
#if !defined(SK_BUILD_FOR_GOOGLE3) && defined(SK_BUILD_FOR_IOS)
|
#if !defined(SK_BUILD_FOR_GOOGLE3) && defined(SK_BUILD_FOR_IOS)
|
||||||
|
@ -325,7 +325,7 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo) {
|
|||||||
// Creation
|
// Creation
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool SkPngCodec::IsPng(const char* buf, size_t bytesRead) {
|
bool SkPngCodec::IsPng(const void* buf, size_t bytesRead) {
|
||||||
return !png_sig_cmp((png_bytep) buf, (png_size_t)0, bytesRead);
|
return !png_sig_cmp((png_bytep) buf, (png_size_t)0, bytesRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,11 +19,17 @@ class SkStream;
|
|||||||
|
|
||||||
class SkPngCodec : public SkCodec {
|
class SkPngCodec : public SkCodec {
|
||||||
public:
|
public:
|
||||||
static bool IsPng(const char*, size_t);
|
static bool IsPng(const void*, size_t);
|
||||||
|
|
||||||
// Assume IsPng was called and returned true.
|
// Assume IsPng was called and returned true.
|
||||||
static std::unique_ptr<SkCodec> MakeFromStream(std::unique_ptr<SkStream>, Result*,
|
static std::unique_ptr<SkCodec> MakeFromStream(std::unique_ptr<SkStream>,
|
||||||
SkPngChunkReader* = nullptr);
|
Result*,
|
||||||
|
SkPngChunkReader*);
|
||||||
|
|
||||||
|
static std::unique_ptr<SkCodec> MakeFromStream(std::unique_ptr<SkStream> stream,
|
||||||
|
Result* result) {
|
||||||
|
return MakeFromStream(std::move(stream), result, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME (scroggo): Temporarily needed by AutoCleanPng.
|
// FIXME (scroggo): Temporarily needed by AutoCleanPng.
|
||||||
void setIdatLength(size_t len) { fIdatLength = len; }
|
void setIdatLength(size_t len) { fIdatLength = len; }
|
||||||
|
Loading…
Reference in New Issue
Block a user