浏览代码

UI: Remove unnecessary shared_ptr allocations

Not sure why these were separate allocations -- the data will be
preserved just fine when copying the structure without being separate
allocations
jp9000 3 年之前
父节点
当前提交
2364dfd0ef
共有 3 个文件被更改,包括 5 次插入8 次删除
  1. 2 4
      UI/window-basic-main.cpp
  2. 2 2
      UI/window-basic-main.hpp
  3. 1 2
      UI/window-basic-source-select.cpp

+ 2 - 4
UI/window-basic-main.cpp

@@ -9062,10 +9062,8 @@ void OBSBasic::on_actionCopySource_triggered()
 
 
 		SourceCopyInfo copyInfo;
 		SourceCopyInfo copyInfo;
 		copyInfo.weak_source = OBSGetWeakRef(source);
 		copyInfo.weak_source = OBSGetWeakRef(source);
-		copyInfo.transform = std::make_shared<obs_transform_info>();
-		obs_sceneitem_get_info(item, copyInfo.transform.get());
-		copyInfo.crop = std::make_shared<obs_sceneitem_crop>();
-		obs_sceneitem_get_crop(item, copyInfo.crop.get());
+		obs_sceneitem_get_info(item, &copyInfo.transform);
+		obs_sceneitem_get_crop(item, &copyInfo.crop);
 		copyInfo.visible = obs_sceneitem_visible(item);
 		copyInfo.visible = obs_sceneitem_visible(item);
 
 
 		clipboard.push_back(copyInfo);
 		clipboard.push_back(copyInfo);

+ 2 - 2
UI/window-basic-main.hpp

@@ -92,8 +92,8 @@ struct SavedProjectorInfo {
 struct SourceCopyInfo {
 struct SourceCopyInfo {
 	OBSWeakSource weak_source;
 	OBSWeakSource weak_source;
 	bool visible;
 	bool visible;
-	std::shared_ptr<obs_sceneitem_crop> crop;
-	std::shared_ptr<obs_transform_info> transform;
+	obs_sceneitem_crop crop;
+	obs_transform_info transform;
 };
 };
 
 
 struct QuickTransition {
 struct QuickTransition {

+ 1 - 2
UI/window-basic-source-select.cpp

@@ -431,6 +431,5 @@ void OBSBasicSourceSelect::SourcePaste(SourceCopyInfo &info, bool dup)
 	if (!source)
 	if (!source)
 		return;
 		return;
 
 
-	AddExisting(source, info.visible, dup, info.transform.get(),
-		    info.crop.get());
+	AddExisting(source, info.visible, dup, &info.transform, &info.crop);
 }
 }