Beispiel #1
0
void window::submit_delayed_expose( const rect &r )
{
	/// \todo { Need to fix the local vs screen coordinates }
	RECT rect = { LONG( std::floor( r.x1() ) ), LONG( std::floor( r.y1() ) ), LONG( std::ceil( r.x2() ) ), LONG( std::ceil( r.y2() ) ) };
	if ( rect.left == rect.top &&
		 rect.left == rect.right &&
		 rect.left == rect.bottom )
		RedrawWindow( _hwnd, NULL, NULL, RDW_INTERNALPAINT|RDW_UPDATENOW );
	else
		RedrawWindow( _hwnd, &rect, NULL, RDW_INVALIDATE|RDW_UPDATENOW );
}
Beispiel #2
0
	void Surface::fillRect(const rect& dst_rect, const Color& color)
	{
		// XXX do we need to consider ARGB/RGBA ordering issues here.
		ASSERT_LOG(dst_rect.x1() >= 0 && dst_rect.x1() <= width(), "destination co-ordinates out of bounds: " << dst_rect.x1() << " : (0," << width() << ")");
		ASSERT_LOG(dst_rect.x2() >= 0 && dst_rect.x2() <= width(), "destination co-ordinates out of bounds: " << dst_rect.x2() << " : (0," << width() << ")");
		ASSERT_LOG(dst_rect.y1() >= 0 && dst_rect.y1() <= height(), "destination co-ordinates out of bounds: " << dst_rect.y1() << " : (0," << height() << ")");
		ASSERT_LOG(dst_rect.y2() >= 0 && dst_rect.y2() <= height(), "destination co-ordinates out of bounds: " << dst_rect.y2() << " : (0," << height() << ")");
		unsigned char* pix = reinterpret_cast<unsigned char*>(pixelsWriteable());
		const int bpp = pf_->bytesPerPixel();
		for(int y = dst_rect.x1(); y < dst_rect.x2(); ++y) {
			for(int x = dst_rect.y1(); x < dst_rect.y2(); ++x) {
				unsigned char* p = &pix[(y * width() + x) * bpp];
				// XXX FIXME
				//uint32_t pixels;
				//pf_->encodeRGBA(&pixels, color.r(), color.g(), color.b(), color.a());
				switch(bpp) {
					case 1: p[0] = color.r_int(); break;
					case 2: p[0] = color.r_int(); p[1] = color.g_int(); break;
					case 3: p[0] = color.r_int(); p[1] = color.g_int(); p[2] = color.b_int(); break;
					case 4: p[0] = color.r_int(); p[1] = color.g_int(); p[2] = color.b_int(); p[3] = color.a_int(); break;
				}
			}
		}		
	}
Beispiel #3
0
	explicit SimpleRenderable(const rect& r, const KRE::Color& color)
		: KRE::SceneObject("simple_renderable")
	{
		init();

		setColor(color);

		const float vx1 = static_cast<float>(r.x1());
		const float vy1 = static_cast<float>(r.y1());
		const float vx2 = static_cast<float>(r.x2());
		const float vy2 = static_cast<float>(r.y2());

		std::vector<glm::vec2> vc;
		vc.emplace_back(vx1, vy2);
		vc.emplace_back(vx1, vy1);
		vc.emplace_back(vx2, vy1);

		vc.emplace_back(vx2, vy1);
		vc.emplace_back(vx2, vy2);
		vc.emplace_back(vx1, vy2);
		attribs_->update(&vc);
	}