Removal of Image from Variant, converted to a Resource.

This commit is contained in:
Juan Linietsky
2017-05-17 07:36:47 -03:00
parent d801ff2b3d
commit 98a3296702
110 changed files with 690 additions and 3203 deletions

View File

@ -178,7 +178,7 @@ void ColorPicker::_update_presets() {
}
}
Image i(size.x * presets.size(), size.y, false, Image::FORMAT_RGB8, img);
Ref<Image> i = memnew(Image(size.x * presets.size(), size.y, false, Image::FORMAT_RGB8, img));
Ref<ImageTexture> t;
t.instance();
@ -399,16 +399,16 @@ void ColorPicker::_screen_input(const InputEvent &ev) {
Viewport *r = get_tree()->get_root();
if (!r->get_visible_rect().has_point(Point2(mev.global_x, mev.global_y)))
return;
Image img = r->get_screen_capture();
if (!img.empty()) {
Ref<Image> img = r->get_screen_capture();
if (!img.is_null()) {
last_capture = img;
r->queue_screen_capture();
}
if (!last_capture.empty()) {
int pw = last_capture.get_format() == Image::FORMAT_RGBA8 ? 4 : 3;
int ofs = (mev.global_y * last_capture.get_width() + mev.global_x) * pw;
if (last_capture.is_valid() && !last_capture->empty()) {
int pw = last_capture->get_format() == Image::FORMAT_RGBA8 ? 4 : 3;
int ofs = (mev.global_y * last_capture->get_width() + mev.global_x) * pw;
PoolVector<uint8_t>::Read r = last_capture.get_data().read();
PoolVector<uint8_t>::Read r = last_capture->get_data().read();
Color c(r[ofs + 0] / 255.0, r[ofs + 1] / 255.0, r[ofs + 2] / 255.0);