mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
Rename CBitmap to CharacterBitmap.
This commit is contained in:
parent
305aa25aae
commit
e180e2553a
10 changed files with 33 additions and 33 deletions
|
@ -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));
|
|
||||||
}
|
|
||||||
|
|
17
Widgets/CharacterBitmap.cpp
Normal file
17
Widgets/CharacterBitmap.cpp
Normal 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));
|
||||||
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
#include <AK/Retainable.h>
|
#include <AK/Retainable.h>
|
||||||
#include <AK/RetainPtr.h>
|
#include <AK/RetainPtr.h>
|
||||||
|
|
||||||
class CBitmap : public Retainable<CBitmap> {
|
class CharacterBitmap : public Retainable<CharacterBitmap> {
|
||||||
public:
|
public:
|
||||||
static RetainPtr<CBitmap> createFromASCII(const char* asciiData, unsigned width, unsigned height);
|
static RetainPtr<CharacterBitmap> createFromASCII(const char* asciiData, unsigned width, unsigned height);
|
||||||
~CBitmap();
|
~CharacterBitmap();
|
||||||
|
|
||||||
const char* bits() const { return m_bits; }
|
const char* bits() const { return m_bits; }
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public:
|
||||||
unsigned height() const { return m_size.height(); }
|
unsigned height() const { return m_size.height(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CBitmap(const char* b, unsigned w, unsigned h);
|
CharacterBitmap(const char* b, unsigned w, unsigned h);
|
||||||
|
|
||||||
const char* m_bits { nullptr };
|
const char* m_bits { nullptr };
|
||||||
Size m_size;
|
Size m_size;
|
|
@ -1,6 +1,6 @@
|
||||||
#include "CheckBox.h"
|
#include "CheckBox.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
#include "CBitmap.h"
|
#include "CharacterBitmap.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
CheckBox::CheckBox(Widget* parent)
|
CheckBox::CheckBox(Widget* parent)
|
||||||
|
@ -76,7 +76,7 @@ static const char* checkedBitmap = {
|
||||||
void CheckBox::paintEvent(PaintEvent&)
|
void CheckBox::paintEvent(PaintEvent&)
|
||||||
{
|
{
|
||||||
Painter painter(*this);
|
Painter painter(*this);
|
||||||
auto bitmap = CBitmap::createFromASCII(isChecked() ? checkedBitmap : uncheckedBitmap, 11, 11);
|
auto bitmap = CharacterBitmap::createFromASCII(isChecked() ? checkedBitmap : uncheckedBitmap, 11, 11);
|
||||||
|
|
||||||
auto textRect = rect();
|
auto textRect = rect();
|
||||||
textRect.setLeft(bitmap->width() + 4);
|
textRect.setLeft(bitmap->width() + 4);
|
||||||
|
|
|
@ -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 (!m_bitmaps[ch]) {
|
||||||
if (ch < m_firstGlyph || ch > m_lastGlyph)
|
if (ch < m_firstGlyph || ch > m_lastGlyph)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
const char* data = m_glyphs[(unsigned)ch - m_firstGlyph];
|
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);
|
ASSERT(ch >= m_firstGlyph && ch <= m_lastGlyph);
|
||||||
return m_bitmaps[ch].ptr();
|
return m_bitmaps[ch].ptr();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CBitmap.h"
|
#include "CharacterBitmap.h"
|
||||||
#include <AK/Retainable.h>
|
#include <AK/Retainable.h>
|
||||||
#include <AK/RetainPtr.h>
|
#include <AK/RetainPtr.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
@ -11,7 +11,7 @@ public:
|
||||||
|
|
||||||
~Font();
|
~Font();
|
||||||
|
|
||||||
const CBitmap* glyphBitmap(byte) const;
|
const CharacterBitmap* glyphBitmap(byte) const;
|
||||||
|
|
||||||
byte glyphWidth() const { return m_glyphWidth; }
|
byte glyphWidth() const { return m_glyphWidth; }
|
||||||
byte glyphHeight() const { return m_glyphHeight; }
|
byte glyphHeight() const { return m_glyphHeight; }
|
||||||
|
@ -20,7 +20,7 @@ private:
|
||||||
Font(const char* const* glyphs, byte glyphWidth, byte glyphHeight, byte firstGlyph, byte lastGlyph);
|
Font(const char* const* glyphs, byte glyphWidth, byte glyphHeight, byte firstGlyph, byte lastGlyph);
|
||||||
|
|
||||||
const char* const* m_glyphs { nullptr };
|
const char* const* m_glyphs { nullptr };
|
||||||
mutable RetainPtr<CBitmap> m_bitmaps[256];
|
mutable RetainPtr<CharacterBitmap> m_bitmaps[256];
|
||||||
|
|
||||||
byte m_glyphWidth { 0 };
|
byte m_glyphWidth { 0 };
|
||||||
byte m_glyphHeight { 0 };
|
byte m_glyphHeight { 0 };
|
||||||
|
|
|
@ -22,7 +22,7 @@ VFS_OBJS = \
|
||||||
Font.o \
|
Font.o \
|
||||||
Window.o \
|
Window.o \
|
||||||
ClockWidget.o \
|
ClockWidget.o \
|
||||||
CBitmap.o \
|
CharacterBitmap.o \
|
||||||
CheckBox.o \
|
CheckBox.o \
|
||||||
ListBox.o \
|
ListBox.o \
|
||||||
TextBox.o \
|
TextBox.o \
|
||||||
|
|
|
@ -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 point = p;
|
||||||
point.moveBy(m_translation);
|
point.moveBy(m_translation);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "Size.h"
|
#include "Size.h"
|
||||||
#include <AK/AKString.h>
|
#include <AK/AKString.h>
|
||||||
|
|
||||||
class CBitmap;
|
class CharacterBitmap;
|
||||||
class GraphicsBitmap;
|
class GraphicsBitmap;
|
||||||
class Font;
|
class Font;
|
||||||
class Widget;
|
class Widget;
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
void fillRect(const Rect&, Color);
|
void fillRect(const Rect&, Color);
|
||||||
void drawRect(const Rect&, Color);
|
void drawRect(const Rect&, Color);
|
||||||
void drawText(const Rect&, const String&, TextAlignment = TextAlignment::TopLeft, Color = 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 drawPixel(const Point&, Color);
|
||||||
void drawLine(const Point& p1, const Point& p2, Color);
|
void drawLine(const Point& p1, const Point& p2, Color);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "TextBox.h"
|
#include "TextBox.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "CBitmap.h"
|
#include "CharacterBitmap.h"
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
|
|
||||||
TextBox::TextBox(Widget* parent)
|
TextBox::TextBox(Widget* parent)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue