当前位置: 首页>>代码示例>>C++>>正文


C++ GetContext函数代码示例

本文整理汇总了C++中GetContext函数的典型用法代码示例。如果您正苦于以下问题:C++ GetContext函数的具体用法?C++ GetContext怎么用?C++ GetContext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetContext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddHWBP

/// <summary>
/// Add hardware breakpoint to thread
/// </summary>
/// <param name="addr">Breakpoint address</param>
/// <param name="type">Breakpoint type(read/write/execute)</param>
/// <param name="length">Number of bytes to include into breakpoint</param>
/// <returns>Index of used breakpoint; -1 if failed</returns>
int Thread::AddHWBP( ptr_t addr, HWBPType type, HWBPLength length )
{
    _CONTEXT64 context;

    // CONTEXT_DEBUG_REGISTERS can be operated without thread suspension
    if (!GetContext( context, CONTEXT64_DEBUG_REGISTERS, true ))
        return -1;

    auto getFree = []( ptr_t regval )
    {
        if (!(regval & 1))
            return 0;
        else if (!(regval & 4))
            return 1;
        else if (!(regval & 16))
            return 2;
        else if (!(regval & 64))
            return 3;

        return -1;
    };

    // Get free DR
    int freeIdx = getFree( context.Dr7 );

    // If all 4 registers are occupied - error
    if (freeIdx < 0)
        return -1;

    // Enable corresponding HWBP and local BP flag
    context.Dr7 |= (1 << (2 * freeIdx)) | ((int)type << (16 + 4 * freeIdx)) | ((int)length << (18 + 4 * freeIdx)) | 0x100;

    *(&context.Dr0 + freeIdx) = addr;

    // Write values to registers
    if (!SetContext( context, true ))
        return -1;

    return freeIdx;
}
开发者ID:Jeswang,项目名称:mono-assembly-injector,代码行数:47,代码来源:Thread.cpp

示例2: PresContext

already_AddRefed<nsStyleContext>
nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
{
  nsStyleContext* result = nsnull;
  nsPresContext *presContext = PresContext();

  if (presContext) {
    if (mRuleProcessors[eAgentSheet]        ||
        mRuleProcessors[ePresHintSheet]     ||
        mRuleProcessors[eUserSheet]         ||
        mRuleProcessors[eHTMLPresHintSheet] ||
        mRuleProcessors[eDocSheet]          ||
        mRuleProcessors[eStyleAttrSheet]    ||
        mRuleProcessors[eOverrideSheet]) {
      result = GetContext(presContext, aParentContext,
                          nsCSSAnonBoxes::mozNonElement).get();
      NS_ASSERTION(mRuleWalker->AtRoot(), "rule walker must be at root");
    }
  }

  return result;
}
开发者ID:ahadzi,项目名称:celtx,代码行数:22,代码来源:nsStyleSet.cpp

示例3: GetContext

void CRenderingContext::UseProgram(class CShader* pShader)
{
	CRenderContext& oContext = GetContext();

	oContext.m_pShader = m_pShader = pShader;

	if (!m_pShader)
	{
		oContext.m_szProgram[0] = '\0';
		m_iProgram = 0;
		glUseProgram(0);
		return;
	}

	tstrncpy(oContext.m_szProgram, PROGRAM_LEN, pShader->m_sName.c_str(), PROGRAM_LEN);

	m_iProgram = m_pShader->m_iProgram;
	glUseProgram((GLuint)m_pShader->m_iProgram);

	oContext.m_bProjectionUpdated = false;
	oContext.m_bViewUpdated = false;
}
开发者ID:BSVino,项目名称:CodenameInfinite,代码行数:22,代码来源:renderingcontext.cpp

示例4: mbstowcs

// --------------------------------------------------------------
void	
GFontWin32GDIPlus::GetExtent( unsigned char c, float * outWidth, 
					          float * outHeight, VGDevice * context ) const
{
	WCHAR wstr [] = L"0";
	mbstowcs(wstr, (const char*)&c, 1);

	Graphics* gdiContext = (Graphics*) GetContext( context );

/*	-- known Gdi+ issue: 
	We must use the following way to determine correct font extent 
	because typical Graphics::MeasureString() method doesn't work
	properly (return values are incorrect due to antialiasing)
*/
	Font* dgiFont = GetNativeFont();

	// Layout rectangles used for drawing strings
	RectF   layoutRect_A(0.0f, 0.0f, 1300.0f, 1300.0f);
	// 1 range of character positions within the string
	CharacterRange charRange(0, 1);
	// String format used to apply to string when drawing
	StringFormat strFormat;
	// Set three ranges of character positions.
	strFormat.SetMeasurableCharacterRanges(1, &charRange);
	Region *pCharRangeRegions = new Region();

	// Get the regions that correspond to the ranges within the string when
	// layout rectangle A is used. 
	gdiContext->MeasureCharacterRanges( wstr, 1, dgiFont, layoutRect_A, &strFormat, 1, pCharRangeRegions);

	RectF boundRect;
	pCharRangeRegions->GetBounds( &boundRect, gdiContext);

	*outHeight = boundRect.Height;
	*outWidth = boundRect.Width;
	// in some cases (when some symbols must be forced into char map), extent needs to be fixed  
	if (c == 139) *outWidth = 6.0;

}
开发者ID:anttirt,项目名称:guidolib,代码行数:40,代码来源:GFontWin32GDIPlus.cpp

示例5: GetActiveOffset

void Image::Draw()
{
	const Point &offset = GetActiveOffset();
	const Point &area = GetActiveArea();

	const float x = offset.x;
	const float y = offset.y;
	const float sx = area.x;
	const float sy = area.y;

	const vector2f texSize = m_texture->GetDescriptor().texSize;

	Graphics::VertexArray va(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_UV0);
	va.Add(vector3f(x,    y,    0.0f), vector2f(0.0f,      0.0f));
	va.Add(vector3f(x,    y+sy, 0.0f), vector2f(0.0f,      texSize.y));
	va.Add(vector3f(x+sx, y,    0.0f), vector2f(texSize.x, 0.0f));
	va.Add(vector3f(x+sx, y+sy, 0.0f), vector2f(texSize.x, texSize.y));

	Graphics::Renderer *r = GetContext()->GetRenderer();
	r->SetBlendMode(Graphics::BLEND_ALPHA);
	r->DrawTriangles(&va, m_material.Get(), Graphics::TRIANGLE_STRIP);
}
开发者ID:GizmoR13,项目名称:pioneer,代码行数:22,代码来源:Image.cpp

示例6: GetClientSize

void tui::LayoutCanvas::OnresizeGL(wxSizeEvent& event) {
    // this is also necessary to update the context on some platforms
    wxGLCanvas::OnSize(event);
    // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
    int w, h;
    GetClientSize(&w, &h);
   #ifndef __WXMOTIF__
      if (GetContext())
   #endif
    {
      SetCurrent();
      glViewport( 0, 0, (GLint)w, (GLint)h );
    }
    lp_BL = TP(0,0)  * _LayCTM;
    lp_TR = TP(w, h) * _LayCTM;
//   glMatrixMode( GL_PROJECTION );
//   glLoadIdentity();
//   glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
   glMatrixMode( GL_MODELVIEW );
   glClear(GL_ACCUM_BUFFER_BIT);
   invalid_window = true;
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:22,代码来源:layoutcanvas.cpp

示例7: eglDestroyContext

// Destroy the specified rendering context.
EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
  EGL_API_ENTRY("%p, %p", dpy, ctx);
  EglDisplayImpl* display = EglDisplayImpl::GetDisplay(dpy);
  if (display == NULL || display->IsInitialized() == false) {
    SetError(EGL_BAD_DISPLAY);
    return EGL_FALSE;
  }

  ContextPtr context = display->GetContexts().Get(ctx);
  if (context == NULL) {
    return EGL_BAD_CONTEXT;
  }

  if (GetContext() == context) {
    display->MakeCurrent(EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
  }

  context->Release();

  display->GetContexts().Unregister(ctx);
  return EGL_TRUE;
}
开发者ID:epowers,项目名称:arc,代码行数:23,代码来源:api_entries.cpp

示例8: GetActiveOffset

void Gradient::Draw()
{
	const Point &offset = GetActiveOffset();
	const Point &area = GetActiveArea();

	const float x = offset.x;
	const float y = offset.y;
	const float sx = area.x;
	const float sy = area.y;

	Graphics::VertexArray va(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_DIFFUSE);
	va.Add(vector3f(x,    y,    0.0f), m_beginColor);
	va.Add(vector3f(x,    y+sy, 0.0f), m_direction == HORIZONTAL ? m_beginColor : m_endColor);
	va.Add(vector3f(x+sx, y,    0.0f), m_direction == HORIZONTAL ? m_endColor : m_beginColor);
	va.Add(vector3f(x+sx, y+sy, 0.0f), m_endColor);

	Graphics::Renderer *r = GetContext()->GetRenderer();
	r->SetBlendMode(Graphics::BLEND_ALPHA);
	r->DrawTriangles(&va, m_material.Get(), Graphics::TRIANGLE_STRIP);

	Container::Draw();
}
开发者ID:HeadHunterEG,项目名称:pioneer,代码行数:22,代码来源:Gradient.cpp

示例9:

    Sink& BufferSink::MapEntry(Term& key, Term& value)
    {
        Term& t = *(terms.back());
        Term& newmap = t.MapPutValue(GetContext(), key, value);
        if (&newmap != &t)
        {
        	terms.pop_back();
        	if (terms.empty())
        		term = &newmap;
        	else
        	{
        		subIndex.pop_back();
        		int subindex = subIndex.back();
        		Term& parent = *(terms.back());
        		parent.SetSub(subindex - 1, newmap);
        		subIndex.push_back(0);
        	}

        	terms.push_back(&newmap);
        }
        return *this;
    }
开发者ID:tosca-lang,项目名称:tosca,代码行数:22,代码来源:buffer.cpp

示例10: glGetIntegerv

void
DisplayWindow::SetupView(int picking, int x, int y)
{
	GLint viewport[4];
	glGetIntegerv(GL_VIEWPORT, viewport);

	int w,h;
    GetClientSize(&w, &h);

	if (!GetContext()) return;
	SetCurrent();
	float aspect = (float)w/h;
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	if (picking) gluPickMatrix(x,viewport[3] - y,5.0,5.0,viewport);
	glFrustum(-0.5, 0.5, -0.5/aspect, 0.5/aspect, 0.5, 10.0 );
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslatef( 0.0, 0.0, zoom);
	glRotatef(yrot,0.0,1.0,0.0);
	glRotatef(xrot,1.0,0.0,0.0);
}
开发者ID:Seashell2011,项目名称:Wickbert,代码行数:22,代码来源:DisplayWindow.cpp

示例11: Sample2D

void Urho2DPlatformer::Start()
{
    // Execute base class startup
    Sample::Start();

    sample2D_ = new Sample2D(context_);

    // Set filename for load/save functions
    sample2D_->demoFilename_ = "Platformer2D";

    // Create the scene content
    CreateScene();

    // Create the UI content
    sample2D_->CreateUIContent("PLATFORMER 2D DEMO", character2D_->remainingLifes_, character2D_->remainingCoins_);
    auto* ui = GetContext()->m_UISystem.get();
    Button* playButton = static_cast<Button*>(ui->GetRoot()->GetChild("PlayButton", true));
    playButton->released.Connect(this,&Urho2DPlatformer::HandlePlayButton);

    // Hook up to the frame update events
    SubscribeToEvents();
}
开发者ID:nemerle,项目名称:lutefisk3d,代码行数:22,代码来源:Urho2DPlatformer.cpp

示例12: Quartz_Polygon

static void 	Quartz_Polygon(int n, double *x, double *y, 
			       R_GE_gcontext *gc,
			       NewDevDesc *dd)
{
   int	i;
   QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific;
   CGPoint *lines;


   CGContextSaveGState( GetContext(xd) );


   CGContextBeginPath( GetContext(xd) );
/*  Quartz_SetLineProperties(gc, dd); */


    lines = (CGPoint *)malloc(sizeof(CGPoint)*(n+1));

    if(lines == NULL)
     return;

    for (i = 0; i < n; i++) {
	  lines[i].x = (float)x[i];
	  lines[i].y = (float)y[i];
    }
    lines[n].x = (float)x[0];
    lines[n].y = (float)y[0];

    CGContextAddLines( GetContext(xd), &lines[0], n+1 );
     Quartz_SetLineProperties(gc, dd);

	Quartz_SetFill( gc->fill, gc->gamma, dd);
    CGContextFillPath( GetContext(xd) );

    CGContextAddLines( GetContext(xd), &lines[0], n+1 );
    Quartz_SetStroke( gc->col, gc->gamma,  dd);
    CGContextStrokePath( GetContext(xd) );

    CGContextRestoreGState( GetContext(xd) );

}
开发者ID:Vladimir84,项目名称:rcc,代码行数:41,代码来源:devQuartz.c

示例13: GetContext

void Slider::HandleMouseMove(const MouseMotionEvent &event)
{
	const Skin &skin = GetContext()->GetSkin();

	if (m_buttonDown && IsMouseActive()) {

		float travel;

		if (m_orient == SLIDER_HORIZONTAL) {
			const Skin::EdgedRectElement &gutterRect = skin.SliderHorizontalGutter();
			const Skin::RectElement &buttonRect = skin.SliderHorizontalButtonNormal();

			const int effectiveLength = GetActiveArea().x - gutterRect.edgeWidth*2 - buttonRect.size.x;
			const int pos = Clamp(event.pos.x - int(gutterRect.edgeWidth) - buttonRect.size.x/2 - GetActiveOffset().x, 0, effectiveLength);

			travel = float(pos) / effectiveLength;
		}

		else {
			const Skin::EdgedRectElement &gutterRect = skin.SliderVerticalGutter();
			const Skin::RectElement &buttonRect = skin.SliderVerticalButtonNormal();

			const int effectiveLength = GetActiveArea().y - gutterRect.edgeWidth*2 - buttonRect.size.y;
			const int pos = Clamp(event.pos.y - int(gutterRect.edgeWidth) - buttonRect.size.y/2 - GetActiveOffset().y, 0, effectiveLength);

			travel = float(pos) / effectiveLength;
		}

		SetValue(travel);
	}

	else {
		m_lastMousePosition = event.pos;
		m_mouseOverButton = PointInsideButton(event.pos);
	}

	Widget::HandleMouseMove(event);
}
开发者ID:HeadHunterEG,项目名称:pioneer,代码行数:38,代码来源:Slider.cpp

示例14: WXUNUSED

void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
    // must always be here
    wxPaintDC dc(this);

#ifndef __WXMOTIF__
    if (!GetContext()) return;
#endif

    SetCurrent();

    // Initialize OpenGL
    if (!m_gldata.initialized)
    {
        InitGL();
        ResetProjectionMode();
        m_gldata.initialized = true;
    }

    // Clear
    glClearColor( 0.3f, 0.4f, 0.6f, 1.0f );
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    // Transformations
    glLoadIdentity();
    glTranslatef( 0.0f, 0.0f, -20.0f );
    GLfloat m[4][4];
    build_rotmatrix( m, m_gldata.quat );
    glMultMatrixf( &m[0][0] );

    m_renderer.Render();

    // Flush
    glFlush();

    // Swap
    SwapBuffers();
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:38,代码来源:penguin.cpp

示例15: Encrypt

/*--------------------------------------------------------------------------------*/
void ABlowfish::Encrypt(const uint8_t *src, uint8_t *dst, uint32_t& iv1, uint32_t& iv2)
{
	BLOWFISH_CTX *ctx = (BLOWFISH_CTX *)GetContext();
	uint32_t l, r;

	// copy bytes into 2 32-bit variables
	memcpy(&l, src, sizeof(l)); src += sizeof(l);
	memcpy(&r, src, sizeof(r));

	// for little endian machines, swap bytes to make all data big-endian
	if (!MachineIsBigEndian()) {
		l = SwapBytes(l);
		r = SwapBytes(r);
	}

	// XOR in initialisation vectors (for CBC mode)
	l ^= iv1;
	r ^= iv2;

	// encrypt data
	Blowfish_Encrypt(ctx, &l, &r);

	// return new initialisation vectors (for CBC mode)
	iv1 = l;
	iv2 = r;

	// for little endian machines, swap bytes back to make all data little-endian
	if (!MachineIsBigEndian()) {
		l = SwapBytes(l);
		r = SwapBytes(r);
	}

	// copy bytes to destination
	memcpy(dst, &l, sizeof(l)); dst += sizeof(l);
	memcpy(dst, &r, sizeof(r));

	l = r = 0;	// clear local variables to prevent security leaks
}
开发者ID:richardxday,项目名称:rdlib,代码行数:39,代码来源:blowfish.cpp


注:本文中的GetContext函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。