summaryrefslogtreecommitdiff
path: root/core/variant_op.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant_op.cpp')
-rw-r--r--core/variant_op.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index f03ab43fce..6065094da7 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1354,7 +1354,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
return;
} else if (*str=="r8" ) {
valid=true;
- v->g=float(p_value)/255.0;
+ v->r=float(p_value)/255.0;
return;
} else if (*str=="g8" ) {
valid=true;
@@ -2213,16 +2213,16 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
return v->get_v();
} else if (*str=="r8") {
valid=true;
- return v->r*255.0;
+ return (int)Math::round(v->r*255.0);
} else if (*str=="g8" ) {
valid=true;
- return v->g*255.0;
+ return (int)Math::round(v->g*255.0);
} else if (*str=="b8" ) {
valid=true;
- return v->b*255.0;
+ return (int)Math::round(v->b*255.0);
} else if (*str=="a8" ) {
valid=true;
- return v->a*255.0;
+ return (int)Math::round(v->a*255.0);
}
} else if (p_index.get_type()==Variant::INT) {
@@ -3513,7 +3513,7 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r
case INT:{
int va=a._data._int;
int vb=b._data._int;
- r_dst=int((1.0-c) * va + vb * c + 0.5);
+ r_dst=int((1.0-c) * va + vb * c);
} return;
case REAL:{
real_t va=a._data._real;