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

LibGL+LibGPU+LibSoftGPU: Move ImageFormat.h to LibGPU

This commit is contained in:
Stephan Unverwerth 2022-03-15 13:19:03 +01:00 committed by Andreas Kling
parent 24d420312c
commit 4e0643ae97
8 changed files with 172 additions and 172 deletions

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
namespace GPU {
enum class ImageFormat {
RGB565,
RGB888,
BGR888,
RGBA8888,
BGRA8888,
L8,
L8A8,
};
static constexpr size_t element_size(ImageFormat format)
{
switch (format) {
case ImageFormat::L8:
return 1;
case ImageFormat::RGB565:
case ImageFormat::L8A8:
return 2;
case ImageFormat::RGB888:
case ImageFormat::BGR888:
return 3;
case ImageFormat::RGBA8888:
case ImageFormat::BGRA8888:
return 4;
default:
VERIFY_NOT_REACHED();
}
}
}