From f0dd2ae1faa87f47b6b15d2a17754ae9e852a92a Mon Sep 17 00:00:00 2001 From: twanvl Date: Mon, 11 Dec 2006 15:53:30 +0000 Subject: [PATCH] played with profiling git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@111 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gfx/resample_text.cpp | 32 +- src/gui/update_checker.cpp | 1 + src/mse.sln | 7 +- src/mse.vcproj | 647 ++++++++++++++++++++++++++++++++++- src/render/symbol/filter.cpp | 1 + 5 files changed, 679 insertions(+), 9 deletions(-) diff --git a/src/gfx/resample_text.cpp b/src/gfx/resample_text.cpp index 7ec9a915..96586eb9 100644 --- a/src/gfx/resample_text.cpp +++ b/src/gfx/resample_text.cpp @@ -18,12 +18,13 @@ const int text_scaling = 4; // Fills an image with the specified color void fill_image(Image& image, const Color& color) { Byte* pos = image.GetData(); - Byte* end = image.GetData() + image.GetWidth() * image.GetHeight() * 3; + Byte* end = pos + image.GetWidth() * image.GetHeight() * 3; + Byte r = color.Red(), g = color.Green(), b = color.Blue(); + // fill the image while (pos != end) { - pos[0] = color.Red(); - pos[1] = color.Green(); - pos[2] = color.Blue(); - pos += 3; + *pos++ = r; + *pos++ = g; + *pos++ = b; } } @@ -58,6 +59,27 @@ void downsample_to_alpha(Image& img_in, Image& img_out) { out[x + line_size * y] = total / text_scaling; } } + + /* + img_out.InitAlpha(); + Byte* in = img_in.GetData(); + Byte* out = img_out.GetAlpha(); + int w = img_out.GetWidth(), h = img_out.GetHeight(); + int line_size = 3 * w * text_scaling; + for (int y = 0 ; y < h ; ++y) { + for (int x = 0 ; x < w ; ++x) { + int total = 0; + for (int i = 0 ; i < text_scaling ; ++i) { + for (int j = 0 ; j < text_scaling ; ++j) { + total += in[3*j]; + } + in += line_size; + } + *out++ = total / (text_scaling * text_scaling); + in += 3 * text_scaling - line_size * text_scaling; + } + in += line_size * (text_scaling - 1); + }*/ } // Draw text by first drawing it using a larger font and then downsampling it diff --git a/src/gui/update_checker.cpp b/src/gui/update_checker.cpp index 8b5586f9..4a451121 100644 --- a/src/gui/update_checker.cpp +++ b/src/gui/update_checker.cpp @@ -9,6 +9,7 @@ #include #include #include +#include