X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgrabber.cpp;h=c7f34ab92d8e002c59d66cca1bd45cc33b410b9a;hb=a34325fadec5b2be003bf9af1f081bfc4c83e8b6;hp=e56622f4d9949f21936358550a278d7a023e7cbd;hpb=a51c2557622ea93944e24f58845609526eb46ec1;p=gldbg.git diff --git a/source/grabber.cpp b/source/grabber.cpp index e56622f..c7f34ab 100644 --- a/source/grabber.cpp +++ b/source/grabber.cpp @@ -1,21 +1,14 @@ -/* $Id$ - -This file is part of gldbg -Copyright © 2011 Mikko Rasa, Mikkosoft Productions -Distributed under the GPL -*/ - #include +#include #include -#include #include "arraysize.h" #include "breakpoint.h" #include "functions.h" #include "gldbg.h" #include "grabber.h" +#include "strformat.h" using namespace std; -using namespace Msp; Grabber::Grabber(GlDbg &g): gldbg(g), @@ -46,6 +39,11 @@ Grabber::Grabber(GlDbg &g): flavor_init(); } +Grabber::~Grabber() +{ + gldecoder_delete(decoder); +} + void Grabber::decode(const char *data, unsigned len) { gldecoder_decode(decoder, data, len); @@ -124,7 +122,7 @@ void Grabber::cmd_autograb(const string &args) } } else - throw InvalidParameterValue("Invalid autograb mode"); + throw runtime_error("Invalid autograb mode"); } void Grabber::grab() @@ -220,13 +218,13 @@ void Grabber::glReadPixels(void *user_data, int, int, int width, int height, GLe { Grabber *self = reinterpret_cast(user_data); - string fn = Msp::format("grab-%04d-%04d.png", self->frame_num, self->grab_num); + string fn = strformat("grab-%04d-%04d.png", self->frame_num, self->grab_num); if(format==GL_RGBA && type==GL_UNSIGNED_BYTE) { if(self->write_png(fn, width, height, data)<0) - IO::print("Failed to write png file %s\n", fn); + printf("Failed to write png file %s\n", fn.c_str()); else - IO::print("Grabbed %dx%d png image to %s\n", width, height, fn); + printf("Grabbed %dx%d png image to %s\n", width, height, fn.c_str()); } ++self->grab_num;