void ScreenViewController::render_scene(const CanvasPtr &canvas, const ScenePtr &scene)
{
	using namespace uicore;

	canvas->end();

	GraphicContextPtr gc = canvas->gc();

	Pointf viewport_pos = Vec2f(canvas->transform() * Vec4f(0.0f, 0.0f, 0.0f, 1.0f));
	Sizef viewport_size = gc->size();
	Size viewport_size_i = Size(viewport_size);

	scene->set_viewport(viewport_size_i);
	scene->render(gc);

	canvas->begin();
}
Beispiel #2
0
	void GlyphCache::insert_glyph(const CanvasPtr &canvas, FontPixelBuffer &pb)
	{
		auto font_glyph = std::unique_ptr<Font_TextureGlyph>(new Font_TextureGlyph());

		font_glyph->glyph = pb.glyph;
		font_glyph->offset = pb.offset;
		font_glyph->metrics = pb.metrics;

		if (!pb.empty_buffer)
		{
			PixelBufferPtr buffer_with_border = PixelBuffer::add_border(pb.buffer, glyph_border_size, pb.buffer_rect);
			GraphicContextPtr gc = canvas->gc();
			TextureGroupImage sub_texture = texture_group->add(gc, buffer_with_border->size());
			font_glyph->texture = sub_texture.texture();
			font_glyph->geometry = Rect(sub_texture.geometry().left + glyph_border_size, sub_texture.geometry().top + glyph_border_size, pb.buffer_rect.size());
			font_glyph->size = pb.size;
			sub_texture.texture()->set_subimage(gc, sub_texture.geometry().left, sub_texture.geometry().top, buffer_with_border, buffer_with_border->size());
		}

		glyph_list.push_back(std::move(font_glyph));
	}