Rename CBitmap to CharacterBitmap.

This commit is contained in:
Andreas Kling 2019-01-10 05:41:49 +01:00
parent 305aa25aae
commit e180e2553a
Notes: sideshowbarker 2024-07-19 16:05:16 +09:00
10 changed files with 33 additions and 33 deletions

View file

@ -1,17 +0,0 @@
#include "CBitmap.h"
CBitmap::CBitmap(const char* asciiData, unsigned width, unsigned height)
: m_bits(asciiData)
, m_size(width, height)
{
}
CBitmap::~CBitmap()
{
}
RetainPtr<CBitmap> CBitmap::createFromASCII(const char* asciiData, unsigned width, unsigned height)
{
return adopt(*new CBitmap(asciiData, width, height));
}

View file

@ -0,0 +1,17 @@
#include "CharacterBitmap.h"
CharacterBitmap::CharacterBitmap(const char* asciiData, unsigned width, unsigned height)
: m_bits(asciiData)
, m_size(width, height)
{
}
CharacterBitmap::~CharacterBitmap()
{
}
RetainPtr<CharacterBitmap> CharacterBitmap::createFromASCII(const char* asciiData, unsigned width, unsigned height)
{
return adopt(*new CharacterBitmap(asciiData, width, height));
}

View file

@ -4,10 +4,10 @@
#include <AK/Retainable.h>
#include <AK/RetainPtr.h>
class CBitmap : public Retainable<CBitmap> {
class CharacterBitmap : public Retainable<CharacterBitmap> {
public:
static RetainPtr<CBitmap> createFromASCII(const char* asciiData, unsigned width, unsigned height);
~CBitmap();
static RetainPtr<CharacterBitmap> createFromASCII(const char* asciiData, unsigned width, unsigned height);
~CharacterBitmap();
const char* bits() const { return m_bits; }
@ -16,7 +16,7 @@ public:
unsigned height() const { return m_size.height(); }
private:
CBitmap(const char* b, unsigned w, unsigned h);
CharacterBitmap(const char* b, unsigned w, unsigned h);
const char* m_bits { nullptr };
Size m_size;

View file

@ -1,6 +1,6 @@
#include "CheckBox.h"
#include "Painter.h"
#include "CBitmap.h"
#include "CharacterBitmap.h"
#include <cstdio>
CheckBox::CheckBox(Widget* parent)
@ -76,7 +76,7 @@ static const char* checkedBitmap = {
void CheckBox::paintEvent(PaintEvent&)
{
Painter painter(*this);
auto bitmap = CBitmap::createFromASCII(isChecked() ? checkedBitmap : uncheckedBitmap, 11, 11);
auto bitmap = CharacterBitmap::createFromASCII(isChecked() ? checkedBitmap : uncheckedBitmap, 11, 11);
auto textRect = rect();
textRect.setLeft(bitmap->width() + 4);

View file

@ -22,13 +22,13 @@ Font::~Font()
{
}
const CBitmap* Font::glyphBitmap(byte ch) const
const CharacterBitmap* Font::glyphBitmap(byte ch) const
{
if (!m_bitmaps[ch]) {
if (ch < m_firstGlyph || ch > m_lastGlyph)
return nullptr;
const char* data = m_glyphs[(unsigned)ch - m_firstGlyph];
m_bitmaps[ch] = CBitmap::createFromASCII(data, m_glyphWidth, m_glyphHeight);
m_bitmaps[ch] = CharacterBitmap::createFromASCII(data, m_glyphWidth, m_glyphHeight);
}
ASSERT(ch >= m_firstGlyph && ch <= m_lastGlyph);
return m_bitmaps[ch].ptr();

View file

@ -1,6 +1,6 @@
#pragma once
#include "CBitmap.h"
#include "CharacterBitmap.h"
#include <AK/Retainable.h>
#include <AK/RetainPtr.h>
#include <AK/Types.h>
@ -11,7 +11,7 @@ public:
~Font();
const CBitmap* glyphBitmap(byte) const;
const CharacterBitmap* glyphBitmap(byte) const;
byte glyphWidth() const { return m_glyphWidth; }
byte glyphHeight() const { return m_glyphHeight; }
@ -20,7 +20,7 @@ private:
Font(const char* const* glyphs, byte glyphWidth, byte glyphHeight, byte firstGlyph, byte lastGlyph);
const char* const* m_glyphs { nullptr };
mutable RetainPtr<CBitmap> m_bitmaps[256];
mutable RetainPtr<CharacterBitmap> m_bitmaps[256];
byte m_glyphWidth { 0 };
byte m_glyphHeight { 0 };

View file

@ -22,7 +22,7 @@ VFS_OBJS = \
Font.o \
Window.o \
ClockWidget.o \
CBitmap.o \
CharacterBitmap.o \
CheckBox.o \
ListBox.o \
TextBox.o \

View file

@ -75,7 +75,7 @@ void Painter::xorRect(const Rect& rect, Color color)
}
}
void Painter::drawBitmap(const Point& p, const CBitmap& bitmap, Color color)
void Painter::drawBitmap(const Point& p, const CharacterBitmap& bitmap, Color color)
{
Point point = p;
point.moveBy(m_translation);

View file

@ -6,7 +6,7 @@
#include "Size.h"
#include <AK/AKString.h>
class CBitmap;
class CharacterBitmap;
class GraphicsBitmap;
class Font;
class Widget;
@ -20,7 +20,7 @@ public:
void fillRect(const Rect&, Color);
void drawRect(const Rect&, Color);
void drawText(const Rect&, const String&, TextAlignment = TextAlignment::TopLeft, Color = Color());
void drawBitmap(const Point&, const CBitmap&, Color = Color());
void drawBitmap(const Point&, const CharacterBitmap&, Color = Color());
void drawPixel(const Point&, Color);
void drawLine(const Point& p1, const Point& p2, Color);

View file

@ -1,7 +1,7 @@
#include "TextBox.h"
#include "Painter.h"
#include "Font.h"
#include "CBitmap.h"
#include "CharacterBitmap.h"
#include <AK/StdLibExtras.h>
TextBox::TextBox(Widget* parent)