[Rawstudio-commit] rawspeed r60 - RawSpeed

Klaus Post klauspost at gmail.com
Sun Feb 8 16:23:14 CET 2009


Author: post
Date: 2009-02-08 16:23:13 +0100 (Sun, 08 Feb 2009)
New Revision: 60

Modified:
   RawSpeed/Point.h
   RawSpeed/RawImage.cpp
Log:
- Crop validity math was wrong
- Compiler warnings.
- Linux compiler problems.

Modified: RawSpeed/Point.h
===================================================================
--- RawSpeed/Point.h	2009-02-08 15:01:33 UTC (rev 59)
+++ RawSpeed/Point.h	2009-02-08 15:23:13 UTC (rev 60)
@@ -30,15 +30,15 @@
 public:
 	iPoint2D() {x = y = 0;  }
 	iPoint2D( int a, int b) {x=a; y=b;}
-  iPoint2D( iPoint2D& pt) {x=pt.x; y=pt.y;}
-  iPoint2D operator+= (const iPoint2D other) { x += other.x; y += other.y; return *this;}
-  iPoint2D operator-= (const iPoint2D other) { x -= other.x; y -= other.y; return *this;}
-  iPoint2D operator- (const iPoint2D b) { return iPoint2D(x-b.x,y-b.y); }
-  iPoint2D operator+ (const iPoint2D b) { return iPoint2D(x+b.x,y+b.y); }
-  iPoint2D iPoint2D::operator=(iPoint2D b) { x = b.x; y = b.y; return *this;}
+  iPoint2D( const iPoint2D& pt) {x=pt.x; y=pt.y;}
+  iPoint2D operator += (const iPoint2D& other) { x += other.x; y += other.y; return *this;}
+  iPoint2D operator -= (const iPoint2D& other) { x -= other.x; y -= other.y; return *this;}
+  iPoint2D operator - (const iPoint2D& b) { return iPoint2D(x-b.x,y-b.y); }
+  iPoint2D operator + (const iPoint2D& b) { return iPoint2D(x+b.x,y+b.y); }
+  iPoint2D operator = (const iPoint2D& b) { x = b.x; y = b.y; return *this;}
 	~iPoint2D() {};
   guint area() {return abs(x*y);}
-  gboolean isThisInside(iPoint2D &otherPoint) {return (x<otherPoint.x && y<otherPoint.y); };
+  gboolean isThisInside(const iPoint2D &otherPoint) {return (x<=otherPoint.x && y<=otherPoint.y); };
   int x,y;
 };
 

Modified: RawSpeed/RawImage.cpp
===================================================================
--- RawSpeed/RawImage.cpp	2009-02-08 15:01:33 UTC (rev 59)
+++ RawSpeed/RawImage.cpp	2009-02-08 15:23:13 UTC (rev 60)
@@ -41,6 +41,7 @@
   if (data)
 	  _aligned_free(data);
   data = 0;
+  mOffset = iPoint2D(0,0);
   pthread_mutex_destroy(&mymutex);
 }
 
@@ -75,9 +76,9 @@
 
   if (!data)
     ThrowRDE("RawImageData::getData - Data not yet allocated.");
-  if (x>=dim.x)
+  if ((int)x>=dim.x)
     ThrowRDE("RawImageData::getData - X Position outside image requested.");
-  if (y>=dim.y)
+  if ((int)y>=dim.y)
     ThrowRDE("RawImageData::getData - Y Position outside image requested.");
 
   return &data[y*pitch+x*bpp];
@@ -85,7 +86,7 @@
 
 void RawImageData::subFrame( iPoint2D offset, iPoint2D new_size )
 {
-  if (!new_size.isThisInside(dim+offset+mOffset))
+  if (!new_size.isThisInside(dim-offset))
     ThrowRDE("RawImageData::subFrame - Attempted to create new subframe larger than original size.");
 
   mOffset += offset;




More information about the Rawstudio-commit mailing list