|
In order to avoid blinkings try to invalidate only the area you are updating instead of the whole paint area.
Themis
|
|
|
|
|
|
It's easy if you know what you have updated in each call. Instead of calling Invalidate() call InvalidateRect(). It takes as argument the area that you want to invalidate. It will update only that area this way if only a small portion of your view has changed you won't redraw everything.
Themis
|
|
|
|
|
Many thanks !
Do you know about more methods for redrawing the window except for calling the Onpaint()?
|
|
|
|
|
My head hurts!!!
It is almost a week that I'm thinking how to traduce the following mechanism in C code.
This is pseudocode, the indexes at the right move like a circular buffer
N = 3;
Pass 1:
pFFT[2] * IR_FFT[0];
pFFT[1] * IR_FFT[2];
pFFT[0] * IR_FFT[1];
Pass 2:
pFFT[2] * IR_FFT[1];
pFFT[1] * IR_FFT[0];
pFFT[0] * IR_FFT[2];
Pass 3:
pFFT[2] * IR_FFT[2];
pFFT[1] * IR_FFT[1];
pFFT[0] * IR_FFT[0];
Pass 4:
pFFT[2] * IR_FFT[0];
pFFT[1] * IR_FFT[2];
pFFT[0] * IR_FFT[1];
Every N passes the Mult sequence is equal.
I'm not able to traduce the right indexes work!
Could you help me?
best regards
|
|
|
|
|
this was easy: but i doubt if this is best, I just did it on my writing pad. I am putting it here, Let me know if it works( you can mail me.)
Code in C++, and works for only three pass(your pass 1 and pass 4 are same)
for(int i=0;i<=3;i++)
{
for(int j=0;j<=2;j++)
{
int x=j-i;
if(x==-1)
x=2;
if(x==-2)
x=1;
a[j]= pFFT[j] * IR_FFT[x];
}
}
Ye Dil Mangge MORE!!
|
|
|
|
|
for(int pass = 0; pass < 4; pass++)
{
pFFT[2] * IR_FFT[(pass + 0) % 3];
pFFT[1] * IR_FFT[(pass + 2) % 3];
pFFT[0] * IR_FFT[(pass + 1) % 3];
}
http://www.catch22.net
|
|
|
|
|
Hi
I create a simple form and at the OnPaint() function I draw:
* Rectangle - using: Rectangle(...
* line that represent x,y axis - using LineTo(... and MoveTo(...
* and line that represent function (such as sin, cos etc.)
When I run the program everything is alright but when i resize the window and drag it fast over the screen the program collapse (like it ran out of memory or somthing).
what should i do or not do ?
Thanks in advance
Lior.
|
|
|
|
|
Anonymous wrote:
what should i do
Like always enclosing some relevant code snippet?
--
The Blog: Bits and Pieces
|
|
|
|
|
coding style issues, which better, how used ??
1. if (true == v1)
{
v2 = 0;
}
else
{
v2 = 1;
}
2. v2 ((true == v1) ? 0 : 1);
|
|
|
|
|
Don't compare a boolean value with true or false . There's no logic in that (sic!). It'll cause more confusion than clarity. For instance:
if(((enabled == true) == true) == true...) Where dou you stop? It's obviously clearer with
if(enabled)
But, as the question is formulated, me thinks that
v2 = v1 ? 0 : 1; is best.
--
The Blog: Bits and Pieces
|
|
|
|
|
I just want to add, it can also be a very buggy thing to do. Even a C++ 'bool' can have more values than just true and false.
But aside from that, if you are working with Windows API, comparing to TRUE is the wrong thing to do since the API are defined as being 0 and != 0 which means that they might return 5219 for TRUE.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hello,
It's just a matter of preference. You can also write:
v2 = !v1;
Since you can use the opposite value of v1, you can omit v2. This can go on endlessly. Choose what comforts you most.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
It's just a matter of preference. You can also write:
v2 = !v1;
Yes, when v2 is also a bool , but I sensed that the question covered the generic case.
--
The Blog: Bits and Pieces
|
|
|
|
|
Johann Gerell wrote:
Yes, when v2 is also a bool
If v2 is an int , true will be changed to 1 and false to 0. Unless v2 is an user defined type, this can work...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
if (v1) {
v2 = 0;
}
else {
v2 = 1;
} or
v2 = v1 ? 0 : 1; For myself, I only use the condtional operator (? : ) when the result is a simple expression.
Software Zen: delete this;
|
|
|
|
|
if(v1) { v2 = 0; }
else { v2 = 1; } runs a little faster than
v2 = v1 ? 0 : 1;
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote:
if(v1) { v2 = 0; }
else { v2 = 1; }
runs a little faster than
v2 = v1 ? 0 : 1;
How thats run Faster?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
About four years ago I did some test about your question with VC++6. Just now I did again with VC++7.1. My method is as:
void Test_If(bool& v1, int& v2)
{
if(v1) {
v2 = 0;
}
else {
v2 = 1;
}
}
void Test_Op(bool& v1, int& v2)
{
v2 = v1 ? 0 : 1;
}
void CTestComboDlg::OnBnClickedButton1()
{
bool v1 = true;
int v2 = 3;
int i;
DWORD ds, de;
ds = GetTickCount();
for(i = 0; i < 0x10000000; i++) {
Test_If(v1, v2);
}
de = GetTickCount();
TRACE("IF: %u \n", de - ds);
ds = GetTickCount();
for(i = 0; i < 0x10000000; i++) {
Test_Op(v1, v2);
}
de = GetTickCount();
TRACE("OP: %u \n", de - ds);
} The output is:
IF: 48690
OP: 52576
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote:
he output is:
IF: 48690
OP: 52576
Nice, Thanks for same
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote:
How thats run Faster?
maybe because it has to evaluate the ?: operator before.
1. using if :
- evaluate the condition.
- test the if statement
- assign v2
2. using ?: :
- enters the = operator
- enters the ?: operator
- evaluate the condition
- return the right parameter wether the condition is true or false
- assign v2
i feel it like this... but i personnally still use the second case
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You should not have to feel a thing.
Just DO IT by examining the disassembly.
The assembly dump would explain why one is faster than the other.
|
|
|
|
|
In my dialog based program the Mainmenus underscore symbols not appearing by default. If I pressed alt key then only they are apearing. I want to make my menu should show shortcut keys like VC++ editor shows. with out pressing alt key I want to show shortcut keys. Any help please. My OS is XP.
Nice talking to you.
|
|
|
|
|
Maybe you forgot to place the ampersand before the character that you want to be underlined
|
|
|
|
|
Sorry, I kept it. My application is working fine in other os. like Windows - 2000, NT. But not in XP.
Nice talking to you.
|
|
|
|