include/sampler.h
branchpyrit
changeset 88 f7edb3b90816
parent 87 1081e3dd3f3e
child 90 f6a72eb99631
--- a/include/sampler.h	Sun Apr 27 22:55:17 2008 +0200
+++ b/include/sampler.h	Mon Apr 28 11:44:11 2008 +0200
@@ -29,6 +29,7 @@
 
 #include "common.h"
 #include "vector.h"
+#include "pixmap.h"
 
 using namespace std;
 
@@ -56,19 +57,23 @@
 class Sampler
 {
 protected:
-	Float *buffer;
-	int w,h;
+
+	Pixmap pixmap;
 	bool packetable;
 public:
-	Sampler(Float *abuffer, int &aw, int &ah):
-		buffer(abuffer), w(aw), h(ah), packetable(false) {};
+	Sampler(Float *buffer, const int &w, const int &h):
+		pixmap(buffer, w, h), packetable(false) {};
+	Sampler(const int &w, const int &h):
+		pixmap(w, h), packetable(false) {};
 	virtual ~Sampler() {};
-	void resetBuffer(Float *abuffer, int &aw, int &ah) { buffer = abuffer; w = aw; h = ah; };
+	void resetBuffer(Float *buffer, int &w, int &h)
+		{ pixmap.setData(buffer, w, h); };
 	virtual void init() = 0;
 	virtual int initSampleSet() = 0;
 	virtual bool nextSample(Sample *s) = 0;
 	virtual void saveSample(Sample &samp, Colour &col) = 0;
 	bool packetableSamples() { return packetable; };
+	const Pixmap &getPixmap() { return pixmap; };
 };
 
 /**
@@ -82,8 +87,10 @@
 	int oversample; // 0 = no, 1 = 4x, 2 = 9x, 3 = 16x
 	int sx,sy,osa_samp; // current sample properties
 public:
-	DefaultSampler(Float *abuffer, int &aw, int &ah):
-		Sampler(abuffer, aw, ah), phase(-1), subsample(0), oversample(0) {};
+	DefaultSampler(Float *buffer, const int &w, const int &h):
+		Sampler(buffer, w, h), phase(-1), subsample(0), oversample(0) {};
+	DefaultSampler(const int &w, const int &h):
+		Sampler(w, h), phase(-1), subsample(0), oversample(0) {};
 	void init();
 	int initSampleSet();
 	bool nextSample(Sample *s);