From c9b371f5d8cb860542bd236650bcd8d437e4e8e7 Mon Sep 17 00:00:00 2001 From: alexge50 Date: Fri, 14 Jun 2019 06:53:02 +0300 Subject: [PATCH 01/12] replaced std::vector with raw owned pointer --- modules/include/types/Image.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/modules/include/types/Image.h b/modules/include/types/Image.h index 83d8995..dbcb1ba 100644 --- a/modules/include/types/Image.h +++ b/modules/include/types/Image.h @@ -19,22 +19,39 @@ class Image Image(unsigned width, unsigned height): width{width}, height{height}, - data(N_CHANNELS * width * height) + data{new uint8_t[N_CHANNELS * width * height]} {} Image(const uint8_t* data, unsigned width, unsigned height): width{width}, height{height}, - data(N_CHANNELS * width * height) + data{new uint8_t[N_CHANNELS * width * height]} { - std::memcpy(this->data.data(), data, N_CHANNELS * width * height); + std::memcpy(this->data, data, N_CHANNELS * width * height); } - Image(std::vector data, unsigned width, unsigned height): + Image(const std::vector& vecdata, unsigned width, unsigned height): width{width}, height{height}, - data{std::move(data)} - {} + data{new uint8_t[N_CHANNELS * width * height]} + { + std::memcpy(data, vecdata.data(), N_CHANNELS * width * height); + } + + Image(const Image& other): + width{other.width}, + height{other.height}, + data{new uint8_t[N_CHANNELS * width * height]} + { + std::memcpy(data, other.data, N_CHANNELS * width * height); + } + + Image(Image&&) = default; + + ~Image() + { + delete[] data; + } Color pixelAt(unsigned row, unsigned column) const { @@ -53,7 +70,7 @@ class Image auto width_() { return width; } auto height_() { return height; } - const uint8_t* raw() const { return data.data(); } + const uint8_t* raw() const { return data; } private: std::size_t index(unsigned row, unsigned column) const @@ -62,7 +79,7 @@ class Image } private: - std::vector data; + uint8_t* data; }; #endif //MODULES_IMAGE_H From c5d206346f7c4b373140488dab0022a73018d1af Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:06:16 +0300 Subject: [PATCH 02/12] Create Dockerfile --- ci/Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ci/Dockerfile diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000..9c1ce3c --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:19.04 + +RUN apt-get update +RUN apt-get install -qq -y --no-install-recommends \ + cmake \ + g++ \ + make \ + python3 \ + libboost-dev \ + libboost-python1.67-dev \ + qt5-default \ + xvfb + +ENTRYPOINT ["/bin/bash"] From d123dc77521b9f0607d0adc9392906f6b41266ba Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:08:36 +0300 Subject: [PATCH 03/12] Create build-docker --- ci/build-docker | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 ci/build-docker diff --git a/ci/build-docker b/ci/build-docker new file mode 100644 index 0000000..864d38b --- /dev/null +++ b/ci/build-docker @@ -0,0 +1,4 @@ +#!/bin/bash +set -ev +cd $(dirname $0) +docker build -t gie:1 . From 770540cba2703b496f09ad39c6b07aab362ea6a4 Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:22:43 +0300 Subject: [PATCH 04/12] Create build-app --- ci/build-app | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ci/build-app diff --git a/ci/build-app b/ci/build-app new file mode 100644 index 0000000..762ee49 --- /dev/null +++ b/ci/build-app @@ -0,0 +1,16 @@ +#!/bin/bash +set -ev + +cd $(dirname $0)/.. +SOURCE_DIR=$PWD +DIST_DIR=$PWD/dist + +cd /tmp +cd $(mktemp -d cibuild.XXXXXX) + +BUILD_DIR=$PWD/build + +cd $BUILD_DIR +cmake .. +cmake --build . --target gie_test +./gie/gie_test From 22a5044f9dc053f2e5369dcad073fa9018570134 Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:24:52 +0300 Subject: [PATCH 05/12] Create .travis.yml --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3c7ded3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +dist: xenial +language: minimal + +services: + - docker + +install: + - ci/build-docker + +script: + - docker run -v $PWD:/root/gie gie:1 /root/gie/ci/build-app From 7696284067fcac88be9c8af182341e89f4900985 Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:33:20 +0300 Subject: [PATCH 06/12] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3c7ded3..1775b8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ services: - docker install: - - ci/build-docker + - ./ci/build-docker script: - docker run -v $PWD:/root/gie gie:1 /root/gie/ci/build-app From b5a5cae20b75b3674d4c7e79c6afc37226a7f28a Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:34:58 +0300 Subject: [PATCH 07/12] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1775b8e..253b471 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ services: - docker install: + - chmod +x ./ci/build-docker - ./ci/build-docker script: From d16ac8d17d421c0a6a7657e51d31ddfd54dd9d40 Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:38:02 +0300 Subject: [PATCH 08/12] Update build-app --- ci/build-app | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/build-app b/ci/build-app index 762ee49..d070691 100644 --- a/ci/build-app +++ b/ci/build-app @@ -10,6 +10,7 @@ cd $(mktemp -d cibuild.XXXXXX) BUILD_DIR=$PWD/build +mkdir $BUILD_DIR cd $BUILD_DIR cmake .. cmake --build . --target gie_test From 5c6173d4663fec1473381c612ed46c50fd9fff52 Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:42:08 +0300 Subject: [PATCH 09/12] Update build-app --- ci/build-app | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/build-app b/ci/build-app index d070691..28ec5f2 100644 --- a/ci/build-app +++ b/ci/build-app @@ -8,6 +8,8 @@ DIST_DIR=$PWD/dist cd /tmp cd $(mktemp -d cibuild.XXXXXX) +cp -R $(SOURCE_DIR)/* $PWD + BUILD_DIR=$PWD/build mkdir $BUILD_DIR From 809b558bf8610a7caa055542ecc24413c58f76ce Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:45:16 +0300 Subject: [PATCH 10/12] Update build-app --- ci/build-app | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ci/build-app b/ci/build-app index 28ec5f2..002824a 100644 --- a/ci/build-app +++ b/ci/build-app @@ -5,11 +5,6 @@ cd $(dirname $0)/.. SOURCE_DIR=$PWD DIST_DIR=$PWD/dist -cd /tmp -cd $(mktemp -d cibuild.XXXXXX) - -cp -R $(SOURCE_DIR)/* $PWD - BUILD_DIR=$PWD/build mkdir $BUILD_DIR From d076b06583199b6ed01b3cdca9f424513fc641c1 Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:48:50 +0300 Subject: [PATCH 11/12] Update Dockerfile --- ci/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/Dockerfile b/ci/Dockerfile index 9c1ce3c..dd06ae0 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -9,6 +9,7 @@ RUN apt-get install -qq -y --no-install-recommends \ libboost-dev \ libboost-python1.67-dev \ qt5-default \ + libqt5opengl5-dev \ xvfb ENTRYPOINT ["/bin/bash"] From 221dbe378bbb1fc3c9eda4a8b7d5463564a8427b Mon Sep 17 00:00:00 2001 From: alexge50 Date: Sun, 14 Jul 2019 00:52:46 +0300 Subject: [PATCH 12/12] Update build-app --- ci/build-app | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/build-app b/ci/build-app index 002824a..e1aa71a 100644 --- a/ci/build-app +++ b/ci/build-app @@ -11,4 +11,5 @@ mkdir $BUILD_DIR cd $BUILD_DIR cmake .. cmake --build . --target gie_test -./gie/gie_test +cd gie +./gie_test