mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
GraphicsBitmap: Add bpp(), returns the number of bits per pixel.
This commit is contained in:
parent
b529b4a3e6
commit
5cb324ee02
1 changed files with 16 additions and 1 deletions
|
@ -5,8 +5,8 @@
|
|||
#include "Size.h"
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <SharedBuffer.h>
|
||||
|
||||
|
@ -39,6 +39,21 @@ public:
|
|||
size_t pitch() const { return m_pitch; }
|
||||
int shared_buffer_id() const { return m_shared_buffer ? m_shared_buffer->shared_buffer_id() : -1; }
|
||||
|
||||
unsigned bpp() const
|
||||
{
|
||||
switch (m_format) {
|
||||
case Format::Indexed8:
|
||||
return 8;
|
||||
case Format::RGB32:
|
||||
case Format::RGBA32:
|
||||
return 32;
|
||||
case Format::Invalid:
|
||||
return 0;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void fill(Color);
|
||||
|
||||
bool has_alpha_channel() const { return m_format == Format::RGBA32; }
|
||||
|
|
Loading…
Add table
Reference in a new issue