ext/rqr/qr_draw_jpeg.cpp in z-rqr-0.2.3 vs ext/rqr/qr_draw_jpeg.cpp in z-rqr-0.2.4

- old
+ new

@@ -1,47 +1,20 @@ #include "qr_draw_jpeg.h" -//================================================================================= -// QRDrawJPEG::QRDrawJPEG -//================================================================================= -QRDrawJPEG::QRDrawJPEG() -{ -#ifdef USE_JPG - bit_image = NULL; -#endif -} - -//================================================================================= -// QRDrawJPEG::~QRDrawJPEG -//================================================================================= -QRDrawJPEG::~QRDrawJPEG() -{ -#ifdef USE_JPG - int i; - - if(bit_image){ - for(i=0; i<this->rsize; i++){ - free(bit_image[i]); - } - free(bit_image); - } -#endif -} - //============================================================================= // QRDrawJPEG::draw //============================================================================= int QRDrawJPEG::draw(char *filename, int modulesize, int symbolsize, unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt) { #ifdef USE_JPG setup(filename, modulesize, symbolsize); - /* グレースケールイメージの構築 */ + /* O[XP[C[W̍\z */ if( this->raster(data) ) return(1); - /* JPEG書き出し */ + /* JPEGo */ if( this->write() ) return(1); return(0); #else return(1); @@ -54,25 +27,25 @@ int QRDrawJPEG::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) { #ifdef USE_JPG int i, j, k; - /* 実際にデータを置く領域を確保 */ + /* ۂɃf[^üm */ bit_image = (unsigned char **)malloc(sizeof(unsigned char *) * this->rsize); for(i=0; i<this->rsize; i++){ bit_image[i] = (unsigned char *)malloc(this->rsize); memset(bit_image[i], 0xFF, this->rsize); } for(i=0; i<this->ssize; i++){ for(j=0; j<this->ssize; j++){ - /* 1行分生成 */ + /* 1s */ for(k=0; k<this->msize; k++){ bit_image[(i+MARGIN_SIZE)*this->msize][ (j+MARGIN_SIZE)*this->msize + k ] = data[j][i] ? 0 : 255; } } - /* モジュールサイズ分縦方向に増やす */ + /* W[TCYcɑ₷ */ for(k=1; k<this->msize; k++){ memcpy(bit_image[(i+MARGIN_SIZE)*this->msize+k], bit_image[(i+MARGIN_SIZE)*this->msize], this->rsize); } } @@ -92,10 +65,10 @@ struct jpeg_error_mgr jerr; JSAMPROW row_pointer[1]; FILE *stream; int i; - /* 出力先設定 */ + /* o͐ݒ */ if(!this->filename){ stream = stdout; }else{ if( (stream=fopen(this->filename, "wb")) == NULL ) return(1); }