[common, shortcutguide] move d2d files from common to scg (#7844)

Also remove d2d classes from common documentation
This commit is contained in:
Enrico Giordani 2020-11-05 10:38:46 +01:00 committed by GitHub
parent 1dc1531104
commit 50a8884c32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 39 additions and 54 deletions

View file

@ -9,15 +9,6 @@ Header-only asynchronous message queue. Used by `TwoWayPipeMessageIPC`.
#### class TwoWayPipeMessageIPC: [header](/src/common/two_way_pipe_message_ipc.h)
Header-only asynchronous IPC messaging class. Used by the runner to communicate with the settings window.
#### class D2DSVG: [header](/src/common/d2d_svg.h) [source](/src/common/d2d_svg.cpp)
Class for loading, rendering and for some basic modifications of SVG graphics.
#### class D2DText: [header](/src/common/d2d_text.h) [source](/src/common/d2d_text.cpp)
Class for rendering text using DirectX.
#### class D2DWindow: [header](/src/common/d2d_window.h) [source](/src/common/d2d_window.cpp)
Base class for creating borderless windows, with DirectX enabled rendering pipeline.
#### class DPIAware: [header](/src/common/dpi_aware.h) [source](/src/common/dpi_aware.cpp)
Helper class for creating DPI-aware applications.

View file

@ -123,9 +123,6 @@
<ClInclude Include="appMutex.h" />
<ClInclude Include="async_message_queue.h" />
<ClInclude Include="comUtils.h" />
<ClInclude Include="d2d_svg.h" />
<ClInclude Include="d2d_text.h" />
<ClInclude Include="d2d_window.h" />
<ClInclude Include="debug_control.h" />
<ClInclude Include="dpi_aware.h" />
<ClInclude Include="com_object_factory.h" />
@ -165,9 +162,6 @@
<ItemGroup>
<ClCompile Include="animation.cpp" />
<ClCompile Include="comUtils.cpp" />
<ClCompile Include="d2d_svg.cpp" />
<ClCompile Include="d2d_text.cpp" />
<ClCompile Include="d2d_window.cpp" />
<ClCompile Include="dpi_aware.cpp" />
<ClCompile Include="json.cpp" />
<ClCompile Include="keyboard_layout.cpp" />

View file

@ -9,23 +9,11 @@
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Header Files\Direct2D">
<UniqueIdentifier>{ed0f9961-6b12-408b-8dbc-fed779a557ac}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Telemetry">
<UniqueIdentifier>{3e9f944e-5d97-4a28-8865-2eff3a3568e7}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="d2d_svg.h">
<Filter>Header Files\Direct2D</Filter>
</ClInclude>
<ClInclude Include="d2d_text.h">
<Filter>Header Files\Direct2D</Filter>
</ClInclude>
<ClInclude Include="d2d_window.h">
<Filter>Header Files\Direct2D</Filter>
</ClInclude>
<ClInclude Include="pch.h" />
<ClInclude Include="animation.h">
<Filter>Header Files</Filter>
@ -146,15 +134,6 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="d2d_svg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d2d_text.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d2d_window.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pch.cpp" />
<ClCompile Include="animation.cpp">
<Filter>Source Files</Filter>

View file

@ -2,12 +2,7 @@
#include <winrt/base.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <Windows.h>
#include <dxgi1_3.h>
#include <d3d11_2.h>
#include <d2d1_3.h>
#include <d2d1_3helper.h>
#include <d2d1helper.h>
#include <dwrite.h>
#include <dcomp.h>
#include <dwmapi.h>
#include <Shobjidl.h>

View file

@ -71,7 +71,7 @@ ScaleResult D2DOverlaySVG::get_thumbnail_rect_and_scale(int x_offset, int y_offs
}
float scale_h = fill * thumbnail_scaled_rect_width / window_cx;
float scale_v = fill * thumbnail_scaled_rect_heigh / window_cy;
float use_scale = min(scale_h, scale_v);
float use_scale = std::min(scale_h, scale_v);
RECT thumb_rect;
thumb_rect.left = thumbnail_scaled_rect.left + (int)(thumbnail_scaled_rect_width - use_scale * window_cx) / 2 + x_offset;
thumb_rect.right = thumbnail_scaled_rect.right - (int)(thumbnail_scaled_rect_width - use_scale * window_cx) / 2 + x_offset;
@ -254,10 +254,10 @@ void D2DOverlayWindow::show(HWND active_window, bool snappable)
total_screen = ScreenSize(monitors[0].rect);
for (auto& monitor : monitors)
{
total_screen.rect.left = min(total_screen.rect.left, monitor.rect.left);
total_screen.rect.top = min(total_screen.rect.top, monitor.rect.top);
total_screen.rect.right = max(total_screen.rect.right, monitor.rect.right);
total_screen.rect.bottom = max(total_screen.rect.bottom, monitor.rect.bottom);
total_screen.rect.left = std::min(total_screen.rect.left, monitor.rect.left);
total_screen.rect.top = std::min(total_screen.rect.top, monitor.rect.top);
total_screen.rect.right = std::max(total_screen.rect.right, monitor.rect.right);
total_screen.rect.bottom = std::max(total_screen.rect.bottom, monitor.rect.bottom);
}
// make sure top-right corner of all the monitor rects is (0,0)
monitor_dx = -total_screen.left();
@ -693,10 +693,10 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
auto total_monitor_with_screen = total_screen;
if (thumb_window)
{
total_monitor_with_screen.rect.left = min(total_monitor_with_screen.rect.left, thumb_window->left + monitor_dx);
total_monitor_with_screen.rect.top = min(total_monitor_with_screen.rect.top, thumb_window->top + monitor_dy);
total_monitor_with_screen.rect.right = max(total_monitor_with_screen.rect.right, thumb_window->right + monitor_dx);
total_monitor_with_screen.rect.bottom = max(total_monitor_with_screen.rect.bottom, thumb_window->bottom + monitor_dy);
total_monitor_with_screen.rect.left = std::min(total_monitor_with_screen.rect.left, thumb_window->left + monitor_dx);
total_monitor_with_screen.rect.top = std::min(total_monitor_with_screen.rect.top, thumb_window->top + monitor_dy);
total_monitor_with_screen.rect.right = std::max(total_monitor_with_screen.rect.right, thumb_window->right + monitor_dx);
total_monitor_with_screen.rect.bottom = std::max(total_monitor_with_screen.rect.bottom, thumb_window->bottom + monitor_dy);
}
// Only allow the new rect being slight bigger.
if (total_monitor_with_screen.width() - total_screen.width() > (thumb_window->right - thumb_window->left) / 2 ||

View file

@ -1,7 +1,7 @@
#pragma once
#include "common/d2d_svg.h"
#include "common/d2d_window.h"
#include "common/d2d_text.h"
#include "d2d_svg.h"
#include "d2d_window.h"
#include "d2d_text.h"
#include "common/monitors.h"
#include "common/animation.h"
#include "common/windows_colors.h"

View file

@ -1,4 +1,5 @@
#pragma once
#define NOMINMAX
#include <winrt/base.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>

View file

@ -105,6 +105,9 @@
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="d2d_svg.h" />
<ClInclude Include="d2d_text.h" />
<ClInclude Include="d2d_window.h" />
<ClInclude Include="overlay_window.h" />
<ClInclude Include="keyboard_state.h" />
<ClInclude Include="Generated Files/resource.h" />
@ -116,6 +119,9 @@
<ClInclude Include="trace.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="d2d_svg.cpp" />
<ClCompile Include="d2d_text.cpp" />
<ClCompile Include="d2d_window.cpp" />
<ClCompile Include="overlay_window.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="keyboard_state.cpp" />

View file

@ -18,6 +18,15 @@
<ClCompile Include="trace.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d2d_svg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d2d_text.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="d2d_window.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
@ -39,6 +48,16 @@
<ClInclude Include="Generated Files/resource.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="ShortcutGuideConstants.h" />
<ClInclude Include="d2d_svg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="d2d_text.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="d2d_window.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">