summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/benoit/arghandl.cc7
-rw-r--r--src/benoit/plotmandelbrot.cc2
-rw-r--r--src/benoit/wrtimg.cc17
3 files changed, 13 insertions, 13 deletions
diff --git a/src/benoit/arghandl.cc b/src/benoit/arghandl.cc
index 5cae6ad..0b0b4cc 100644
--- a/src/benoit/arghandl.cc
+++ b/src/benoit/arghandl.cc
@@ -14,6 +14,7 @@
# include <benoit/logfuncret.hh>
# include <benoit/print.hh>
# include <benoit/t/imgfmt.hh>
+# include <charconv>
# include <fmt/core.h>
# include <string>
# include <unordered_map>
@@ -63,7 +64,7 @@ void benoit::arghandl(int const & argc,char const * * & argv) {
}
}
else if(obj == "height"s) {
- benoit::d::resy = std::stoi(val);
+ std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::resy);
if(benoit::d::resy > 0x10000) {
benoit::print(fmt::format("Argument “{}” sets the height to {}, but the maximum width is 65536.",arg,benoit::d::resy),true);
benoit::d::resy = 0x10000;
@@ -73,14 +74,14 @@ void benoit::arghandl(int const & argc,char const * * & argv) {
benoit::d::outimg = val;
}
else if(obj == "threads"s) {
- benoit::d::numthrds = std::stoi(val);
+ std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::numthrds);
if(benoit::d::numthrds > 0x10000) {
benoit::print(fmt::format("Argument “{}” sets the number of threads to {}, but the maximum number of threads is 65536."s,arg,benoit::d::numthrds),true);
benoit::d::numthrds = 0x10000;
}
}
else if(obj == "width"s) {
- benoit::d::resx = std::stoi(val);
+ std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::resx);
if(benoit::d::resx > 0x10000) {
benoit::print(fmt::format("Argument “{}” sets the width to {}, but the maximum width is 65536."s,arg,benoit::d::resx),true);
benoit::d::resx = 0x10000;
diff --git a/src/benoit/plotmandelbrot.cc b/src/benoit/plotmandelbrot.cc
index eb02ee9..bbc5f8a 100644
--- a/src/benoit/plotmandelbrot.cc
+++ b/src/benoit/plotmandelbrot.cc
@@ -24,6 +24,7 @@ namespace {
thrddat->img[px].r = *thrddat->thrdcol;
thrddat->img[px].g = *thrddat->thrdcol;
thrddat->img[px].b = *thrddat->thrdcol;
+ thrddat->img[px].a = 0xBF;
}
pthread_exit(nullptr);
}
@@ -68,6 +69,7 @@ std::vector<std::uint8_t> * benoit::plotmandelbrot() {
img->push_back(rgbaimg[pos].r);
img->push_back(rgbaimg[pos].g);
img->push_back(rgbaimg[pos].b);
+ img->push_back(rgbaimg[pos].a);
}
::delete rgbaimg;
benoit::logfuncret(funcname);
diff --git a/src/benoit/wrtimg.cc b/src/benoit/wrtimg.cc
index f0c12d0..0f10257 100644
--- a/src/benoit/wrtimg.cc
+++ b/src/benoit/wrtimg.cc
@@ -28,20 +28,17 @@ void benoit::wrtimg(std::vector<std::uint8_t> * img) {
case benoit::t::imgfmt::png:
break;
case benoit::t::imgfmt::webp:
- datsiz = WebPEncodeLosslessRGB(img->data(),benoit::d::resx,benoit::d::resy,(benoit::d::resx * 0x3),&dat);
+ datsiz = WebPEncodeLosslessRGBA(img->data(),benoit::d::resx,benoit::d::resy,(benoit::d::resx * 0x4),&dat);
break;
}
int file = ::open(benoit::d::outimg.c_str(),(O_CREAT | O_TRUNC | O_WRONLY),0x1B4);
- auto iterwrt = [](int & file,std::uint8_t * & dat,unsigned long long & datsiz) {
- for(unsigned long long pos = 0x0;(pos < datsiz);++pos) {
- ::ssize_t byteswrtn = ::write(file,&dat[pos],0x1);
- if(byteswrtn < 0x0) {
- benoit::print(fmt::format("Unable to write to “{}”."s,benoit::d::outimg));
- return;
- }
+ for(unsigned long long pos = 0x0;(pos < datsiz);++pos) {
+ ::ssize_t byteswrtn = ::write(file,&dat[pos],0x1);
+ if(byteswrtn < 0x0) {
+ benoit::print(fmt::format("Unable to write to “{}”."s,benoit::d::outimg));
+ return;
}
- };
- iterwrt(file,dat,datsiz);
+ }
delete dat;
delete img;
if(::close(file) < 0x0) {