update Image

This commit is contained in:
西风逍遥游 committed 2024-06-12 23:43:00 -07:00
1 parent f2e6173bca
commit 188751d93f
6 files changed
+578 -726

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
FROM ubuntu:20.04
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \
build-essential \
cmake \
ninja-build \
git openssh-server\
clang-12 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -ms /bin/bash evengine
# configure SSH for communication with Visual Studio Code
RUN mkdir -p /var/run/sshd
RUN echo 'evengine:evengine' | chpasswd \
&& sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
USER evengine
WORKDIR /home/evengine
EXPOSE 22
+24 -1
View File
@@ -1,3 +1,14 @@
INSIDE_DOCKER=$(shell [ -f /.dockerenv ] && echo 1 || echo 0 )
PWD = $(shell pwd)
ifeq ($(INSIDE_DOCKER), 0)
DOCKER = docker run -it --rm --volume="$(PWD):/home/evengine/src" evengine
DOCKER_START = docker run -it --volume="$(PWD):/home/evengine/src" evengine
else
DOCKER =
endif
.PHONY: all build/win32 build/linux build/win32-debug build/linux-debug
debug: build/win32-debug build/linux-debug
@@ -45,4 +56,16 @@ test/linux: build/linux
test/linux-debug: build/linux-debug
build/linux-debug/test/unit_test
# make: build/.build-docker
# $(DOCKER) /bin/bash -c "cmake -H./src -B./src/build && cmake --build src/build --parallel 8"
# deps: build/.build-docker
# $(DOCKER) /bin/bash -c "cd src/third-party && bash build.sh"
# start: build/.build-docker
# $(DOCKER_START) /bin/bash
# build/.build-docker: Dockerfile
# docker build . --tag evengine
# mkdir -p build && touch $@
+2 -1
View File
@@ -37,7 +37,8 @@ namespace eve
namespace image
{
love::Type Image::type("image", &Module::type);
Module_IMPL(Filesystem, new physfs::Filesystem());
Image::Image()
{
+5 -8
View File
@@ -2,7 +2,6 @@
#include "common/Module.h"
#include "image/ImageData.h"
#include "image/CompressedImageData.h"
#include "filesystem/File.h"
#include <list>
@@ -22,13 +21,11 @@ namespace image
class Image : public Module
{
public:
Module_REG(Image);
Image();
virtual ~Image();
// Implements Module.
ModuleType getModuleType() const override { return M_IMAGE; }
const char *getName() const override;
/**
* Creates new ImageData from FileData.
* @param data The FileData containing the encoded image data.
@@ -60,7 +57,7 @@ public:
* @param data The FileData containing the compressed image data.
* @return The new CompressedImageData.
**/
CompressedImageData *newCompressedData(Data *data);
// CompressedImageData *newCompressedData(Data *data);
/**
* Determines whether a FileData is Compressed image data or not.
@@ -68,8 +65,8 @@ public:
**/
bool isCompressed(Data *data);
std::vector<StrongRef<ImageData>> newCubeFaces(ImageData *src);
std::vector<StrongRef<ImageData>> newVolumeLayers(ImageData *src);
std::vector<ref<ImageData>> newCubeFaces(ImageData *src);
std::vector<ref<ImageData>> newVolumeLayers(ImageData *src);
const std::list<FormatHandler *> &getFormatHandlers() const;
File diff suppressed because it is too large. Load diff
+8 -9
View File
@@ -3,7 +3,6 @@
#include "common/Data.h"
#include "common/pixelformat.h"
#include "common/floattypes.h"
#include "common/Color.h"
#include "filesystem/FileData.h"
#include "thread/threads.h"
@@ -18,7 +17,7 @@ namespace image
/**
* Represents raw pixel data.
**/
class ImageData : public Object
class ImageData : public Resource
{
public:
@@ -36,8 +35,8 @@ public:
typedef void (*PixelGetFunction)(const Pixel *p, Colorf &c);
ImageData(Data *data);
ImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8);
ImageData(int width, int height, PixelFormat format, void *data, bool own);
ImageData(int width, int height, std::string format = "RGBA8");
ImageData(int width, int height, std::string format, void *data, bool own);
ImageData(const ImageData &c);
virtual ~ImageData();
@@ -97,11 +96,11 @@ public:
PixelSetFunction getPixelSetFunction() const { return pixelSetFunction; }
PixelGetFunction getPixelGetFunction() const { return pixelGetFunction; }
static bool validPixelFormat(PixelFormat format);
static bool canPaste(PixelFormat src, PixelFormat dst);
static bool validPixelFormat(std::string format);
static bool canPaste(std::string src, std::string dst);
static PixelSetFunction getPixelSetFunction(PixelFormat format);
static PixelGetFunction getPixelGetFunction(PixelFormat format);
static PixelSetFunction getPixelSetFunction(std::string format);
static PixelGetFunction getPixelGetFunction(std::string format);
static bool getConstant(const char *in, FormatHandler::EncodedFormat &out);
static bool getConstant(FormatHandler::EncodedFormat in, const char *&out);
@@ -110,7 +109,7 @@ public:
private:
// Create imagedata. Initialize with data if not null.
void create(int width, int height, PixelFormat format, void *data = nullptr);
void create(int width, int height, std::string format, void *data = nullptr);
// Decode and load an encoded format.
void decode(Data *data);