/* * Copyright 2024 Google LLC. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file.
*/ #ifndef SkPngCodecBase_DEFINED #define SkPngCodecBase_DEFINED
class SkColorPalette; class SkSampler; class SkStream; class SkSwizzler; enumclass SkEncodedImageFormat; struct SkImageInfo; template <typename T> class SkSpan;
// This class implements functionality shared between `SkPngCodec` and // `SkPngRustCodec` (the latter is from `experimental/rust_png`). class SkPngCodecBase : public SkCodec { public:
~SkPngCodecBase() override;
// Initialize most fields needed by `applyXformRow`. // // Each call to `applyXformRow` will transform `frameWidth` pixels // (which may be less than `dstInfo.width()` when decoding frames that // depend on earlier frames).
Result initializeXforms(const SkImageInfo& dstInfo, const Options& options, intframeWidth);
// Initialize other fields needed by `applyXformRow`. // // Needs to be called *after* (i.e. outside of) `onStartIncrementalDecode`. void initializeXformParams();
// Transforms a decoded row into the `dstInfo` format that was earlier // passed to `initializeXforms`. // // The first bytes/pixels of `srcRow` will be transformed into the first // bytes/pixels of `dstRow`. In other words, the transformation ignores // `fcTL.x_offset` field - the caller should offset `dstRow` if desired // (it may not be desirable when working with interlaced rows which are // first transformed into an intermediate buffer). void applyXformRow(SkSpan<uint8_t> dstRow, SkSpan<const uint8_t> srcRow); void applyXformRow(void* dstRow, const uint8_t* srcRow);
void allocateStorage(const SkImageInfo& dstInfo);
Result initializeSwizzler(const SkImageInfo& dstInfo, const Options& options, bool skipFormatConversion, int frameWidth); bool createColorTable(const SkImageInfo& dstInfo);
enum XformMode { // Requires only a swizzle pass.
kSwizzleOnly_XformMode,
// Requires only a color xform pass.
kColorOnly_XformMode,
// Requires a swizzle and a color xform.
kSwizzleColor_XformMode,
};
XformMode fXformMode;
std::unique_ptr<SkSwizzler> fSwizzler;
skia_private::AutoTMalloc<uint8_t> fStorage; int fXformWidth = -1;
sk_sp<SkColorPalette> fColorTable; // May be unpremul.
size_t fEncodedRowBytes = 0; // Size of encoded/source row in bytes. #ifdefined(SK_DEBUG)
size_t fDstRowBytes = 0; // Size of destination row in bytes. #endif
};
#endif// SkPngCodecBase_DEFINED
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.