summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/image.cpp24
-rw-r--r--core/image.h1
-rw-r--r--core/os/dir_access.cpp6
-rw-r--r--core/os/dir_access.h4
-rw-r--r--core/ring_buffer.h17
5 files changed, 14 insertions, 38 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 2f2d7efd7c..11429b8782 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -47,7 +47,6 @@ const char *Image::format_names[Image::FORMAT_MAX] = {
"RGBA8",
"RGBA4444",
"RGBA5551",
- "RGB10A2",
"RFloat", //float
"RGFloat",
"RGBFloat",
@@ -113,7 +112,6 @@ int Image::get_format_pixel_size(Format p_format) {
case FORMAT_RGBA8: return 4;
case FORMAT_RGBA4444: return 2;
case FORMAT_RGBA5551: return 2;
- case FORMAT_RGB10A2: return 4;
case FORMAT_RF:
return 4; //float
case FORMAT_RGF: return 8;
@@ -1980,15 +1978,6 @@ Color Image::get_pixel(int p_x, int p_y) const {
float a = ((u >> 15) & 0x1) / 1.0;
return Color(r, g, b, a);
} break;
- case FORMAT_RGB10A2: {
-
- uint32_t u = ((uint32_t *)ptr)[ofs];
- float r = (u & 0x3FF) / 1023.0;
- float g = ((u >> 10) & 0x3FF) / 1023.0;
- float b = ((u >> 20) & 0x3FF) / 1023.0;
- float a = ((u >> 30) & 0x3) / 3.0;
- return Color(r, g, b, a);
- } break;
case FORMAT_RF: {
float r = ((float *)ptr)[ofs];
@@ -2134,18 +2123,6 @@ void Image::set_pixel(int p_x, int p_y, const Color &p_color) {
((uint16_t *)ptr)[ofs] = rgba;
} break;
- case FORMAT_RGB10A2: {
-
- uint32_t rgba = 0;
-
- rgba = uint32_t(CLAMP(p_color.r * 1023.0, 0, 1023));
- rgba |= uint32_t(CLAMP(p_color.g * 1023.0, 0, 1023)) << 10;
- rgba |= uint32_t(CLAMP(p_color.b * 1023.0, 0, 1023)) << 20;
- rgba |= uint32_t(CLAMP(p_color.a * 3.0, 0, 3)) << 30;
-
- ((uint32_t *)ptr)[ofs] = rgba;
-
- } break;
case FORMAT_RF: {
((float *)ptr)[ofs] = p_color.r;
@@ -2323,7 +2300,6 @@ void Image::_bind_methods() {
BIND_ENUM_CONSTANT(FORMAT_RGBA8);
BIND_ENUM_CONSTANT(FORMAT_RGBA4444);
BIND_ENUM_CONSTANT(FORMAT_RGBA5551);
- BIND_ENUM_CONSTANT(FORMAT_RGB10A2);
BIND_ENUM_CONSTANT(FORMAT_RF); //float
BIND_ENUM_CONSTANT(FORMAT_RGF);
BIND_ENUM_CONSTANT(FORMAT_RGBF);
diff --git a/core/image.h b/core/image.h
index efb62a6a29..767f3c6ac5 100644
--- a/core/image.h
+++ b/core/image.h
@@ -68,7 +68,6 @@ public:
FORMAT_RGBA8,
FORMAT_RGBA4444,
FORMAT_RGBA5551,
- FORMAT_RGB10A2,
FORMAT_RF, //float
FORMAT_RGF,
FORMAT_RGBF,
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index c906fa7333..eadb8e8546 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -293,7 +293,7 @@ String DirAccess::get_full_path(const String &p_path, AccessType p_access) {
return full;
}
-Error DirAccess::copy(String p_from, String p_to, int chmod_flags) {
+Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {
//printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data());
Error err;
@@ -330,9 +330,9 @@ Error DirAccess::copy(String p_from, String p_to, int chmod_flags) {
fdst->store_8(fsrc->get_8());
}
- if (err == OK && chmod_flags != -1) {
+ if (err == OK && p_chmod_flags != -1) {
fdst->close();
- err = fdst->_chmod(p_to, chmod_flags);
+ err = fdst->_chmod(p_to, p_chmod_flags);
// If running on a platform with no chmod support (i.e., Windows), don't fail
if (err == ERR_UNAVAILABLE)
err = OK;
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index f29f61e838..c94ced657b 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -92,8 +92,8 @@ public:
static bool exists(String p_dir);
virtual size_t get_space_left() = 0;
- Error copy_dir(String p_from, String p_to, int chmod_flags = -1);
- virtual Error copy(String p_from, String p_to, int chmod_flags = -1);
+ Error copy_dir(String p_from, String p_to, int p_chmod_flags = -1);
+ virtual Error copy(String p_from, String p_to, int p_chmod_flags = -1);
virtual Error rename(String p_from, String p_to) = 0;
virtual Error remove(String p_name) = 0;
diff --git a/core/ring_buffer.h b/core/ring_buffer.h
index 4b4a7fe9cf..c8562a0570 100644
--- a/core/ring_buffer.h
+++ b/core/ring_buffer.h
@@ -40,7 +40,7 @@ class RingBuffer {
int write_pos;
int size_mask;
- inline int inc(int &p_var, int p_size) {
+ inline int inc(int &p_var, int p_size) const {
int ret = p_var;
p_var += p_size;
p_var = p_var & size_mask;
@@ -50,7 +50,7 @@ class RingBuffer {
public:
T read() {
ERR_FAIL_COND_V(space_left() < 1, T());
- return data[inc(read_pos, 1)];
+ return data.ptr()[inc(read_pos, 1)];
};
int read(T *p_buf, int p_size, bool p_advance = true) {
@@ -63,8 +63,9 @@ public:
int end = pos + to_read;
end = MIN(end, size());
int total = end - pos;
+ const T *read = data.ptr();
for (int i = 0; i < total; i++) {
- p_buf[dst++] = data[pos + i];
+ p_buf[dst++] = read[pos + i];
};
to_read -= total;
pos = 0;
@@ -75,7 +76,7 @@ public:
return p_size;
};
- int copy(T *p_buf, int p_offset, int p_size) {
+ int copy(T *p_buf, int p_offset, int p_size) const {
int left = data_left();
if ((p_offset + p_size) > left) {
@@ -101,7 +102,7 @@ public:
return p_size;
};
- int find(const T &t, int p_offset, int p_max_size) {
+ int find(const T &t, int p_offset, int p_max_size) const {
int left = data_left();
if ((p_offset + p_max_size) > left) {
@@ -164,7 +165,7 @@ public:
return p_size;
};
- inline int space_left() {
+ inline int space_left() const {
int left = read_pos - write_pos;
if (left < 0) {
return size() + left - 1;
@@ -174,11 +175,11 @@ public:
};
return left - 1;
};
- inline int data_left() {
+ inline int data_left() const {
return size() - space_left() - 1;
};
- inline int size() {
+ inline int size() const {
return data.size();
};