Skip to content

Commit

Permalink
Merge pull request #1 from alexge50/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
alexge50 authored Jul 13, 2019
2 parents 99b93b8 + 221dbe3 commit 46397d1
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dist: xenial
language: minimal

services:
- docker

install:
- chmod +x ./ci/build-docker
- ./ci/build-docker

script:
- docker run -v $PWD:/root/gie gie:1 /root/gie/ci/build-app
15 changes: 15 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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 \
libqt5opengl5-dev \
xvfb

ENTRYPOINT ["/bin/bash"]
15 changes: 15 additions & 0 deletions ci/build-app
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -ev

cd $(dirname $0)/..
SOURCE_DIR=$PWD
DIST_DIR=$PWD/dist

BUILD_DIR=$PWD/build

mkdir $BUILD_DIR
cd $BUILD_DIR
cmake ..
cmake --build . --target gie_test
cd gie
./gie_test
4 changes: 4 additions & 0 deletions ci/build-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -ev
cd $(dirname $0)
docker build -t gie:1 .
33 changes: 25 additions & 8 deletions modules/include/types/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t> data, unsigned width, unsigned height):
Image(const std::vector<uint8_t>& 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
{
Expand All @@ -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
Expand All @@ -62,7 +79,7 @@ class Image
}

private:
std::vector<uint8_t> data;
uint8_t* data;
};

#endif //MODULES_IMAGE_H

0 comments on commit 46397d1

Please sign in to comment.