Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Enumerations | Functions | Variables
SkBmpCodec.cpp File Reference
#include "src/codec/SkBmpCodec.h"
#include "include/codec/SkBmpDecoder.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
#include "include/private/SkEncodedInfo.h"
#include "include/private/base/SkAlign.h"
#include "src/codec/SkBmpMaskCodec.h"
#include "src/codec/SkBmpRLECodec.h"
#include "src/codec/SkBmpStandardCodec.h"
#include "src/codec/SkCodecPriv.h"
#include "src/core/SkMasks.h"
#include <cstring>
#include <memory>
#include <utility>

Go to the source code of this file.

Namespaces

namespace  SkBmpDecoder
 

Enumerations

enum  BmpHeaderType {
  kInfoV1_BmpHeaderType , kInfoV2_BmpHeaderType , kInfoV3_BmpHeaderType , kInfoV4_BmpHeaderType ,
  kInfoV5_BmpHeaderType , kOS2V1_BmpHeaderType , kOS2VX_BmpHeaderType , kUnknown_BmpHeaderType
}
 
enum  BmpCompressionMethod {
  kNone_BmpCompressionMethod = 0 , k8BitRLE_BmpCompressionMethod = 1 , k4BitRLE_BmpCompressionMethod = 2 , kBitMasks_BmpCompressionMethod = 3 ,
  kJpeg_BmpCompressionMethod = 4 , kPng_BmpCompressionMethod = 5 , kAlphaBitMasks_BmpCompressionMethod = 6 , kCMYK_BmpCompressionMethod = 11 ,
  kCMYK8BitRLE_BmpCompressionMethod = 12 , kCMYK4BitRLE_BmpCompressionMethod = 13
}
 
enum  BmpInputFormat { kStandard_BmpInputFormat , kRLE_BmpInputFormat , kBitMask_BmpInputFormat , kUnknown_BmpInputFormat }
 

Functions

static BmpHeaderType get_header_type (size_t infoBytes)
 
SK_API bool SkBmpDecoder::IsBmp (const void *, size_t)
 
SK_API std::unique_ptr< SkCodecSkBmpDecoder::Decode (std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
 
SK_API std::unique_ptr< SkCodecSkBmpDecoder::Decode (sk_sp< SkData >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
 

Variables

static constexpr uint32_t kBmpHeaderBytes = 14
 
static constexpr uint32_t kBmpHeaderBytesPlusFour = kBmpHeaderBytes + 4
 
static constexpr uint32_t kBmpOS2V1Bytes = 12
 
static constexpr uint32_t kBmpOS2V2Bytes = 64
 
static constexpr uint32_t kBmpInfoBaseBytes = 16
 
static constexpr uint32_t kBmpInfoV1Bytes = 40
 
static constexpr uint32_t kBmpInfoV2Bytes = 52
 
static constexpr uint32_t kBmpInfoV3Bytes = 56
 
static constexpr uint32_t kBmpInfoV4Bytes = 108
 
static constexpr uint32_t kBmpInfoV5Bytes = 124
 
static constexpr uint32_t kBmpMaskBytes = 12
 

Enumeration Type Documentation

◆ BmpCompressionMethod

Enumerator
kNone_BmpCompressionMethod 
k8BitRLE_BmpCompressionMethod 
k4BitRLE_BmpCompressionMethod 
kBitMasks_BmpCompressionMethod 
kJpeg_BmpCompressionMethod 
kPng_BmpCompressionMethod 
kAlphaBitMasks_BmpCompressionMethod 
kCMYK_BmpCompressionMethod 
kCMYK8BitRLE_BmpCompressionMethod 
kCMYK4BitRLE_BmpCompressionMethod 

Definition at line 45 of file SkBmpCodec.cpp.

45 {
56};
@ kCMYK8BitRLE_BmpCompressionMethod
@ kAlphaBitMasks_BmpCompressionMethod
@ k8BitRLE_BmpCompressionMethod
@ k4BitRLE_BmpCompressionMethod
@ kCMYK_BmpCompressionMethod
@ kBitMasks_BmpCompressionMethod
@ kJpeg_BmpCompressionMethod
@ kNone_BmpCompressionMethod
@ kPng_BmpCompressionMethod
@ kCMYK4BitRLE_BmpCompressionMethod

◆ BmpHeaderType

Enumerator
kInfoV1_BmpHeaderType 
kInfoV2_BmpHeaderType 
kInfoV3_BmpHeaderType 
kInfoV4_BmpHeaderType 
kInfoV5_BmpHeaderType 
kOS2V1_BmpHeaderType 
kOS2VX_BmpHeaderType 
kUnknown_BmpHeaderType 

Definition at line 31 of file SkBmpCodec.cpp.

31 {
40};
@ kOS2VX_BmpHeaderType
@ kInfoV1_BmpHeaderType
@ kUnknown_BmpHeaderType
@ kOS2V1_BmpHeaderType
@ kInfoV4_BmpHeaderType
@ kInfoV3_BmpHeaderType
@ kInfoV5_BmpHeaderType
@ kInfoV2_BmpHeaderType

◆ BmpInputFormat

Enumerator
kStandard_BmpInputFormat 
kRLE_BmpInputFormat 
kBitMask_BmpInputFormat 
kUnknown_BmpInputFormat 

Definition at line 61 of file SkBmpCodec.cpp.

61 {
66};
@ kUnknown_BmpInputFormat
@ kRLE_BmpInputFormat
@ kBitMask_BmpInputFormat
@ kStandard_BmpInputFormat

Function Documentation

◆ get_header_type()

static BmpHeaderType get_header_type ( size_t  infoBytes)
static

Definition at line 108 of file SkBmpCodec.cpp.

108 {
109 if (infoBytes >= kBmpInfoBaseBytes) {
110 // Check the version of the header
111 switch (infoBytes) {
112 case kBmpInfoV1Bytes:
114 case kBmpInfoV2Bytes:
116 case kBmpInfoV3Bytes:
118 case kBmpInfoV4Bytes:
120 case kBmpInfoV5Bytes:
122 case 16:
123 case 20:
124 case 24:
125 case 28:
126 case 32:
127 case 36:
128 case 42:
129 case 46:
130 case 48:
131 case 60:
132 case kBmpOS2V2Bytes:
134 default:
135 SkCodecPrintf("Error: unknown bmp header format.\n");
137 }
138 } if (infoBytes >= kBmpOS2V1Bytes) {
139 // The OS2V1 is treated separately because it has a unique format
141 } else {
142 // There are no valid bmp headers
143 SkCodecPrintf("Error: second bitmap header size is invalid.\n");
145 }
146}
static constexpr uint32_t kBmpInfoV2Bytes
static constexpr uint32_t kBmpInfoV3Bytes
static constexpr uint32_t kBmpOS2V1Bytes
static constexpr uint32_t kBmpInfoBaseBytes
static constexpr uint32_t kBmpOS2V2Bytes
static constexpr uint32_t kBmpInfoV4Bytes
static constexpr uint32_t kBmpInfoV5Bytes
static constexpr uint32_t kBmpInfoV1Bytes
#define SkCodecPrintf(...)
Definition SkCodecPriv.h:23

Variable Documentation

◆ kBmpHeaderBytes

constexpr uint32_t kBmpHeaderBytes = 14
staticconstexpr

Definition at line 96 of file SkBmpCodec.cpp.

◆ kBmpHeaderBytesPlusFour

constexpr uint32_t kBmpHeaderBytesPlusFour = kBmpHeaderBytes + 4
staticconstexpr

Definition at line 97 of file SkBmpCodec.cpp.

◆ kBmpInfoBaseBytes

constexpr uint32_t kBmpInfoBaseBytes = 16
staticconstexpr

Definition at line 100 of file SkBmpCodec.cpp.

◆ kBmpInfoV1Bytes

constexpr uint32_t kBmpInfoV1Bytes = 40
staticconstexpr

Definition at line 101 of file SkBmpCodec.cpp.

◆ kBmpInfoV2Bytes

constexpr uint32_t kBmpInfoV2Bytes = 52
staticconstexpr

Definition at line 102 of file SkBmpCodec.cpp.

◆ kBmpInfoV3Bytes

constexpr uint32_t kBmpInfoV3Bytes = 56
staticconstexpr

Definition at line 103 of file SkBmpCodec.cpp.

◆ kBmpInfoV4Bytes

constexpr uint32_t kBmpInfoV4Bytes = 108
staticconstexpr

Definition at line 104 of file SkBmpCodec.cpp.

◆ kBmpInfoV5Bytes

constexpr uint32_t kBmpInfoV5Bytes = 124
staticconstexpr

Definition at line 105 of file SkBmpCodec.cpp.

◆ kBmpMaskBytes

constexpr uint32_t kBmpMaskBytes = 12
staticconstexpr

Definition at line 106 of file SkBmpCodec.cpp.

◆ kBmpOS2V1Bytes

constexpr uint32_t kBmpOS2V1Bytes = 12
staticconstexpr

Definition at line 98 of file SkBmpCodec.cpp.

◆ kBmpOS2V2Bytes

constexpr uint32_t kBmpOS2V2Bytes = 64
staticconstexpr

Definition at line 99 of file SkBmpCodec.cpp.