FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug? CBanner

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT
View previous topic :: View next topic  
Author Message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Sun Dec 25, 2005 8:41 am    Post subject: Bug? CBanner Reply with quote

I noticed this first in poseidon but it works the same way for me. First when I drag the banner just a bit it jumps left like 100 pixels and is unable to become smaller than that. Plus when it is dragged to the left it draws some nonsense (when it reaches the first icon).
Back to top
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Sun Dec 25, 2005 8:57 pm    Post subject: Reply with quote

This is not a bug. This is what Eclispe/SWT does within v3.01. I tested it in Java environment.

I have updated the involved classes to SWT 3.10 now and will submit them soon.

the changes:

dwt.custom.cbanner is modified.
dwt.custom.cbannerlayout is added;
dwt.custom.clayoutdata is added.
Back to top
View user's profile Send private message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Mon Dec 26, 2005 3:22 am    Post subject: Reply with quote

Quote:
This is not a bug. This is what Eclispe/SWT does within v3.01. I tested it in Java environment.


I guess this is for the 'jumping' (although it is very strange to me but abviously those java guys are able to think of any kinds of nonsense). But I doubt about the drawing corruption. Maybe it appears only on my machine? Do I need to attach a screenshot?
Back to top
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Mon Dec 26, 2005 9:04 am    Post subject: Reply with quote

Update 81:

CBanner has been updated to Eclipse/SWT 3.10 now.

2 files modified, 2 files added.
Trac the changes here:


http://trac.dsource.org/projects/dwt/changeset/81
Back to top
View user's profile Send private message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Mon Dec 26, 2005 2:37 pm    Post subject: Reply with quote

This is muuuuuch better. In the mean time I did this screenshot http://www.lessequal.com/trash/Clipboard01.png . Notice the corruption? By the way maybe this will go too far from SWT but it would be nice if the banner has 'sticky' flag or something. I.e. when you drag it and the edge of the right-most icon is near the edge of the window it could 'stick' to it.
Back to top
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Mon Dec 26, 2005 8:29 pm    Post subject: Reply with quote

bobef wrote:
Notice the corruption?


If you use a transparent gif file, half of the picture will be drawn correctly. But I saw there are some ripples near the left side of the separator. And I managed to find the problem.
Code:
void onPaint(GC gc){
    line2[index] = line1[index++]  - 1;
}

DMD handle this in a different way from Java/C++. Should be changed to
Code:
line2[index] = line1[index]  - 1; index++;

This has been discussed before in NG. But not easy to detect while porting.

Thanks!
Back to top
View user's profile Send private message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Tue Dec 27, 2005 5:53 pm    Post subject: Reply with quote

Strange. Few weeks ago I wrote code similar to that i.e. foo[bar++] and it was working exactly as expected (as in C/C++). And it is still working...


this drawing ODE trimesh data:

Code:
glBegin(GL_TRIANGLES);
      for(int c,c2;c<m_tridata.m_nindices;c2++)
      {
         dVector3 v0=m_tridata.m_vertices[m_tridata.m_indices[c++]];
         dVector3 v1=m_tridata.m_vertices[m_tridata.m_indices[c++]];
         dVector3 v2=m_tridata.m_vertices[m_tridata.m_indices[c++]];

         glNormal3f(m_tridata.m_normals[c2].x,m_tridata.m_normals[c2].y,m_tridata.m_normals[c2].z);
         glVertex3f(v0[0],v0[1],v0[2]);
         glVertex3f(v1[0],v1[1],v1[2]);
         glVertex3f(v2[0],v2[1],v2[2]);
      }
      glEnd();


this is loading FreeType font into OpenGL texture:
Code:

int pp=0,pp2=0,dd=(width-bitmap.width)*2;
               for(int y=0;y<bitmap.rows;y++)
               {
                  int pc = y * bitmap.pitch;
                  int pcr=pc;
                  pc*= 8;
                  for(int x=0;x<bitmap.width;x++,pc++)
                  {
                     //if(i=='l') writef("?3.3d ",bitmap.buffer[pp2]);
                     if(antialias)
                     {
                        expanded_data[pp++]=255;
                        expanded_data[pp++]=bitmap.buffer[pp2++];
                        //expanded_data[pp++]=bitmap.buffer[pp2++]>=128?cast(ubyte)255:cast(ubyte)0;
                     }
                     else
                     {
                        expanded_data[pp++]=255;
                        expanded_data[pp++] = cast(ubyte)(((bitmap.buffer[pc / 8]<< (pc ? 8)) & 128) ? 255 : 0);
                     }
                  }
                  pp+=dd;
                  //if(i=='l') writef("\n");
               }
Back to top
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Tue Dec 27, 2005 6:31 pm    Post subject: Reply with quote

the following is ok for D, because both side of = use different array index variable.
Code:
expanded_data[pp++]=bitmap.buffer[pp2++];


but if it is the same array index var, you get wrong result:
Code:
expanded_data[pp++]=bitmap.buffer[pp++];

or
Code:
expanded_data[pp]=bitmap.buffer[pp++];


the reason is that the pp(index) value at left side of = change after evaluate the right side.

eg.
Code:

int pp = 5;
expanded_data[pp]=bitmap.buffer[pp++] ;

// we desired
expanded_data[5]=bitmap.buffer[5] ;

pp = 6; // (after left side of = assign a vaule)

// but we got
expanded_data[6]=bitmap.buffer[5] - 1;
pp = 6; // (before left side of = assign a vaule)


In NG :
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/27876

According to http://digitalmars.com/d/expression.html,
We should avoid these kind of codes.
Back to top
View user's profile Send private message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Wed Dec 28, 2005 4:16 am    Post subject: Reply with quote

Oh I see. Thank you about this explanation it was important to know this difference from C... This seems unnatural to me because I come from C(++) but I wonder what Walter thinks about it. I didn't see his opinion in the thread you pointed...
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group