Пример #1
0
void LayerManager::initDevices()
{
	ComResult hr;

	hr = DCompositionCreateDevice2(getCurrentContext().getRenderDevice()->getDevice2(),
		__uuidof(IDCompositionDesktopDevice), &this->pDevice);
	hr = this->pDevice->CreateTargetForHwnd(getCurrentContext().getNativePointer(), true, &this->pTarget);
}
Пример #2
0
void AsioSession::exitContext() {
  assert(isInContext());
  assert(!getCurrentContext()->isRunning());

  m_contexts.back()->exit(m_contexts.size());
  delete m_contexts.back();
  m_contexts.pop_back();

  assert(!isInContext() || getCurrentContext()->isRunning());
}
Пример #3
0
void RenderContext::drawStringHCenter(const std::wstring& str, float left, float right, float top, const std::wstring& formatKey, ID2D1Brush* pBrush)
{
	auto rw = right - left;
	auto pFormat = getCurrentContext().getRenderDevice()->getStockedFormat(formatKey);

	auto pSize = getCurrentContext().getRenderDevice()->calcStringSize(str, pFormat);
	auto pt = D2D1::Point2F(left + (rw - pSize.width) / 2.0f, top);
	this->pInternalContext->DrawTextW(str.c_str(), static_cast<UINT>(str.length()), pFormat,
		D2D1::RectF(pt.x, top, pt.x + pSize.width, top + pSize.height), pBrush);
}
 void ResultBuilder::handleResult( AssertionResult const& result )
 {
     getResultCapture().assertionEnded( result );
     
     if( !result.isOk() ) {
         if( getCurrentContext().getConfig()->shouldDebugBreak() )
             m_shouldDebugBreak = true;
         if( getCurrentContext().getRunner()->aborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
             m_shouldThrow = true;
     }
 }
Пример #5
0
    void ResultBuilder::captureExpression() {
        AssertionResult result = build();
        getResultCapture().assertionEnded( result );

        if( !result.isOk() ) {
            if( getCurrentContext().getConfig()->shouldDebugBreak() )
                m_shouldDebugBreak = true;
            if( getCurrentContext().getRunner()->aborting() || m_assertionInfo.resultDisposition == ResultDisposition::Normal )
                m_shouldThrow = true;
        }
    }
Пример #6
0
void AsioSession::enterContext() {
  assert(!isInContext() || getCurrentContext()->isRunning());

  if (UNLIKELY(getCurrentContextIdx() >= MAX_CONTEXT_DEPTH)) {
    Object e(SystemLib::AllocInvalidOperationExceptionObject(
      "Unable to enter asio context: too many contexts open"));
    throw e;
  }

  m_contexts.push_back(new AsioContext());

  assert(static_cast<context_idx_t>(m_contexts.size()) == m_contexts.size());
  assert(isInContext());
  assert(!getCurrentContext()->isRunning());
}
Пример #7
0
/*-------------------------------------------------------------------------------------------------------------------- 
-- FUNCTION: onClickContext
--
-- DATE: 2013/02/28
--
-- REVISIONS: (Date and Description)
--
-- DESIGNER: Luke Tao
--
-- PROGRAMMER: Luke Tao
--
-- INTERFACE: int InputManager::onClickContext(sf::Event mouseEvent, sf::FloatRect menuContext, 
--						sf::FloatRect buildContext, sf::FloatRect playContext)
--					       
--					       sf::Event mouseEvent - the mouse event
--					       sf::FloatRect menuContext - the menu context
--					       sf::FloatRect buildContext - the builder context
--					       sf::Float Rect playContext - the player context
--
-- RETURNS: Context defined values.
--
-- NOTES: This function handles the events of the mouse clicks. It will print out the coordinates of where the
--	  mouse click happens and determines if it is within one of the context buttons. If the mouse click is within
--        the buttons, it will set the current context value and return that value.
----------------------------------------------------------------------------------------------------------------------*/
int InputManager::onClickContext(sf::Event mouseEvent, sf::FloatRect menuContext, sf::FloatRect buildContext, sf::FloatRect playContext)
{
	int x = mouseEvent.mouseButton.x;
	int y = mouseEvent.mouseButton.y;

	std::cout << "x :" << x << " y: " << y << std::endl;
	if(menuContext.contains(x, y))
	{
		//call menu function
		std::cout << "Context changed to menu" << std::endl;
		setCurrentContext(MENU_CONTEXT);
		return MENU_CONTEXT;
	}
	else if(buildContext.contains(x, y))
	{
		//call builder function
		std::cout << "Context changed to builder" << std::endl;
		setCurrentContext(BUILDER_CONTEXT);
		return BUILDER_CONTEXT;
	}	
	else if(playContext.contains(x, y))
	{
		//call player function
		std::cout << "Context changed to player" << std::endl;
		setCurrentContext(PLAYER_CONTEXT);
		return PLAYER_CONTEXT;
	}
	return getCurrentContext();
}
Пример #8
0
GLW_APICALL void GLW_APIENTRY glBindBuffer (GLenum target, GLuint buffer)
{
	Context* const ctx = getCurrentContext();

	if (target == GL_PIXEL_PACK_BUFFER)
		ctx->pixelPackBufferBufferBinding = buffer;
}
Пример #9
0
        void runTest( const TestCaseInfo& testInfo ) {
            Totals prevTotals = m_totals;

            std::string redirectedCout;
            std::string redirectedCerr;
            
            m_reporter->StartTestCase( testInfo );
            
            m_runningTest = new RunningTest( &testInfo );

            do {
                do {
//                    m_reporter->StartGroup( "test case run" );
                    m_currentResult.setLineInfo( m_runningTest->getTestCaseInfo().getLineInfo() );
                    runCurrentTest( redirectedCout, redirectedCerr );
//                    m_reporter->EndGroup( "test case run", m_totals.delta( prevTotals ) );
                }
                while( m_runningTest->hasUntestedSections() && !aborting() );
            }
            while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );

            delete m_runningTest;
            m_runningTest = NULL;

            Totals deltaTotals = m_totals.delta( prevTotals );
            m_totals.testCases += deltaTotals.testCases;            
            m_reporter->EndTestCase( testInfo, deltaTotals, redirectedCout, redirectedCerr );
        }
Пример #10
0
        Totals runTest( TestCase const& testCase ) {
            Totals prevTotals = m_totals;

            std::string redirectedCout;
            std::string redirectedCerr;

            TestCaseInfo testInfo = testCase.getTestCaseInfo();

            m_reporter->testCaseStarting( testInfo );

            m_activeTestCase = &testCase;
            m_testCaseTracker = TestCaseTracker( testInfo.name );

            do {
                do {
                    runCurrentTest( redirectedCout, redirectedCerr );
                }
                while( !m_testCaseTracker->isCompleted() && !aborting() );
            }
            while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );

            Totals deltaTotals = m_totals.delta( prevTotals );
            m_totals.testCases += deltaTotals.testCases;
            m_reporter->testCaseEnded( TestCaseStats(   testInfo,
                                                        deltaTotals,
                                                        redirectedCout,
                                                        redirectedCerr,
                                                        aborting() ) );

            m_activeTestCase = NULL;
            m_testCaseTracker.reset();

            return deltaTotals;
        }
Пример #11
0
Context::~Context()
{
    //assert(this != getCurrentContext());
    if (this != getCurrentContext()) {
        delete wsContext;
    }
}
Пример #12
0
 Section::Section(   SourceLineInfo const& lineInfo,
                     std::string const& name,
                     std::string const& description )
 :   m_info( name, description, lineInfo ),
     m_sectionIncluded( getCurrentContext().getResultCapture().sectionStarted( m_info, m_assertions ) )
 {
     m_timer.start();
 }
Пример #13
0
GLW_APICALL void GLW_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers)
{
	Context* const ctx = getCurrentContext();

	for (GLsizei ndx = 0; ndx < n; ++ndx)
		if (buffers[ndx] && buffers[ndx] == ctx->pixelPackBufferBufferBinding)
			ctx->pixelPackBufferBufferBinding = 0;
}
Пример #14
0
void ArrangerPage::Splitter::onMouseMove(const D2D1_POINT_2F& pt)
{
	this->lastOffset = pt;
	if (getCurrentContext().isHoldingLayer(this))
	{
		this->pParentObject->moveSplitter(pt);
	}
	this->Layer::onMouseMove(pt);
}
Пример #15
0
void xsLauncher::onSuspend(void)
{
	xsAppContext *context = getCurrentContext();
	if (context == NULL)
		return;

	_xsBackgound = XS_TRUE;
	context->suspend();
}
Пример #16
0
void RenderContext::drawStringCenter(const std::wstring& str, const D2D1_RECT_F& rect, IDWriteTextFormat* pFormat, ID2D1Brush* pBrush)
{
	auto rw = rect.right - rect.left, rh = rect.bottom - rect.top;

	auto pSize = getCurrentContext().getRenderDevice()->calcStringSize(str, pFormat);
	auto pt = D2D1::Point2F(rect.left + (rw - pSize.width) / 2.0f, rect.top + (rh - pSize.height) / 2.0f);
	this->pInternalContext->DrawTextW(str.c_str(), static_cast<UINT>(str.length()), pFormat,
		D2D1::RectF(pt.x, pt.y, pt.x + pSize.width, pt.y + pSize.height), pBrush);
}
Пример #17
0
    ResultBuilder::~ResultBuilder() {
#if defined(CATCH_CONFIG_FAST_COMPILE)
        if ( m_guardException ) {
            m_stream().oss << "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
            captureResult( ResultWas::ThrewException );
            getCurrentContext().getResultCapture()->exceptionEarlyReported();
        }
#endif
    }
Пример #18
0
/**
 * Grow the current drawble.
 *
 * We need to infer the drawable size from GL calls because the drawable sizes
 * are specified by OS specific calls which we do not trace.
 */
void
updateDrawable(int width, int height) {
    Context *currentContext = getCurrentContext();
    if (!currentContext) {
        return;
    }

    glws::Drawable *currentDrawable = currentContext->drawable;
    if (!currentDrawable) {
        return;
    }

    if (currentDrawable->pbuffer) {
        return;
    }

    if (currentDrawable->visible &&
        width  <= currentDrawable->width &&
        height <= currentDrawable->height) {
        return;
    }

    // Ignore zero area viewports
    if (width == 0 || height == 0) {
        return;
    }

    width  = std::max(width,  currentDrawable->width);
    height = std::max(height, currentDrawable->height);

    // Check for bound framebuffer last, as this may have a performance impact.
    if (currentContext->features().framebuffer_object) {
        GLint framebuffer = 0;
        glGetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer);
        if (framebuffer != 0) {
            return;
        }
    }

    currentDrawable->resize(width, height);
    currentDrawable->show();

    // Ensure the drawable dimensions, as perceived by glstate match.
    if (retrace::debug) {
        GLint newWidth = 0;
        GLint newHeight = 0;
        if (glstate::getDrawableBounds(&newWidth, &newHeight) &&
            (newWidth != width || newHeight != height)) {
            std::cerr
                << "error: drawable failed to resize: "
                << "expected " << width << "x" << height << ", "
                << "got " << newWidth << "x" << newHeight << "\n";
        }
    }

    glScissor(0, 0, width, height);
}
Пример #19
0
int xsLauncher::onResume(void)
{
	xsAppContext *context = getCurrentContext();
	if (context == NULL)
		return XS_EC_ERROR;

	_xsBackgound = XS_FALSE;
	return context->resume();
}
Пример #20
0
Layer::Layer(const D2D1_SIZE_F& size)
{
	ComResult hr;

	this->internalVisualOffset = D2D1::Point2F(0.0f, 0.0f);

	hr = getCurrentContext().getLayerManager()->getDevice()->CreateVisual(&this->pVisual);
	this->resize(size);
}
Пример #21
0
GLW_APICALL void GLW_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers)
{
	Context* const ctx = getCurrentContext();

	if (framebuffers)
	{
		for (int ndx = 0; ndx < n; ndx++)
			framebuffers[ndx] = ctx->framebuffers.allocate();
	}
}
Пример #22
0
HRESULT CDropTarget::Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
{
	HRESULT hr;
	FORMATETC format = {};
	STGMEDIUM medium = {};

	format.cfFormat = CF_HDROP;
	format.ptd = nullptr;
	format.dwAspect = DVASPECT_CONTENT;
	format.lindex = -1;
	format.tymed = TYMED_HGLOBAL;
	hr = pDataObj->QueryGetData(&format);
	if (FAILED(hr))
	{
		OutputDebugString(L"Format Error.\n");
		return hr;
	}
	hr = pDataObj->GetData(&format, &medium);
	if (FAILED(hr))
	{
		OutputDebugString(L"GetData Error.\n");
		return hr;
	}

	auto hDrop = static_cast<HDROP>(GlobalLock(medium.hGlobal));
	auto nDrops = DragQueryFile(hDrop, 0xffffffff, nullptr, 0);
	for (uint32_t i = 0; i < nDrops; i++)
	{
		auto fnSize = DragQueryFile(hDrop, i, nullptr, 0);
		std::unique_ptr<wchar_t[]> pFileName(new wchar_t[fnSize + 1]);
		DragQueryFile(hDrop, i, pFileName.get(), fnSize + 1);

		//getCurrentContext().getProjectManager()->getCurrent()->loadSound(pFileName.get());
		getCurrentContext().getSoundLoaderThread()->sendToLoad(pFileName.get());
	}

	GlobalUnlock(medium.hGlobal);
	ReleaseStgMedium(&medium);

	OutputDebugString(L"Drop\n");
	getCurrentContext().getDragScreenOverlay()->falloffEffect();
	return S_OK;
}
Пример #23
0
GLW_APICALL void GLW_APIENTRY glGenVertexArrays (GLsizei n, GLuint* arrays)
{
	Context* const ctx = getCurrentContext();

	if (arrays)
	{
		for (int ndx = 0; ndx < n; ndx++)
			arrays[ndx] = ctx->vertexArrays.allocate();
	}
}
Пример #24
0
MetricBackend* getBackend(std::string backendName) {
    // allocator for metric storage
    MmapAllocator<char> alloc;
    // to be populated with backends
    Context *currentContext = getCurrentContext();
    if (backendName == "GL_AMD_performance_monitor") return &MetricBackend_AMD_perfmon::getInstance(currentContext, alloc);
    else if (backendName == "GL_INTEL_performance_query") return &MetricBackend_INTEL_perfquery::getInstance(currentContext, alloc);
    else if (backendName == "opengl") return &MetricBackend_opengl::getInstance(currentContext, alloc);
    else return nullptr;
}
Пример #25
0
GLW_APICALL void GLW_APIENTRY glGenSamplers (GLsizei count, GLuint* samplers)
{
	Context* const ctx = getCurrentContext();

	if (samplers)
	{
		for (int ndx = 0; ndx < count; ndx++)
			samplers[ndx] = ctx->samplers.allocate();
	}
}
Пример #26
0
GLW_APICALL void GLW_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers)
{
	Context* const ctx = getCurrentContext();

	if (renderbuffers)
	{
		for (int ndx = 0; ndx < n; ndx++)
			renderbuffers[ndx] = ctx->renderbuffers.allocate();
	}
}
Пример #27
0
GLW_APICALL void GLW_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint* ids)
{
	Context* const ctx = getCurrentContext();

	if (ids)
	{
		for (int ndx = 0; ndx < n; ndx++)
			ids[ndx] = ctx->transformFeedbacks.allocate();
	}
}
Пример #28
0
GLW_APICALL void GLW_APIENTRY glGenProgramPipelines (GLsizei n, GLuint* pipelines)
{
	Context* const ctx = getCurrentContext();

	if (pipelines)
	{
		for (int ndx = 0; ndx < n; ndx++)
			pipelines[ndx] = ctx->programPipelines.allocate();
	}
}
Пример #29
0
GLW_APICALL void GLW_APIENTRY glGenTextures (GLsizei n, GLuint* textures)
{
	Context* const ctx = getCurrentContext();

	if (textures)
	{
		for (int ndx = 0; ndx < n; ndx++)
			textures[ndx] = ctx->textures.allocate();
	}
}
Пример #30
0
GLW_APICALL void GLW_APIENTRY glGenQueries (GLsizei n, GLuint* ids)
{
	Context* const ctx = getCurrentContext();

	if (ids)
	{
		for (int ndx = 0; ndx < n; ndx++)
			ids[ndx] = ctx->queries.allocate();
	}
}