fix performance problem
authorSukwon Suh <sukwon.suh@samsung.com>
Thu, 18 Apr 2013 07:30:10 +0000 (16:30 +0900)
committerSukwon Suh <sukwon.suh@samsung.com>
Thu, 18 Apr 2013 07:30:10 +0000 (16:30 +0900)
Change-Id: I4e0008814f9e5119a6c32b096e6e3aba7269a457
Signed-off-by: Sukwon Suh <sukwon.suh@samsung.com>
project/inc/GlesCanvasTexture.h
project/src/GlesCanvasTexture.cpp

index 4746527..763ec75 100644 (file)
@@ -118,6 +118,8 @@ private:
        Tizen::Graphics::Font*                  __pFont;
        bool                                    __needUpdateTexture;
 
+       int                                     __drawCount;
+
        friend class GlesForm;
 };
 
index e6e7431..5e3e22e 100644 (file)
@@ -33,6 +33,7 @@ using namespace Tizen::Base::Utility;
 const int TIME_OUT = 10;
 const float PI = 3.1415926535897932384626433832795f;
 //#define DISPLAY_FPS
+const int MAX_DRAW_COUNT = 1;
 
 const char* VERTEX_TEXT =
                "uniform mat4 uPositionMatrix;\n"
@@ -167,6 +168,7 @@ GlesCanvasTexture::GlesCanvasTexture(void)
        , __pCanvas(null)
        , __pFont(null)
        , __needUpdateTexture(false)
+       , __drawCount(0)
 {
 }
 
@@ -626,6 +628,7 @@ GlesCanvasTexture::Draw(void)
        {
                __needUpdateTexture = false;
                __pCanvas->Show();
+               __drawCount = 0;
        }
 
        glBindTexture(GL_TEXTURE_2D, __textureId);
@@ -773,12 +776,13 @@ GlesCanvasTexture::DrawText(Tizen::Base::String string)
 void
 GlesCanvasTexture::DrawEllipse(Point position, Color color)
 {
-       if (__pCanvas != null)
+       if (__pCanvas != null && __drawCount < MAX_DRAW_COUNT)
        {
                int size = 10 + Math::Rand() % 40;
                Rectangle rect(position.x - size, position.y -size, size * 2, size * 2);
                __pCanvas->FillEllipse(color, rect);
                DrawText(L"Touch the screen");
                __needUpdateTexture = true;
+               __drawCount++;
        }
 }