Example #1
0
void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
{
	gl_draw_scaled_image_with_border(
		x, y, 
		width, height, 
		mImage, 
		color, 
		TRUE,
		mClipRegion,
		mScaleRegion);
}
Example #2
0
void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
{
	if (mUniformScaling)
	{
		gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion);
	}
	else
	{
		gl_draw_scaled_image_with_border(
			x, y, 
			width, height, 
			mImage, 
			color,
			FALSE,
			mClipRegion,
			mScaleRegion);
	}
}
Example #3
0
void LLConsole::draw()
{
	LLGLSUIDefault gls_ui;

	addQueuedLines();

	// skip lines added more than mLinePersistTime ago
	F32 cur_time = mTimer.getElapsedTimeF32();
	
	if( gStartupState != STATE_STARTED )
	{
		S32 count = mLines.size();
		S32 i = 0;
		while( count-- )
		{
			mAddTimes[i] = cur_time;
			i = (i+1) % mMaxLines;
		}
	}

	F32 skip_time = cur_time - mLinePersistTime;
	F32 fade_time = cur_time - mFadeTime;

	// draw remaining lines
	F32 x_pos = 0.f;
	F32 y_pos = 0.f;

	S32 line_count = mLines.size();

	// remove stale lines
	for (S32 line_num = 0; line_num < line_count; line_num++)
	{
		if((mLinePersistTime > 0.f) && (mAddTimes[0] - skip_time)/(mLinePersistTime - mFadeTime) <= 0.f)
		{
			mLines.pop_front();
			mAddTimes.pop_front();
			mLineLengths.pop_front();
			mColors.pop_front();
		}
	}

	line_count = mLines.size();

	S32 i;
	if (line_count == 0)
	{
		mLastBoxHeight = 0;
		mLastBoxWidth = 0;
		return;
	}
	else
	{
		LLUUID image_id;
		image_id.set(gViewerArt.getString("rounded_square.tga"));
		LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);

		F32 console_opacity = llclamp(gSavedSettings.getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
		LLColor4 color(0.f, 0.f, 0.f, console_opacity);

		S32 max_width = 0;
		for (i = 0; i < line_count; i++)
		{
			max_width = llmax(max_width, mFont->getWidth(mLines[i].c_str()) + 30);
		}
		max_width = llmin(max_width, gViewerWindow->getWindowWidth());

		F32 u = 1.f;//LLCriticalDamp::getInterpolant(0.1f);
		S32 target_height = llfloor(line_count * mFont->getLineHeight() + 15);
		S32 target_width = max_width;
		mLastBoxHeight = llmax(target_height, (S32)lerp((F32)mLastBoxHeight, (F32)target_height, u));
		mLastBoxWidth = llmax(MIN_CONSOLE_WIDTH, llmax(target_width, (S32)lerp((F32)mLastBoxWidth, (F32)target_width, u)));
		gl_draw_scaled_image_with_border(-15, -10, 16, 16, mLastBoxWidth + 15, mLastBoxHeight,
								imagep, color, TRUE );
	}

	y_pos += (line_count-1) * mFont->getLineHeight();


	for (i = 0; i < line_count; i++)
	{
		F32 alpha;

		if ((mLinePersistTime > 0.f) && (mAddTimes[i] < fade_time))
		{
			alpha = (mAddTimes[i] - skip_time)/(mLinePersistTime - mFadeTime);
		}
		else
		{
			alpha = 1.0f;
		}

		if( alpha > 0.f )
		{
			// text line itself
			mFont->render(mLines[i], 0, x_pos, y_pos,
				LLColor4(
					mColors[i].mV[VRED], 
					mColors[i].mV[VGREEN], 
					mColors[i].mV[VBLUE], 
					mColors[i].mV[VALPHA]*alpha),
				LLFontGL::LEFT, 
				LLFontGL::BASELINE,
				LLFontGL::DROP_SHADOW,
				S32_MAX,
				mLastBoxWidth
				);
		}

		y_pos -= mFont->getLineHeight();
	}
}