Ejemplo n.º 1
0
void Painter::clearRect(const Color& color, const Rect& rect)
{
    Rect oldClipRect = m_clipRect;
    setClipRect(rect);
    glClearColor(color.rF(), color.gF(), color.bF(), color.aF());
    glClear(GL_COLOR_BUFFER_BIT);
    setClipRect(oldClipRect);
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
void D2DDrawContext::clearRect (const CRect& rect)
{
    if (renderTarget)
    {
        CRect oldClip = currentState.clipRect;
        setClipRect (rect);
        D2DApplyClip ac (this);
        renderTarget->Clear (D2D1::ColorF (1.f, 1.f, 1.f, 0.f));
        setClipRect (oldClip);
    }
}
Ejemplo n.º 3
0
void wyScrollableLayer::setContentSize(float w, float h) {
	wyColorLayer::setContentSize(w, h);
	setClipRect(wyr(0, 0, w, h), true);
	updateExtent();
	updateThumbSize();
	updateOffset();
}
Ejemplo n.º 4
0
void View2D::paintGL()
{
    setClipRect(0, 0, width(), height());

    glClearColor(0, 0, 0, 0);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    glTranslatef(-scrollX, -scrollY, 0); // scroll is in physical pixels.
    glScalef(scale, scale, 1);

    DoomMap* cmap = MainWindow::get()->getMap();
    if (!cmap)
        return;

    //
    if (linesUpdate)
    {
        linesUpdate = false;
        linesArray.update();
    }

    linesArray.draw(GL_LINES);

    // draw sectors HUEHUEHUEHUEHUE
    for (int i = 0; i < cmap->sectors.size(); i++)
    {
        DoomMapSector& sec = cmap->sectors[i];
        sec.triangles.draw(GL_TRIANGLES);
    }
}
Ejemplo n.º 5
0
 void setRenderState(const RenderState& rs)
 {
     setTexture(rs.texture);
     setTransform(rs.transform);
     setClipRect(rs.clipRect);
     setAlphaMode(rs.mode);
 }
Ejemplo n.º 6
0
void AsScene1307Key::stInsertKey() {
	_pointIndex = 0;
	sendMessage(_parentScene, 0x1022, kAsScene1307KeySurfacePriorities[getSubVar(VA_CURR_KEY_SLOT_NUMBERS, _keyIndex) % 4]);
	setClipRect(_clipRects[getSubVar(VA_CURR_KEY_SLOT_NUMBERS, _keyIndex) % 4]);
	_newStickFrameIndex = STICK_LAST_FRAME;
	SetSpriteUpdate(&AsScene1307Key::suInsertKey);
}
Ejemplo n.º 7
0
void View2D::initializeGL()
{
    setClipRect(0, 0, width(), height());
    glLineWidth(1);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
Ejemplo n.º 8
0
void Sprite::setCurrentFrame(u16 currentFrame) {
	u16 frameX = (currentFrame % (Image::width() / m_frameWidth)) * m_frameWidth;
	u16 frameY = (currentFrame / (Image::width() / m_frameWidth)) * m_frameHeight;

	setClipRect(frameX, frameY, m_frameWidth, m_frameHeight);

	m_currentFrame = currentFrame;
}
Ejemplo n.º 9
0
Image::Image(const char *textureName)
	: m_textureName(textureName),
	  m_texture(ResourceHandler::getInstance().get<sf::Texture>(textureName))
{
	m_vertices.setPrimitiveType(sf::Triangles);
	
	setTileCount(1);
	setClipRect(0, 0, width(), height());
	setPosRect(0, 0, width(), height());
}
Ejemplo n.º 10
0
 ~RenderStateManager()
 {
     ClipRect noClipping;
     noClipping.width = NO_CLIPPING;
     setClipRect(noClipping);
     setTexture(std::tr1::shared_ptr<Texture>());
     // Return to previous MV matrix
     glMatrixMode(GL_MODELVIEW);
     glPopMatrix();
 }
Ejemplo n.º 11
0
//-----------------------------------------------------------------------------
void CDrawContext::init ()
{
	// set the default values
	setFrameColor (kWhiteCColor);
	setLineStyle (kLineSolid);
	setLineWidth (1);
	setFillColor (kBlackCColor);
	setFontColor (kWhiteCColor);
	setFont (kSystemFont);
	setDrawMode (kAliasing);
	setClipRect (surfaceRect);
}
Ejemplo n.º 12
0
AsScene2609Water::AsScene2609Water(NeverhoodEngine *vm)
	: AnimatedSprite(vm, 1000) {
	
	_x = 240;
	_y = 420;
	setDoDeltaX(1);
	createSurface1(0x9C210C90, 1200);
	setClipRect(260, 260, 400, 368);
	_vm->_soundMan->addSound(0x08526C36, 0xDC2769B0);
	SetUpdateHandler(&AnimatedSprite::update);
	SetMessageHandler(&AsScene2609Water::handleMessage);
	if (getGlobalVar(V_WATER_RUNNING))
		sendMessage(this, 0x2002, 0);
}
Ejemplo n.º 13
0
void Painter::restoreSavedState()
{
    m_oldStateIndex--;
    setResolution(m_olderStates[m_oldStateIndex].resolution);
    setProjectionMatrix(m_olderStates[m_oldStateIndex].projectionMatrix);
    setTextureMatrix(m_olderStates[m_oldStateIndex].textureMatrix);
    setColor(m_olderStates[m_oldStateIndex].color);
    setOpacity(m_olderStates[m_oldStateIndex].opacity);
    setCompositionMode(m_olderStates[m_oldStateIndex].compositionMode);
    setClipRect(m_olderStates[m_oldStateIndex].clipRect);
    setShaderProgram(m_olderStates[m_oldStateIndex].shaderProgram);
    setTexture(m_olderStates[m_oldStateIndex].texture);
    setAlphaWriting(m_olderStates[m_oldStateIndex].alphaWriting);
}
Ejemplo n.º 14
0
//-----------------------------------------------------------------------------
void CDrawContext::drawString (UTF8StringPtr _string, const CRect& _rect, const CHoriTxtAlign hAlign, bool antialias)
{
	if (!_string || currentState.font == 0)
		return;
	IFontPainter* painter = currentState.font->getFontPainter ();
	if (painter == 0)
		return;
	
	const CString& string = getDrawString (_string);
	CRect rect (_rect);

	double capHeight = -1;
	IPlatformFont* platformFont = currentState.font->getPlatformFont ();
	if (platformFont)
		capHeight = platformFont->getCapHeight ();
	
	if (capHeight > 0.)
		rect.bottom -= (rect.height ()/2 - capHeight / 2);
	else
		rect.bottom -= (rect.height ()/2 - currentState.font->getSize () / 2) + 1;
	if (hAlign != kLeftText)
	{
		CCoord stringWidth = painter->getStringWidth (this, string, antialias);
		if (hAlign == kRightText)
			rect.left = rect.right - stringWidth;
		else
			rect.left = (CCoord)(rect.left + (rect.getWidth () / 2.f) - (stringWidth / 2.f));
	}
	CRect oldClip;
	getClipRect (oldClip);
	CRect newClip (_rect);
	newClip.bound (oldClip);
	setClipRect (newClip);
	painter->drawString (this, string, CPoint (rect.left, rect.bottom), antialias);
	setClipRect (oldClip);
	clearDrawString ();
}
Ejemplo n.º 15
0
void XWidget::paint()
{
	setClipRect(widget_rect);
	//重绘制父组件
	if(lucency && parent)
	{
		parent->drawParent(widget_rectF,this);
	}
	
	draw();
		
	//子组件
	if(layout)	
		layout->drawChild(widget_rectF,this);
	
	showWidget();	
	cleanClipRect();
}
Ejemplo n.º 16
0
void AsScene1307Key::stMoveKey() {
	NPoint pt = (*_pointList)[getSubVar(VA_CURR_KEY_SLOT_NUMBERS, _keyIndex)];
	int16 newX = pt.x + kAsScene1307KeyXDelta;
	int16 newY = pt.y + kAsScene1307KeyYDelta;
	sendMessage(_parentScene, 0x1022, 1000);
	setClipRect(0, 0, 640, 480);
	_prevX = _x;
	_prevY = _y;
	if (newX == _x && newY == _y) {
		stInsertKey();
	} else {
		const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex];
		_pointIndex = 0;
		_frameIndex = 0;
		_deltaX = newX - _x;
		_deltaY = newY - _y;
		startAnimation(fileHashes[0], 0, -1);
		SetSpriteUpdate(&AsScene1307Key::suMoveKey);
	}
}
void QQuickDefaultClipNode::updateGeometry()
{
    QSGGeometry *g = geometry();

    if (qFuzzyIsNull(m_radius)) {
        g->allocate(4);
        QSGGeometry::updateRectGeometry(g, m_rect);

    } else {
        int vertexCount = 0;

        // Radius should never exceeds half of the width or half of the height
        qreal radius = qMin(qMin(m_rect.width() / 2, m_rect.height() / 2), m_radius);
        QRectF rect = m_rect;
        rect.adjust(radius, radius, -radius, -radius);

        int segments = qMin(30, qCeil(radius)); // Number of segments per corner.

        g->allocate((segments + 1) * 2);

        QVector2D *vertices = (QVector2D *)g->vertexData();

        for (int part = 0; part < 2; ++part) {
            for (int i = 0; i <= segments; ++i) {
                //### Should change to calculate sin/cos only once.
                qreal angle = qreal(0.5 * M_PI) * (part + i / qreal(segments));
                qreal s = qFastSin(angle);
                qreal c = qFastCos(angle);
                qreal y = (part ? rect.bottom() : rect.top()) - radius * c; // current inner y-coordinate.
                qreal lx = rect.left() - radius * s; // current inner left x-coordinate.
                qreal rx = rect.right() + radius * s; // current inner right x-coordinate.

                vertices[vertexCount++] = QVector2D(rx, y);
                vertices[vertexCount++] = QVector2D(lx, y);
            }
        }

    }
    markDirty(DirtyGeometry);
    setClipRect(m_rect);
}
Ejemplo n.º 18
0
void Sprite::setClipRect(NDrawRect& drawRect) {
	setClipRect(drawRect.x, drawRect.y, drawRect.x2(), drawRect.y2());
}
Ejemplo n.º 19
0
void Surface::setClipRect(int x, int y, int w, int h) {
	SDL_Rect rect = {x,y,w,h};
	setClipRect(rect);
}
Ejemplo n.º 20
0
void QNanoPainter::setClipRect(const QRectF &rect)
{
    setClipRect(rect.x(), rect.y(), rect.width(), rect.height());
}