2
* Copyright © 2015 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 or 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
19
#include "typo_renderer.h"
22
using namespace mir::typo;
24
Renderer::Image::Image()
25
: buf(nullptr), width_(0), stride_(0), height_(0), align_(4),
30
Renderer::Image::~Image()
35
void Renderer::Image::reserve(int w, int h, Format f)
40
int const bpp = 1; // format is always alpha8
41
stride_ = (((width_ * bpp) + align_ - 1) / align_) * align_;
43
auto size = stride_ * height_;
44
buf = new unsigned char[size];
52
unsigned long Renderer::unicode_from_utf8(char const** utf8)
54
int char_len = 1; // TODO: Add support for non-ASCII UTF-8
55
unsigned long unicode = **utf8;