From 39d5d3a1cf39c35a4ab75a50be5b965ca833cdfd Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 10 Jan 2022 08:14:40 +0300 Subject: [PATCH] Moved some photo editor files to td_ui. --- Telegram/CMakeLists.txt | 17 ----------------- .../editor/scene/scene_item_canvas.cpp | 12 ++++++------ .../editor/scene/scene_item_line.cpp | 2 +- Telegram/cmake/td_ui.cmake | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 3b4c44ffc1..8746eda8d5 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -525,33 +525,16 @@ PRIVATE editor/controllers/controllers.h editor/controllers/stickers_panel_controller.cpp editor/controllers/stickers_panel_controller.h - editor/controllers/undo_controller.cpp - editor/controllers/undo_controller.h - editor/editor_crop.cpp - editor/editor_crop.h editor/editor_paint.cpp editor/editor_paint.h editor/photo_editor.cpp editor/photo_editor.h - editor/photo_editor_common.cpp - editor/photo_editor_common.h editor/photo_editor_content.cpp editor/photo_editor_content.h editor/photo_editor_controls.cpp editor/photo_editor_controls.h - editor/photo_editor_inner_common.h editor/photo_editor_layer_widget.cpp editor/photo_editor_layer_widget.h - editor/scene/scene.cpp - editor/scene/scene.h - editor/scene/scene_item_base.cpp - editor/scene/scene_item_base.h - editor/scene/scene_item_canvas.cpp - editor/scene/scene_item_canvas.h - editor/scene/scene_item_image.cpp - editor/scene/scene_item_image.h - editor/scene/scene_item_line.cpp - editor/scene/scene_item_line.h editor/scene/scene_item_sticker.cpp editor/scene/scene_item_sticker.h export/export_manager.cpp diff --git a/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp b/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp index 14df4ed65c..21b7266f36 100644 --- a/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp +++ b/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp @@ -86,8 +86,8 @@ void ItemCanvas::clearPixmap() { _p = nullptr; _pixmap = QPixmap( - (scene()->sceneRect().size() * cIntRetinaFactor()).toSize()); - _pixmap.setDevicePixelRatio(cRetinaFactor()); + (scene()->sceneRect().size() * style::DevicePixelRatio()).toSize()); + _pixmap.setDevicePixelRatio(style::DevicePixelRatio()); _pixmap.fill(Qt::transparent); _p = std::make_unique(&_pixmap); @@ -170,10 +170,10 @@ void ItemCanvas::handleMouseReleaseEvent( if (_contentRect.isValid()) { const auto scaledContentRect = QRectF( - _contentRect.x() * cRetinaFactor(), - _contentRect.y() * cRetinaFactor(), - _contentRect.width() * cRetinaFactor(), - _contentRect.height() * cRetinaFactor()); + _contentRect.x() * style::DevicePixelRatio(), + _contentRect.y() * style::DevicePixelRatio(), + _contentRect.width() * style::DevicePixelRatio(), + _contentRect.height() * style::DevicePixelRatio()); _grabContentRequests.fire({ .pixmap = _pixmap.copy(scaledContentRect.toRect()), diff --git a/Telegram/SourceFiles/editor/scene/scene_item_line.cpp b/Telegram/SourceFiles/editor/scene/scene_item_line.cpp index 3ebf394a54..0d40e24c7d 100644 --- a/Telegram/SourceFiles/editor/scene/scene_item_line.cpp +++ b/Telegram/SourceFiles/editor/scene/scene_item_line.cpp @@ -13,7 +13,7 @@ namespace Editor { ItemLine::ItemLine(const QPixmap &&pixmap) : _pixmap(std::move(pixmap)) -, _rect(QPointF(), _pixmap.size() / cRetinaFactor()) { +, _rect(QPointF(), _pixmap.size() / float64(style::DevicePixelRatio())) { } QRectF ItemLine::boundingRect() const { diff --git a/Telegram/cmake/td_ui.cmake b/Telegram/cmake/td_ui.cmake index 5ab2f6b1bd..90aef77581 100644 --- a/Telegram/cmake/td_ui.cmake +++ b/Telegram/cmake/td_ui.cmake @@ -63,6 +63,24 @@ PRIVATE countries/countries_instance.cpp countries/countries_instance.h + editor/controllers/undo_controller.cpp + editor/controllers/undo_controller.h + editor/editor_crop.cpp + editor/editor_crop.h + editor/photo_editor_common.cpp + editor/photo_editor_common.h + editor/photo_editor_inner_common.h + editor/scene/scene.cpp + editor/scene/scene.h + editor/scene/scene_item_base.cpp + editor/scene/scene_item_base.h + editor/scene/scene_item_canvas.cpp + editor/scene/scene_item_canvas.h + editor/scene/scene_item_image.cpp + editor/scene/scene_item_image.h + editor/scene/scene_item_line.cpp + editor/scene/scene_item_line.h + layout/abstract_layout_item.cpp layout/abstract_layout_item.h layout/layout_mosaic.cpp