Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkBmpMaskCodec.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkBmpMaskCodec_DEFINED
9#define SkBmpMaskCodec_DEFINED
10
15#include "src/core/SkMasks.h"
16
17#include <cstddef>
18#include <cstdint>
19#include <memory>
20
21class SkSampler;
22class SkStream;
23struct SkEncodedInfo;
24struct SkImageInfo;
25
26/*
27 * This class implements the decoding for bmp images using bit masks
28 */
30public:
31
32 /*
33 * Creates an instance of the decoder
34 *
35 * Called only by SkBmpCodec::MakeFromStream
36 * There should be no other callers despite this being public
37 *
38 * @param info contains properties of the encoded data
39 * @param stream the stream of encoded image data
40 * @param bitsPerPixel the number of bits used to store each pixel
41 * @param masks color masks for certain bmp formats
42 * @param rowOrder indicates whether rows are ordered top-down or bottom-up
43 */
44 SkBmpMaskCodec(SkEncodedInfo&& info, std::unique_ptr<SkStream>,
45 uint16_t bitsPerPixel, SkMasks* masks,
47
48protected:
49
50 Result onGetPixels(const SkImageInfo& dstInfo, void* dst,
51 size_t dstRowBytes, const Options&,
52 int*) override;
53
55 const SkCodec::Options& options) override;
56
57private:
58
59 SkSampler* getSampler(bool createIfNecessary) override {
60 SkASSERT(fMaskSwizzler);
61 return fMaskSwizzler.get();
62 }
63
64 int decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes,
65 const Options& opts) override;
66
67 std::unique_ptr<SkMasks> fMasks;
68 std::unique_ptr<SkMaskSwizzler> fMaskSwizzler;
69
70 using INHERITED = SkBmpBaseCodec;
71};
72#endif // SkBmpMaskCodec_DEFINED
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
#define SkASSERT(cond)
Definition SkAssert.h:116
uint16_t bitsPerPixel() const
Definition SkBmpCodec.h:87
int decodeRows(const SkImageInfo &dstInfo, void *dst, size_t dstRowBytes, const Options &opts) override
SkCodec::Result onPrepareToDecode(const SkImageInfo &dstInfo, const SkCodec::Options &options) override
SkSampler * getSampler(bool createIfNecessary) override
Result onGetPixels(const SkImageInfo &dstInfo, void *dst, size_t dstRowBytes, const Options &, int *) override
const SkImageInfo & dstInfo() const
Definition SkCodec.h:878
SkScanlineOrder
Definition SkCodec.h:575
const Options & options() const
Definition SkCodec.h:880