示例#1
0
void RectangleTest::access() {
    Rectanglei rect({34, 23}, {47, 30});
    constexpr Rectanglei crect({34, 23}, {47, 30});

    CORRADE_COMPARE(rect.bottomLeft(), Vector2i(34, 23));
    CORRADE_COMPARE(rect.topRight(), Vector2i(47, 30));
    CORRADE_COMPARE(rect.bottom(), 23);
    CORRADE_COMPARE(rect.top(), 30);
    CORRADE_COMPARE(rect.left(), 34);
    CORRADE_COMPARE(rect.right(), 47);
    CORRADE_COMPARE(rect.bottomLeft(), Vector2i(34, 23));
    CORRADE_COMPARE(rect.topRight(), Vector2i(47, 30));

    constexpr Int bottom = crect.bottom();
    constexpr Int top = crect.top();
    constexpr Int left = crect.left();
    constexpr Int right = crect.right();
    CORRADE_COMPARE(bottom, 23);
    CORRADE_COMPARE(top, 30);
    CORRADE_COMPARE(left, 34);
    CORRADE_COMPARE(right, 47);

    constexpr Vector2i bottomLeft = crect.bottomLeft();
    constexpr Vector2i topRight = crect.topRight();
    CORRADE_COMPARE(bottomLeft, Vector2i(34, 23));
    CORRADE_COMPARE(topRight, Vector2i(47, 30));

    CORRADE_COMPARE(rect.topLeft(), Vector2i(34, 30));
    CORRADE_COMPARE(rect.bottomRight(), Vector2i(47, 23));
}
void BoundTexture2d::update_data(const Rectanglei& update_region,
        Texture::DataPixelFormat data_format, Texture::PixelType pixel_type, const void* data)
{
     glTexSubImage2D(GL_TEXTURE_2D, 0, update_region.left(), update_region.bottom(),
			update_region.width(), update_region.height(), static_cast<GLenum>(data_format),
			static_cast<GLenum>(pixel_type), data);
	CHECK_GL_ERROR(glTexSubImage2D);
}