コード例 #1
0
ファイル: Canvas.cpp プロジェクト: kaiinui/Chisa
void Canvas::resize2d(geom::Box const& box)
{
	this->width_ = box.width();
	this->height_ = box.height();
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	this->ortho(0, box.width(), box.height(), 0, -100, 100);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glViewport(0, 0, box.width(), box.height());
	glScissor(0,0,box.width(),box.height());
#ifdef DEBUG
	const GLenum err = glGetError();
	if(err != GL_NO_ERROR){
		CINAMO_EXCEPTION(Exception, "[BUG] Failed to exec resize2d: 0x%08x", err);
	}
#endif
}
コード例 #2
0
ファイル: BlockSession.cpp プロジェクト: ukinau/Chisa
void BlockSession::extendBlock(BlockNode* blockNode)
{
	if(this->inlineObjects_.size() > 0){
		this->newInline();
	}
	//ここまでで、インライン要素が一切挿入されていないことが保証される
	geom::Box const size = blockNode->areaInBlock().box() + blockNode->margin().totalSpace();
	if(size.width() > this->calcBlockLimit()){
		this->newBlockLine();
	}
	if(this->dir_ == BlockNode::Direction::Unspecified){
		this->dir_ = blockNode->direction();
	}
	switch (this->dir_) {
	case BlockNode::Direction::None:
		this->newBlockLine();
		blockNode->areaInBlock(geom::Area(0, this->consumedHeight_, limitSize_.width(), size.height()));
		this->consumedHeight_ += size.height();
		break;
	case BlockNode::Direction::Right:
		if(blockNode->direction() != BlockNode::Direction::Right){
			this->newBlockLine();
			this->dir_ = blockNode->direction();
		}
		blockNode->areaInBlock(geom::Area(this->blockPosX_, this->consumedHeight_, size.width(), size.height()));
		this->blockConsumedHeight_ = std::max(this->blockConsumedHeight_, size.height());
		this->blockPosX_ += size.width();
		break;
	case BlockNode::Direction::Left:
		if(blockNode->direction() != BlockNode::Direction::Left){
			this->newBlockLine();
			this->dir_ = blockNode->direction();
		}
		blockNode->areaInBlock(geom::Area(limitSize_.width() - this->blockPosX_ - size.width(), this->consumedHeight_, size.width(), size.height()));
		this->blockConsumedHeight_ = std::max(this->blockConsumedHeight_, size.height());
		this->blockPosX_ += size.width();
		break;
	default:
		CINAMO_EXCEPTION(Exception, "[BUG] Unknown direction: %d", this->dir_);
	}
}