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 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::examples::typo;
24
Renderer::Image::Image()
25
: buf(nullptr), width(0), stride(0), height(0), align(4), format(alpha8)
29
Renderer::Image::~Image()
34
void Renderer::Image::reserve(int w, int h, Format f)
39
int const bpp = 1; // format is always alpha8
40
stride = (((width * bpp) + align - 1) / align) * align;
42
auto size = stride * height;
43
buf = new unsigned char[size];
51
unsigned long Renderer::unicode_from_utf8(char const** utf8)
53
int char_len = 1; // TODO: Add support for non-ASCII UTF-8
54
unsigned long unicode = **utf8;