blob: 1c57ce6de4c06efe182ace6508d879897587fc6d [file] [log] [blame]
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001/*
2 * Copyright 2017 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#ifndef SkBmpBaseCodec_DEFINED
8#define SkBmpBaseCodec_DEFINED
9
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/private/SkTemplates.h"
11#include "src/codec/SkBmpCodec.h"
Leon Scroggins IIId81fed92017-06-01 13:42:28 -040012
13/*
14 * Common base class for SkBmpStandardCodec and SkBmpMaskCodec.
15 */
16class SkBmpBaseCodec : public SkBmpCodec {
17public:
18 ~SkBmpBaseCodec() override;
19
20 /*
21 * Whether fSrcBuffer was successfully created.
22 *
23 * If false, this Codec must not be used.
24 */
25 bool didCreateSrcBuffer() const { return fSrcBuffer != nullptr; }
26
27protected:
Leon Scroggins III36f7e322018-08-27 11:55:46 -040028 SkBmpBaseCodec(SkEncodedInfo&& info, std::unique_ptr<SkStream>,
Leon Scroggins IIId81fed92017-06-01 13:42:28 -040029 uint16_t bitsPerPixel, SkCodec::SkScanlineOrder rowOrder);
30
31 uint8_t* srcBuffer() { return reinterpret_cast<uint8_t*>(fSrcBuffer.get()); }
32
33private:
34 SkAutoFree fSrcBuffer;
35
36 typedef SkBmpCodec INHERITED;
37};
38#endif // SkBmpBaseCodec_DEFINED