From b2e9cda3f063d8dc838f4ae3870ee4bc83e2aace Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 2 Aug 2009 12:34:58 +0000 Subject: [PATCH] Syncing uppdev git-svn-id: svn://ultimatepp.org/upp/trunk@1467 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppdev/SetSurface/main.cpp | 71 +++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/uppdev/SetSurface/main.cpp b/uppdev/SetSurface/main.cpp index 237b8c52c..d129fa149 100644 --- a/uppdev/SetSurface/main.cpp +++ b/uppdev/SetSurface/main.cpp @@ -1,36 +1,35 @@ -#include - -using namespace Upp; - -struct MyApp : TopWindow { - RGBA pixels[65536]; - - virtual void Paint(Draw& w) { - w.DrawRect(GetSize(), LtGray()); - RTIMING("Benchmark"); - for(int i = 0; i < 100; i++) { - SetSurface(w, 0, 0, 256, 256, pixels); - SetSurface(w, RectC(300, 128, 128, 128), pixels, Size(256, 256), Point(0, 0)); - SetSurface(w, RectC(300, 0, 128, 64), pixels, Size(256, 256), Point(128, 128)); - } - } - - MyApp() { - RGBA *t = pixels; - for(int x = 0; x < 256; x++) - for(int y = 0; y < 256; y++) { - int d = (x - 128) * (x - 128) + (y - 128) * (y - 128); - RGBA c = Black(); - if(d > 120 * 120) - c = White(); - if(d < 120 * 120) - c.r = 255 - min(255 * d / (120 * 120), 255); - *t++ = c; - } - } -}; - -GUI_APP_MAIN -{ - MyApp().Run(); -} +#include + +using namespace Upp; + +struct MyApp : TopWindow { + RGBA pixels[65536]; + + virtual void Paint(Draw& w) { + w.DrawRect(GetSize(), LtGray()); + for(int i = 0; i < 100; i++) { + SetSurface(w, 0, 0, 256, 256, pixels); + SetSurface(w, RectC(300, 128, 128, 128), pixels, Size(256, 256), Point(0, 0)); + SetSurface(w, RectC(300, 0, 128, 64), pixels, Size(256, 256), Point(128, 128)); + } + } + + MyApp() { + RGBA *t = pixels; + for(int x = 0; x < 256; x++) + for(int y = 0; y < 256; y++) { + int d = (x - 128) * (x - 128) + (y - 128) * (y - 128); + RGBA c = Black(); + if(d > 120 * 120) + c = White(); + if(d < 120 * 120) + c.r = 255 - min(255 * d / (120 * 120), 255); + *t++ = c; + } + } +}; + +GUI_APP_MAIN +{ + MyApp().Run(); +}