示例#1
0
文件: Widget.cpp 项目: comforx/MoSync
	void Widget::draw(bool forceDraw) {
		if(!mEnabled && !forceDraw)
			return;
	
		//Engine &engine = Engine::getSingleton();

		//bool res = engine.pushClipRectIntersect(mBounds.x, mBounds.y,
		//	mBounds.width, mBounds.height);
		
		Gfx_pushMatrix();
		Gfx_translate(mRelX, mRelY);
		BOOL res = Gfx_intersectClipRect(0, 0, mBounds.width, mBounds.height);

		if(res) 
		{
			if(isDirty() || forceDraw) 
			{
				drawBackground();
			}
			//MAUI_LOG("Widget::draw, paddingLeft= %d, paddingTop = %d", mPaddingLeft, mPaddingTop);
			Gfx_translate(mPaddingLeft, mPaddingTop);
			BOOL res = Gfx_intersectClipRect(0, 0, mPaddedBounds.width, mPaddedBounds.height);

#if 0	// debug drawings
			if(mFocused) {
				maSetColor(0x00ff00);
				Gfx_line(0, 0, mBounds.width-1, 0);
				Gfx_line(mPaddedBounds.width-1, 0, mPaddedBounds.width-1, mPaddedBounds.height-1);
				Gfx_line(0, mPaddedBounds.height-1, mPaddedBounds.width-1, mPaddedBounds.height-1);
				Gfx_line(0, 0, 0, mPaddedBounds.height-1);
			}
#endif

			Gfx_translate(getTranslationX(), getTranslationY());

			if(res) {
				if(isDirty() || forceDraw) {
					drawWidget();
				}

				Vector_each(Widget*, it, mChildren)
					(*it)->draw();

			}
			// This commented out to match removal of above intersectClipRect() call.
			Gfx_popClipRect();
			setDirty(false);
		}
		Gfx_popMatrix();
		//engine.popClipRect();
		Gfx_popClipRect();
	}
示例#2
0
	void Engine::repaint() {
		//lprintfln("repaint @ (%i ms)", maGetMilliSecondCount());
		if(!main) return;
		//printf("doing repaint!");
		
		Gfx_beginRendering();
		
		//clearClipRect();
		Gfx_clearClipRect();
		Gfx_clearMatrix();

		
		int scrW = EXTENT_X(maGetScrSize());
		int scrH = EXTENT_Y(maGetScrSize());
		//printf("screenSize: (%d, %d)\n", scrW, scrH);
		Gfx_pushClipRect(0, 0, scrW, scrH);
		main->update();
		main->draw();
		Gfx_popClipRect();

		if(overlay) {
			Gfx_clearClipRect();
			Gfx_clearMatrix();
			Gfx_pushClipRect(0, 0, scrW, scrH);

			overlay->requestRepaint();
			Gfx_translate(overlayPosition.x, overlayPosition.y);
			overlay->update();
			overlay->draw();
		}

		//maUpdateScreen();
		Gfx_updateScreen();
	}
示例#3
0
void ArrowLayer::drawLayer(MAP::MapWidget* map)
{
	Gfx_pushMatrix();

	Gfx_translate(map->getWidth()/2 - animation->getWidth()/2, map->getHeight()/2 - animation->getHeight()/2);

	animation->setEnabled(true);
	animation->draw(true);
	animation->setEnabled(false);

	Gfx_popMatrix();
}