libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd subimage_test.cc cvd/gl_helpers.h cvd/im... [sub


From: Edward Rosten
Subject: [libcvd-members] libcvd subimage_test.cc cvd/gl_helpers.h cvd/im... [subimage2]
Date: Wed, 28 Jun 2006 22:03:05 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Branch:         subimage2
Changes by:     Edward Rosten <edrosten>        06/06/28 22:03:05

Modified files:
        .              : subimage_test.cc 
        cvd            : gl_helpers.h image.h 

Log message:
        glDrawPixels now works on sum images.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/subimage_test.cc?cvsroot=libcvd&only_with_tag=subimage2&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/gl_helpers.h?cvsroot=libcvd&only_with_tag=subimage2&r1=1.24&r2=1.24.6.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/image.h?cvsroot=libcvd&only_with_tag=subimage2&r1=1.20.2.1&r2=1.20.2.2

Patches:
Index: subimage_test.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/Attic/subimage_test.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- subimage_test.cc    28 Jun 2006 21:25:15 -0000      1.1.2.1
+++ subimage_test.cc    28 Jun 2006 22:03:04 -0000      1.1.2.2
@@ -44,6 +44,12 @@
 
        SubImage<byte> s = in.sub_image(ImageRef(10,10), ImageRef(100,100));
 
+       VideoDisplay e(0,0,90,90);
+       glDrawPixels(s);
+       cin.get();
+
+       d.make_current();
+
        clear(s.begin(), s.end());
 
        glDrawPixels(in);
@@ -54,6 +60,8 @@
        glDrawPixels(in);
        glFlush();
        
+       cin.get();
+
        s = in;
 
 

Index: cvd/gl_helpers.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/gl_helpers.h,v
retrieving revision 1.24
retrieving revision 1.24.6.1
diff -u -b -r1.24 -r1.24.6.1
--- cvd/gl_helpers.h    16 May 2006 13:30:20 -0000      1.24
+++ cvd/gl_helpers.h    28 Jun 2006 22:03:04 -0000      1.24.6.1
@@ -406,10 +406,12 @@
        /// Use glRasterPos to set the current raster position
        /// @param i The image to draw
        ///@ingroup gGL
-       template<class C> inline void glDrawPixels(const BasicImage<C>& i)
+       template<class C> inline void glDrawPixels(const SubImage<C>& i)
        {
                ::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+               ::glPixelStorei(GL_UNPACK_ROW_LENGTH, i.row_stride());
                ::glDrawPixels(i.size().x, i.size().y, gl::data<C>::format, 
gl::data<C>::type, i.data());
+               ::glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
        }
 
        /// Sets an image as a texture sub region.

Index: cvd/image.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/image.h,v
retrieving revision 1.20.2.1
retrieving revision 1.20.2.2
diff -u -b -r1.20.2.1 -r1.20.2.2
--- cvd/image.h 28 Jun 2006 21:25:15 -0000      1.20.2.1
+++ cvd/image.h 28 Jun 2006 22:03:04 -0000      1.20.2.2
@@ -395,6 +395,12 @@
                        return my_size;
                }
 
+               /// What is the row stride of the image?
+               inline int row_stride() const
+               {
+                       return my_stride;
+               }
+
                /// What is the total number of elements in the image (i.e. 
<code>size().x * size().y</code>), including padding
                inline int totalsize() const
                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]