1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:47:35 +00:00

LibGfx: Change second argument of BMPWriter::dump() to Options struct

This makes it more economical to add more options here, and makes it
possible to use similar API surface for the other image writers.

(It looks like nothing currently uses this optional parameter, but
having a way to pass options to image writers seems like something
we generally want.)
This commit is contained in:
Nico Weber 2023-03-12 10:24:30 -04:00 committed by Jelle Raaijmakers
parent 74891ab656
commit 01387eb72b
2 changed files with 17 additions and 11 deletions

View file

@ -12,17 +12,22 @@ namespace Gfx {
class Bitmap;
class BMPWriter {
public:
BMPWriter() = default;
// This is not a nested struct to work around https://llvm.org/PR36684
struct BMPWriterOptions {
enum class DibHeader : u32 {
Info = 40,
V3 = 56,
V4 = 108,
};
DibHeader dib_header = DibHeader::V4;
};
ByteBuffer dump(RefPtr<Bitmap const>, DibHeader dib_header = DibHeader::V4);
class BMPWriter {
public:
using Options = BMPWriterOptions;
BMPWriter() = default;
ByteBuffer dump(RefPtr<Bitmap const>, Options options = Options {});
private:
enum class Compression : u32 {