/**
  @SYMTestCaseID UIF-TConeBackground-Test4L
 
  @SYMDEF PDEF112327
 
  @SYMTestCaseDesc Tests MCoeControlBackground, when a parent window owning control has one 
  child control not supporting background drawing and non window owning.\n
 
  @SYMTestPriority Critical
 
  @SYMTestStatus Implemented
  
  @SYMTestActions : Sets the background draw style.\n
  Instantiates a parent control (CConeBackgroundTestParent) which has capability of background drawing.\n
  After a new screen device has been instantiated,instantiates a second graphics context and assigns it to the child control.\n
  Thus a scenario of parent control and child control with different graphics context is created and tested.\n
  Activates the parent and child control\n
  Invokes the DrawNow function for the NonWindowOwningControl class which results in calling Draw() and DrawComponets() on the parent control itself.\n 
  
  @SYMTestType Manual
  @SYMTestExpectedResults : The background drawing should use the parent graphics context. \n
  All the test code does is to exercise the defect fix and thus the draw should complete without any error.\n
  */
void CConeBackgroundTestView::Test4L()
	{
	delete iControl;
	iControl = 0;
	
	iBgDrawer->SetBgStyle(1);
	iControl = CConeBackgroundTestParentWindowOwning::NewL(*this, Rect(),
				CConeBackgroundTestDrawer2::NewL());
	
	// create a new Gc
	CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice((iControl->ControlEnv())->WsSession()); 
	CleanupStack::PushL(screenDevice);
	User::LeaveIfError(screenDevice->Construct());
	
	CWindowGc* gc=new(ELeave) CWindowGc(screenDevice);
	CleanupStack::PushL(gc);
	User::LeaveIfError(gc->Construct());
	
	gc->Activate(Window());
	(iControl->ComponentControl(0))->SetCustomGc(gc);
	gc->Deactivate();
	
	TSize rectSize(90,200);
	iControl->SetSize(rectSize);
	(iControl->ComponentControl(0))->SetSize(rectSize);
	
	iControl->ActivateL();
	(iControl->ComponentControl(0))->ActivateL();
	(iControl->ComponentControl(0))->DrawNow(); 
	
	CleanupStack::PopAndDestroy(gc);
	CleanupStack::PopAndDestroy(screenDevice);
	}
Beispiel #2
0
void ZoomTool::scaleView(const QPointF &centerPos)
{

    QTransform transform;
    transform.scale(m_currentScale, m_currentScale);
    view()->setTransform(transform);

    QPointF adjustedCenterPos = centerPos;
    QSize rectSize(view()->rect().width() / m_currentScale,
                   view()->rect().height() / m_currentScale);

    QRectF sceneRect;
    if (qAbs(m_currentScale - 1.0f) < Constants::ZoomSnapDelta) {
        adjustedCenterPos.rx() = rectSize.width() / 2;
        adjustedCenterPos.ry() = rectSize.height() / 2;
    }

    if (m_currentScale < 1.0f) {
        adjustedCenterPos.rx() = rectSize.width() / 2;
        adjustedCenterPos.ry() = rectSize.height() / 2;
        sceneRect.setRect(view()->rect().width() / 2 -rectSize.width() / 2,
                          view()->rect().height() / 2 -rectSize.height() / 2,
                          rectSize.width(),
                          rectSize.height());
    } else {
        sceneRect.setRect(adjustedCenterPos.x() - rectSize.width() / 2,
                          adjustedCenterPos.y() - rectSize.height() / 2,
                          rectSize.width(),
                          rectSize.height());
    }

    view()->setSceneRect(sceneRect);
}
Beispiel #3
0
void statusToolButton::paintEvent(QPaintEvent* event)
{
    Q_UNUSED(event);
    QPainter painter(this);
    if(underMouse())
    {
        QStyleOptionToolButton panel;
        initStyleOption(&panel);
        style()->drawPrimitive(QStyle::PE_PanelButtonTool, &panel, &painter, this);
    }
    QRect r = rect();
    QFont font;
    painter.setFont(font);
    painter.setPen(Qt::gray);

    QRect rectSize(0, 0, sizeHint().width(), sizeHint().height());
    rectSize.moveCenter(r.center());
    r = rectSize;
    r.adjust(0, 0, -1, -1);
    painter.setPen(Qt::black);
    painter.setBrush(Qt::black);
    r.moveLeft(r.left() + 3);
    font.setBold(true);
    painter.setFont(font);
    painter.drawText(r, Qt::AlignVCenter|Qt::TextSingleLine, text());

    QImage image(":/xmpp/resources/downArrow.png");
    QRect rectDelta(0, 0, 7, 4);
    rectDelta.moveRight(r.right() - 4);
    rectDelta.moveCenter(QPoint(rectDelta.center().x(), r.center().y()));
    painter.drawImage(rectDelta, image);
}
Beispiel #4
0
void Test::PreparePath()
{
	SettingsManager *settings = SettingsManager::Instance();

	int32 partX = settings->GetLandscapePartitioning().x;
	int32 partY = settings->GetLandscapePartitioning().y;
	
    Landscape *land = GetLandscape();
	AABBox3 boundingBox = land->GetBoundingBox();
	Vector3 min = boundingBox.min;
	Vector3 max = boundingBox.max;
	
	float32 landWidth = max.x - min.x;
	float32 landLength = max.y - min.y;
	
	Vector2 rectSize(landWidth / partX, landLength / partY);
	
	int32 x = 0;
	int32 xDir = 1;
	for(int32 y = 0; y < partY; ++y)
    {
		Rect curRect;
		for(int32 i = 0; i < partX; ++i, x += xDir)
        {
			Vector2 v;
			v.Set(min.x + x * rectSize.x, min.y + y * rectSize.y);
			curRect.SetPosition(v);
			curRect.SetSize(rectSize);
            rectSequence.push_back(curRect);
		}
		x -= xDir;
		xDir = -xDir;
	}
}
Beispiel #5
0
void Map::generate(int L, bool boolean, float planeAng) {
  planeBool = boolean;
  planeAngle = planeAng;
  if( planeBool ) {
    //float temp = (displayx/2.0)*(cos(planeAng)-1);
    //sf::Vector2f size( rectW, displayx + 2*fabs(temp));
    sf::Vector2f rectSize(rectW, displayx);
    rect.setSize( rectSize );
    rect.setOrigin( rectSize.x/2.0, rectSize.y/2.0 );
    rect.setRotation( planeAngle ); //planeAng should be ~200 deg
    rect.setPosition( displayx/2.0, 0.75*displayy );
  }

  else {
    srand( time(NULL) );
    while( generateSumX < displayx ) {
      float length = rand()%L + 3;
      rectL = length;
      sf::Vector2f size( rectW, rectL );
      rect.setSize( size );

      float angle = (rand() % 180) + 180; // number from 180-360 in degrees
      rect.setRotation( angle );

      if( generateSumY < displayy ) {
	rect.setPosition( 0 + generateSumX, 0.75*displayy + generateSumY );
      
	generateSumY += rectL*cos(conv*angle);
	generateSumX += -rectL*sin(conv*angle);

	rectVec.push_back( rect );
      }
    }    
  }
}
Beispiel #6
0
	// Setup Outline
void Grid::setupOutline(sf::IntRect windowBounds)
{
	sf::Vector2f rectSize(windowBounds.width / 2.2f, windowBounds.height / 1.5f);
	mOutline.setSize(rectSize);
	mOutline.setPosition(windowBounds.width / 2 - rectSize.x / 2,
						 windowBounds.height / 2 - rectSize.y / 2);

	mOutline.setFillColor(sf::Color::Transparent);
	mOutline.setOutlineColor(sf::Color::Cyan);
	mOutline.setOutlineThickness(2.f);
}
Beispiel #7
0
void SimpleGraphicsView::setCurrentLabelPositionFromTextField(ivec2 pos) {
    if (currentRectItem_) {
        SimpleWithRectangleLabel* rectItem = qgraphicsitem_cast<SimpleWithRectangleLabel*>(currentRectItem_);

        if (rectItem) {
            vec2 topLeft(pos.x, pos.y);
            QRectF rect = rectItem->mapRectToScene(rectItem->rect());
            vec2 rectSize(rect.size().width(), rect.size().height());
            topLeft = topLeft - (rectSize/2.0f);
            rectItem->setPos(QPointF(topLeft.x, topLeft.y));
        }
    }
}
Beispiel #8
0
void ImageEditorWidgetQt::loadImageLabel() {
    if (tmpPropertyValue_!=static_cast<FileProperty*>(property_)->get()) {
        tmpPropertyValue_ = static_cast<FileProperty*>(property_)->get();
        imageLabelWidget_->addBackGroundImage(tmpPropertyValue_);
        ImageEditorProperty* imageProperty  = static_cast<ImageEditorProperty*>(property_);
        const std::vector<ImageLabel> labels = imageProperty->getLabels();

        for (auto& label : labels) {
            QPointF topLeft(label.getTopLeft()[0], label.getTopLeft()[1]);
            QPointF rectSize(label.getSize()[0], label.getSize()[1]);
            imageLabelWidget_->view_->addRectangle(topLeft, rectSize);
        }
    }
}
Beispiel #9
0
void animateFrameUC::paintStatusImage(HDC hdc)
{
	assert(hdc && m_pManager);
	if(!m_pImage) return;
	if(m_vecFrames.size() <= 0)
	{
		WRITE_LOCK
		m_vecFrames = calculateAreaCell(m_pImage->getImageSize(), rectSize(m_rcItem));
	}
	Gdiplus::Graphics grap(hdc);
	READ_LOCK
	if(m_vecFrames.size() <= 0 || m_iFrame >= (int)m_vecFrames.size() || m_iFrame < 0) return;
	gtc::drawer::drawImage(grap, m_pImage, m_rcItem, m_vecFrames[m_iFrame]);
	m_iFrame = ++m_iFrame % m_vecFrames.size();

}
Beispiel #10
0
Map::Map(float width, float height){
  conv = 3.141592 / 180.0;
  displayx = width;
  displayy = height;
  rectW = 5.0;
  rectL = 10.0;
  sf::Vector2f rectSize( rectW, rectL );

  sf::Color rectColor = sf::Color(102,51,0);
  rect.setSize( rectSize );
  rect.setFillColor( rectColor );
  rect.setOrigin( rectW/2.0, 0 );

  generateSumX = 0;
  generateSumY = 0;
}
Beispiel #11
0
void XColorPreview::paintEvent(QPaintEvent *)
{
    QStylePainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing,true);

    painter.setPen(QPen(Qt::black, 1));
    QSize rectSize(62,64);
    painter.setBrush(back);
    painter.drawRect(1,1,rectSize.width(),rectSize.height());

    int h = rectSize.height() / 2;
    painter.setPen(Qt::NoPen);
    painter.setBrush(col);
    painter.drawRect(1,1,rectSize.width(),h);
    painter.setBrush(colorPrevious);
    painter.drawRect(1,h + 1,rectSize.width(),rectSize.height() - h);
}
Beispiel #12
0
void SimpleGraphicsView::setCurrentLabelPositionToTextField() {
    if (currentRectItem_) {
        SimpleWithRectangleLabel* rectItem = qgraphicsitem_cast<SimpleWithRectangleLabel*>(currentRectItem_);

        if (rectItem) {
            ImgRect r;
            vec2 pos(rectItem->scenePos().x(), rectItem->scenePos().y());
            vec2 pos1(rectItem->pos().x(), rectItem->pos().y());
            r.rect_ = QRectF(rectItem->mapRectToScene(rectItem->rect()));
            r.label_ = rectItem->getLabel();
            vec2 topLeft(r.rect_.topLeft().x(), r.rect_.topLeft().y());
            vec2 rectSize(r.rect_.size().width(), r.rect_.size().height());
            vec2 centerPos = topLeft+(rectSize/2.0f);
            emit currentRectItemPositionChanged(centerPos);
        }
    }
}
Beispiel #13
0
void StGeometryTest::resizeBrightness() {
    static const size_t BR_QUADS = 11;
    static const size_t VERT_PER_QUAD = 6;
    StGLContext& aCtx = getContext();
    StGLVec2 rectSize(myCellSize.x(), 2.0f * myCellSize.y());

    // move to the center
    StGLVec2 bottomLeft(-1.0f + 0.5f * (2.0f - GLfloat(BR_QUADS) * rectSize.x()),
                        -1.0f + rectSize.y());

    GLfloat anYBottom = bottomLeft.y()                + 4.0f * myPixelSize.x();
    GLfloat anYTop    = bottomLeft.y() + rectSize.y() - 4.0f * myPixelSize.x();

    // setup vertices
    StArray<StGLVec4> aVertArray(BR_QUADS * VERT_PER_QUAD);
    for(size_t quadId = 0; quadId < BR_QUADS; ++quadId) {
        GLfloat anXLeft  = bottomLeft.x() + GLfloat(quadId + 0) * rectSize.x() + 4.0f * myPixelSize.x();
        GLfloat anXRight = bottomLeft.x() + GLfloat(quadId + 1) * rectSize.x() - 4.0f * myPixelSize.x();
        aVertArray[quadId * VERT_PER_QUAD + 0] = StGLVec4(anXLeft,  anYBottom, 0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 1] = StGLVec4(anXRight, anYBottom, 0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 2] = StGLVec4(anXRight, anYTop,    0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 3] = StGLVec4(anXRight, anYTop,    0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 4] = StGLVec4(anXLeft,  anYBottom, 0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 5] = StGLVec4(anXLeft,  anYTop,    0.0f, 1.0f);
    }
    myBrightness.changeVBO(ST_VBO_VERTEX)->init(aCtx, aVertArray);

    // setup color (increased brightness): 3% 10% 20% 30% ... 100%
    StArray<StGLVec4> aColorsArray(BR_QUADS * VERT_PER_QUAD);
    StGLVec4 aColor(0.03f, 0.03f, 0.03f, 1.0f);
    StGLVec4 aColorDelta(0.1f, 0.1f, 0.1f, 1.0f);
    for(size_t quadId = 0; quadId < BR_QUADS; ++quadId) {
        setValues(aColorsArray, aColor, quadId * VERT_PER_QUAD, VERT_PER_QUAD);
        if(quadId == 0) {
            aColor  = aColorDelta;
        } else {
            aColor += aColorDelta;
        }
    }
    myBrightness.changeVBO(ST_VBO_COLORS)->init(aCtx, aColorsArray);
}
Beispiel #14
0
int main(void){
	int i, j, answer = 0;

	scanf("%d %d %d", &R, &C, &S);
	
	for (i = 1; i <= R; i++)
		for (j = 1; j <= C; j++)
			scanf("%d", &grid[i][j]);

	for (i = 1; i <= R; i++)
		for (j = 2; j <= C; j++)
			grid[i][j] += grid[i][j-1];

	for (i = 2; i <= R; i++)
		for (j = 1; j <= C; j++)
			grid[i][j] += grid[i-1][j];

	for (i = 1; i <= R; i++){
		for (j = i; j <= R; j++){
			int a, b;
			a = b = 1;

			while (a <= C && b <= C){
				int size = rectSize(i,a,j,b);

				if (size == S)
					answer++;

				if ((b == C || size >= S) && a < b)
					a++;
				else
					b++;
			}
		}
	}

	printf("%d\n", answer);

	return 0;
}
Beispiel #15
0
void StGeometryTest::resizeColor() {
    static const size_t COLOR_QUADS   = 8;
    static const size_t VERT_PER_QUAD = 6;
    StGLContext& aCtx = getContext();
    StGLVec2 rectSize(myCellSize.x(), 2.0f * myCellSize.y());

    // move to the center
    StGLVec2 bottomLeft(-1.0f + 0.5f * (2.0f - GLfloat(COLOR_QUADS) * rectSize.x()),
                        -1.0f + 2.0f * rectSize.y());

    GLfloat anYBottom = bottomLeft.y()                + 4.0f * myPixelSize.x();
    GLfloat anYTop    = bottomLeft.y() + rectSize.y() - 4.0f * myPixelSize.x();

    // setup vertices
    StArray<StGLVec4> aVertArray(COLOR_QUADS * VERT_PER_QUAD);
    for(size_t quadId = 0; quadId < COLOR_QUADS; ++quadId) {
        GLfloat anXLeft  = bottomLeft.x() + GLfloat(quadId + 0) * rectSize.x() + 4.0f * myPixelSize.x();
        GLfloat anXRight = bottomLeft.x() + GLfloat(quadId + 1) * rectSize.x() - 4.0f * myPixelSize.x();
        aVertArray[quadId * VERT_PER_QUAD + 0] = StGLVec4(anXLeft,  anYBottom, 0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 1] = StGLVec4(anXRight, anYBottom, 0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 2] = StGLVec4(anXRight, anYTop,    0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 3] = StGLVec4(anXRight, anYTop,    0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 4] = StGLVec4(anXLeft,  anYBottom, 0.0f, 1.0f);
        aVertArray[quadId * VERT_PER_QUAD + 5] = StGLVec4(anXLeft,  anYTop,    0.0f, 1.0f);
    }
    myColors.changeVBO(ST_VBO_VERTEX)->init(aCtx, aVertArray);

    // setup color
    StArray<StGLVec4> aColorsArray(COLOR_QUADS * VERT_PER_QUAD);
    setValues(aColorsArray, StGLVec4(0.0f, 0.0f, 1.0f, 1.0f), 0 * VERT_PER_QUAD, VERT_PER_QUAD); // blue
    setValues(aColorsArray, StGLVec4(0.0f, 1.0f, 1.0f, 1.0f), 1 * VERT_PER_QUAD, VERT_PER_QUAD); // aqua
    setValues(aColorsArray, StGLVec4(1.0f, 0.0f, 1.0f, 1.0f), 2 * VERT_PER_QUAD, VERT_PER_QUAD); // fuchsia
    setValues(aColorsArray, StGLVec4(1.0f, 0.0f, 0.5f, 1.0f), 3 * VERT_PER_QUAD, VERT_PER_QUAD); // ?
    setValues(aColorsArray, StGLVec4(1.0f, 0.0f, 0.0f, 1.0f), 4 * VERT_PER_QUAD, VERT_PER_QUAD); // red
    setValues(aColorsArray, StGLVec4(1.0f, 0.5f, 0.0f, 1.0f), 5 * VERT_PER_QUAD, VERT_PER_QUAD); // orange
    setValues(aColorsArray, StGLVec4(1.0f, 1.0f, 0.0f, 1.0f), 6 * VERT_PER_QUAD, VERT_PER_QUAD); // yellow
    setValues(aColorsArray, StGLVec4(0.0f, 1.0f, 0.0f, 1.0f), 7 * VERT_PER_QUAD, VERT_PER_QUAD); // green
    myColors.changeVBO(ST_VBO_COLORS)->init(aCtx, aColorsArray);
}
Beispiel #16
0
//Function writes content of the textEditor_ to the file
bool ImageEditorWidgetQt::writeImageLabel() {
    //Close the file to open it with new flags
    ImageEditorProperty* imageEditorProperty = dynamic_cast<ImageEditorProperty*>(property_);

    if (imageEditorProperty) {
        //Save labels
        std::stringstream ss;
        std::vector<ImgRect> rectList = imageLabelWidget_->view_->getRectList();
        QSize dim = imageLabelWidget_->backGroundImage_->size();
        imageEditorProperty->setDimensions(ivec2(dim.width(), dim.height()));
        //if (rectList.size())
        imageEditorProperty->clearLabels();

        for (auto& elem : rectList) {
            vec2 topLeft(elem.rect_.topLeft().x(), elem.rect_.topLeft().y());
            vec2 rectSize(elem.rect_.size().width(), elem.rect_.size().height());
            imageEditorProperty->addLabel(topLeft, rectSize, elem.label_);
        }
    }

    return true;
}
Beispiel #17
0
QPainterPath CornersInWipeStrategy::clipPath(int step, const QRect &area)
{
    int width_2 = area.width() >> 1;
    int height_2 = area.height() >> 1;

    qreal percent = static_cast<qreal>(step) / static_cast<qreal>(StepCount);
    int stepx = static_cast<int>(width_2 * percent);
    int stepy = static_cast<int>(height_2 * percent);

    QPainterPath path;

    if(! reverse())
    {
        QSize rectSize(stepx, stepy);

        QRect topLeft(area.topLeft(), rectSize);
        QRect topRight(area.topRight() - QPoint(stepx, 0), rectSize);
        QRect bottomRight(area.bottomRight() - QPoint(stepx, stepy), rectSize);
        QRect bottomLeft(area.bottomLeft() - QPoint(0, stepy), rectSize);

        path.addRect(topLeft);
        path.addRect(topRight);
        path.addRect(bottomRight);
        path.addRect(bottomLeft);
    }
    else
    {
        QRect horzRect(QPoint(0, 0), QSize(2 * stepx, area.height()));
        horzRect.moveCenter(area.center());
        QRect vertRect(QPoint(0, 0), QSize(area.width(), 2 * stepy));
        vertRect.moveCenter(area.center());

        path.addRect(horzRect);
        path.addRect(vertRect);
        path.setFillRule(Qt::WindingFill);
    }

    return path;
}
Beispiel #18
0
Box::Box(float width, float height) {
  conv = 3.141592 / 180.0;
  gravity = 9.8;
  
  displayx = width;
  displayy = height;

  rectW = 50.0;
  rectL = 50.0;
  sf::Vector2f rectSize( rectW, rectL );
  sf::Color rectColor( sf::Color::Green );
  rect.setSize( rectSize );
  rect.setOrigin( rectW/2.0, rectL/2.0 );
  rect.setFillColor( rectColor );

  // Some Initial Conditions
  sf::Vector2f boxPosition(0,0);
  speed = 1.f;
  rect.setPosition( displayx/2.0, 3*rectL );

  collision = false;
  bounceNumber = 0;
}
Beispiel #19
0
void TileMapPanel::OnPaint(wxPaintEvent& event)
{
    wxAutoBufferedPaintDC dc(this);
    DoPrepareDC(dc);

    wxPoint minPos = GetViewStart();
    int width, height;
    GetClientSize(&width, &height);
    wxPoint maxPos = minPos + wxPoint(width, height);

    dc.SetBrush(gd::CommonBitmapManager::Get()->transparentBg);
    dc.DrawRectangle(minPos.x, minPos.y, width, height);

    if(!m_tilemap || !m_tileset || m_tileset->IsDirty())
        return;

    dc.SetPen(wxPen(wxColor(128, 128, 128, 255), 1));

    //Determine the first and last columns and rows to draw
    int firstCol = std::max((int)(minPos.x / m_tileset->tileSize.x - 1), 0);
    int firstRow = std::max((int)(minPos.y / m_tileset->tileSize.y - 1), 0);
    int lastCol = std::min((int)(maxPos.x / m_tileset->tileSize.x + 1), m_tilemap->GetColumnsCount());
    int lastRow = std::min((int)(maxPos.y / m_tileset->tileSize.y + 1), m_tilemap->GetRowsCount());

    //Draw the tiles
    for(int layer = 0; m_hideUpperLayers ? layer <= GetCurrentLayer() : layer < 3; layer++)
    {
        for(int col = firstCol; col < lastCol; col++)
        {
            for(int row = firstRow; row < lastRow; row++)
            {
                if(m_tilemap->GetTile(layer, col, row) == -1)
                    continue;

                dc.DrawBitmap(m_tileset->GetTileBitmap(m_tilemap->GetTile(layer, col, row)), GetPositionOfTile(col, row).x, GetPositionOfTile(col, row).y, true);
            }
        }
    }

    //Draw the rectangle (when the mode is RectangleMode)
    if(m_insertionMode == RectangleMode && m_isDrawingRectangle)
    {
        dc.SetBrush(wxBrush(wxColour(128, 128, 255, 128)));
        dc.SetPen(wxPen(wxColor(128, 128, 255, 255), 1));

        wxPoint topLeftPos(GetPositionOfTile(std::min(m_beginCol, m_endCol),
                                             std::min(m_beginRow, m_endRow)));

        wxPoint bottomRightPos(GetPositionOfTile(std::max(m_beginCol + 1, m_endCol + 1),
                                                 std::max(m_beginRow + 1, m_endRow + 1)));

        wxSize rectSize(bottomRightPos.x - topLeftPos.x, bottomRightPos.y - topLeftPos.y);

        dc.DrawRectangle(topLeftPos, rectSize);
    }

    dc.SetPen(wxPen(wxColor(128, 128, 128, 255), 1));

    //Draw the grid
    for(int col = firstCol; col < lastCol; col++)
    {
        dc.DrawLine(col * m_tileset->tileSize.x, minPos.y,
                    col * m_tileset->tileSize.x, maxPos.y);

        for(int row = firstRow; row < lastRow; row++)
        {
            dc.DrawLine(minPos.x, row * m_tileset->tileSize.y,
                        maxPos.x, row * m_tileset->tileSize.y);
        }
    }

    //Draw a gray rectangle outside the map
    dc.SetBrush(wxColor(128, 128, 128, 255));
    if(maxPos.x > (m_tilemap->GetColumnsCount() * m_tileset->tileSize.x))
    {
        dc.DrawRectangle(m_tilemap->GetColumnsCount() * m_tileset->tileSize.x,
                         minPos.y,
                         maxPos.x - m_tilemap->GetColumnsCount() * m_tileset->tileSize.x,
                         maxPos.y - minPos.y);
    }
    if(maxPos.y > (m_tilemap->GetRowsCount() * m_tileset->tileSize.y))
    {
        dc.DrawRectangle(minPos.x,
                         m_tilemap->GetRowsCount() * m_tileset->tileSize.y,
                         maxPos.x - minPos.x,
                         maxPos.y - m_tilemap->GetRowsCount() * m_tileset->tileSize.y);
    }
}