Exemplo n.º 1
0
AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void)
{
    ALCcontext *Context;

    Context = GetContextRef();
    if(!Context) return;

    if(ExchangeInt(&Context->DeferUpdates, AL_FALSE))
    {
        ALsizei pos;

        LockContext(Context);
        LockUIntMapRead(&Context->SourceMap);
        for(pos = 0;pos < Context->SourceMap.size;pos++)
        {
            ALsource *Source = Context->SourceMap.array[pos].value;
            ALenum new_state;

            if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) &&
               Source->Offset >= 0.0)
                ApplyOffset(Source);

            new_state = ExchangeInt(&Source->new_state, AL_NONE);
            if(new_state)
                SetSourceState(Source, Context, new_state);
        }
        UnlockUIntMapRead(&Context->SourceMap);
        UnlockContext(Context);
    }

    ALCcontext_DecRef(Context);
}
Exemplo n.º 2
0
void CDLRendererV1_2Fwd::_apply(const float * inImg, float * outImg, long numPixels) const
{
#ifdef USE_SSE
    __m128 inScale, outScale, slope, offset, power, saturation, pix;
    LoadRenderParams(m_inScale,
                     m_outScale,
                     m_renderParams,
                     inScale,
                     outScale,
                     slope,
                     offset,
                     power,
                     saturation);

    float inAlpha;

    // Combine scale and slope so that they can be applied at the same time
    __m128 inScaleSlope = _mm_mul_ps(slope, inScale);

    const float * in = inImg;
    float * out = outImg;

    for(long idx=0; idx<numPixels; ++idx)
    {
        pix = LoadPixel(in, inAlpha);

        // inScale is combined with slope
        ApplySlope(pix, inScaleSlope);
        ApplyOffset(pix, offset);

        ApplyPower<CLAMP>(pix, power);

        ApplySaturation(pix, saturation);
        ApplyClamp<CLAMP>(pix);

        ApplyOutScale(pix, outScale);

        StorePixel(out, pix, inAlpha * m_alphaScale);

        in  += 4;
        out += 4;
    }
#else
    const float * in = inImg;
    float * out = outImg;

    // Combine inScale and slope
    const float * slope = m_renderParams.getSlope();
    float inScaleSlope[3] = {slope[0], slope[1], slope[2]};
    ApplyScale(inScaleSlope, m_inScale);

    for (long idx = 0; idx<numPixels; ++idx)
    {
        const float inAlpha = in[3];

        // NB: 'in' and 'out' could be pointers to the same memory buffer.
        memcpy(out, in, 4 * sizeof(float));

        ApplySlope(out, inScaleSlope);
        ApplyOffset(out, m_renderParams.getOffset());

        ApplyPower<CLAMP>(out, m_renderParams.getPower());

        ApplySaturation(out, m_renderParams.getSaturation());
        ApplyClamp<CLAMP>(out);

        ApplyScale(out, m_outScale);

        out[3] = inAlpha * m_alphaScale;

        in  += 4;
        out += 4;
    }
#endif
}
Exemplo n.º 3
0
void CDLRendererV1_2Rev::_apply(const float * inImg, float * outImg, long numPixels) const
{
#ifdef USE_SSE
    __m128 inScale, outScale, slopeRev, offsetRev, powerRev, saturationRev, pix;
    LoadRenderParams(m_inScale,
                     m_outScale,
                     m_renderParams,
                     inScale,
                     outScale, 
                     slopeRev,
                     offsetRev,
                     powerRev,
                     saturationRev);

    float inAlpha = 1.0f;

    const float * in = inImg;
    float * out = outImg;

    for(long idx=0; idx<numPixels; ++idx)
    {
        pix = LoadPixel(in, inAlpha);

        ApplyInScale(pix, inScale);

        ApplyClamp<CLAMP>(pix);
        ApplySaturation(pix, saturationRev);

        ApplyPower<CLAMP>(pix, powerRev);

        ApplyOffset(pix, offsetRev);
        ApplySlope(pix, slopeRev);
        ApplyClamp<CLAMP>(pix);

        ApplyOutScale(pix, outScale);
        StorePixel(out, pix, inAlpha * m_alphaScale);

        in  += 4;
        out += 4;
    }
#else
    const float * in = inImg;
    float * out = outImg;

    for (long idx = 0; idx<numPixels; ++idx)
    {
        const float inAlpha = in[3];

        // NB: 'in' and 'out' could be pointers to the same memory buffer.
        memcpy(out, in, 4 * sizeof(float));

        ApplyScale(out, m_inScale);

        ApplyClamp<CLAMP>(out);
        ApplySaturation(out, m_renderParams.getSaturation());

        ApplyPower<CLAMP>(out, m_renderParams.getPower());

        ApplyOffset(out, m_renderParams.getOffset());
        ApplySlope(out, m_renderParams.getSlope());
        ApplyClamp<CLAMP>(out);

        ApplyScale(out, m_outScale);

        out[3] = inAlpha * m_alphaScale;

        in  += 4;
        out += 4;
    }

#endif
}
void ScrollBarRenderComponent::OnRender(VariantList *pVList)
{
	//NOTE: We don't support drawing a horizontal scroll bar yet!
	CHECK_GL_ERROR();
	//LogMsg("Drawing progress bar: %.2f", progress);
	if (*m_pAlpha <= 0.07)
	{
		return; //not ready
	}

	float contentAreaRatio;
	
	GLboolean bScissorEnabled = false;
	glGetBooleanv(GL_SCISSOR_TEST, &bScissorEnabled);

	if (bScissorEnabled)
	{
		g_globalBatcher.Flush();
		//disable it temporarily
		glDisable(GL_SCISSOR_TEST);
	}
	float barHeight;
	float barWidth;
	CL_Vec2f vFinalPos;
	uint32 color = ColorCombine(*m_pColor, *m_pColorMod, *m_pAlpha);

	if (!m_pSurf) return; //can't do anything without the graphics loaded
	
	contentAreaRatio = (m_pBoundsRect->get_height()+m_pSize2d->y)/m_pSize2d->y;

	if (!m_bUsingScrollComponent && m_pBoundsRect->get_height() < (m_pSize2d->y+1)) //I don't really know why I need that +1..but it works..
	{
		contentAreaRatio = 0; //definitely don't need to scroll here
	}

	if (contentAreaRatio > 1)
	{
		//render vertical scroll bar
		m_pSurf->SetupAnim(1,2);

		barHeight = m_pSize2d->y/contentAreaRatio;
		
		if (barHeight < m_pSurf->GetFrameHeight()*2) barHeight = m_pSurf->GetFrameHeight()*2;
		
		barWidth = m_pSurf->GetFrameWidth();
		//LogMsg("percent scrolled is %.2f, contentAreaRation is %.2f", m_pProgress2d->y, contentAreaRatio);

		vFinalPos = pVList->m_variant[0].GetVector2()+ *m_pPos2d + CL_Vec2f(m_pSize2d->x, 0);

		if (vFinalPos.x >= GetScreenSizeXf())
		{
			//position on the inside, not the outside
			vFinalPos.x -= ( barWidth+(iPadMapX(8) )); //adjust the spacer with the screensize
		}
		//slide it down to the right position:
		vFinalPos.y += (m_pSize2d->y - barHeight)* m_pProgress2d->y;

		//draw the top of the capsule
		m_pSurf->BlitAnim(vFinalPos.x, vFinalPos.y,0,0, color);
		vFinalPos.y += m_pSurf->GetFrameHeight(); 
		barHeight -=  m_pSurf->GetFrameHeight()*2;
		//draw the bottom end cap
		m_pSurf->BlitAnim(vFinalPos.x, vFinalPos.y+barHeight,0,1, color);
		//first draw the first end cap
		CL_Rectf r = CL_Rectf(0, 0, barWidth, barHeight);
		ApplyOffset(&r, vFinalPos);
		DrawFilledRect(r, color);
	}

	contentAreaRatio = (m_pBoundsRect->get_width()+m_pSize2d->x)/m_pSize2d->x;

	if (!m_bUsingScrollComponent && m_pBoundsRect->get_width() < (m_pSize2d->x+1)) //I don't really know why I need that +1..but it works..
	{
		contentAreaRatio = 0; //definitely don't need to scroll here
	}
	
	if (contentAreaRatio > 1)
	{
		//render horizontal scroll bar
		m_pSurf->SetupAnim(2,1); //repurpose the graphics for horizontal...

		barWidth = m_pSize2d->x/contentAreaRatio;

		if (barWidth < m_pSurf->GetFrameWidth()*2) barWidth = m_pSurf->GetFrameWidth()*2;

		barHeight= m_pSurf->GetFrameHeight();
		//LogMsg("percent scrolled is %.2f, contentAreaRation is %.2f", m_pProgress2d->x, contentAreaRatio);

		vFinalPos = pVList->m_variant[0].GetVector2()+ *m_pPos2d + CL_Vec2f(0, m_pSize2d->y);

		if (vFinalPos.y >= GetScreenSizeYf())
		{
			//position on the inside, not the outside
			vFinalPos.y -= ( barHeight+(iPadMapY(6) )); //adjust the spacer with the screensize
		}
		//slide it down to the right position:
		vFinalPos.x += (m_pSize2d->x - barWidth)* m_pProgress2d->x;

		//draw the top of the capsule
		m_pSurf->BlitAnim(vFinalPos.x, vFinalPos.y,0,0, color);
		vFinalPos.x += m_pSurf->GetFrameWidth(); 
		barWidth -=  m_pSurf->GetFrameWidth()*2;
		//draw the bottom end cap
		m_pSurf->BlitAnim(vFinalPos.x+barWidth, vFinalPos.y,1,0, color);
		//first draw the first end cap
		CL_Rectf r = CL_Rectf(0, 0, barWidth, barHeight);
		ApplyOffset(&r, vFinalPos);
		DrawFilledRect(r, color);
		CHECK_GL_ERROR();

	}
	
	
	if (bScissorEnabled)
	{
		g_globalBatcher.Flush();
		glEnable(GL_SCISSOR_TEST);
	}
	CHECK_GL_ERROR();

}