Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default C++/WinRT settings (remove WINRT_NO_MAKE_DETECTION) #42

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,12 @@
NOMINMAX: Prevent that the Windows SDK header files define the macros min and max (conflict with C++ std::min\max).

* WINRT *
WINRT_NO_MAKE_DETECTION: Enable making COM class implementation final
_SILENCE_CLANG_COROUTINE_MESSAGE: Supress warning that coroutine is not compatible wih clang (clang-tidy fix)
WINRT_LEAN_AND_MEAN: Disables rarely-used features (in order to reduce compile times)

* Secure C Runtime *
__STDC_WANT_SECURE_LIB__=1;
-->
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;NOSERVICE;NOMCX;NOIME;NOMINMAX;WINRT_NO_MAKE_DETECTION;_SILENCE_CLANG_COROUTINE_MESSAGE;__STDC_WANT_SECURE_LIB__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;NOSERVICE;NOMCX;NOIME;NOMINMAX;WINRT_LEAN_AND_MEAN;__STDC_WANT_SECURE_LIB__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<PrecompiledHeader>NotUsing</PrecompiledHeader>

Expand Down
1 change: 1 addition & 0 deletions netpbm-wic-codec.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClangTidyBugproneBranchClone/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=anymap/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bugprone/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CLSID/@EntryIndexedValue">True</s:Boolean>
Expand Down
5 changes: 3 additions & 2 deletions src/netpbm_bitmap_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ using winrt::check_hresult;
using winrt::com_ptr;
using winrt::to_hresult;

namespace {

class netpbm_bitmap_decoder final : public winrt::implements<netpbm_bitmap_decoder, IWICBitmapDecoder>
struct netpbm_bitmap_decoder : winrt::implements<netpbm_bitmap_decoder, IWICBitmapDecoder>
{
public:
// IWICBitmapDecoder
HRESULT __stdcall QueryCapability(_In_ IStream* stream, _Out_ DWORD* capability) noexcept override
try
Expand Down Expand Up @@ -222,6 +222,7 @@ class netpbm_bitmap_decoder final : public winrt::implements<netpbm_bitmap_decod
com_ptr<IWICBitmapFrameDecode> bitmap_frame_decode_;
};

} // namespace

void create_netpbm_bitmap_decoder_factory(GUID const& interface_id, void** result)
{
Expand Down
14 changes: 5 additions & 9 deletions src/netpbm_bitmap_frame_decode.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,22 @@ import <std.h>;
import <win.h>;
import winrt;

export class netpbm_bitmap_frame_decode final
: public winrt::implements<netpbm_bitmap_frame_decode, IWICBitmapFrameDecode, IWICBitmapSource>
export struct netpbm_bitmap_frame_decode
: winrt::implements<netpbm_bitmap_frame_decode, IWICBitmapFrameDecode, IWICBitmapSource>
{
public:
netpbm_bitmap_frame_decode(_In_ IStream* source_stream, _In_ IWICImagingFactory* factory);

// IWICBitmapSource
HRESULT __stdcall GetSize(uint32_t* width, uint32_t* height) override;
HRESULT __stdcall GetPixelFormat(GUID* pixel_format) override;
HRESULT __stdcall GetResolution(double* dpi_x, double* dpi_y) override;
HRESULT __stdcall CopyPixels(const WICRect* rectangle, uint32_t stride, uint32_t buffer_size,
BYTE* buffer) override;
HRESULT __stdcall CopyPixels(const WICRect* rectangle, uint32_t stride, uint32_t buffer_size, BYTE* buffer) override;
HRESULT __stdcall CopyPalette(IWICPalette*) noexcept override;

// IWICBitmapFrameDecode : IWICBitmapSource
HRESULT __stdcall GetThumbnail(IWICBitmapSource**) noexcept override;
HRESULT __stdcall GetColorContexts(uint32_t count, IWICColorContext** color_contexts,
uint32_t* actual_count) override;
HRESULT __stdcall GetMetadataQueryReader(IWICMetadataQueryReader** metadata_query_reader)
noexcept override;
HRESULT __stdcall GetColorContexts(uint32_t count, IWICColorContext** color_contexts, uint32_t* actual_count) override;
HRESULT __stdcall GetMetadataQueryReader(IWICMetadataQueryReader** metadata_query_reader) noexcept override;

private:
winrt::com_ptr<IWICBitmapSource> bitmap_source_;
Expand Down
3 changes: 1 addition & 2 deletions test/test_stream.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import test.winrt;

import test.errors;

export class test_stream final : public winrt::implements<test_stream, IStream>
export struct test_stream : winrt::implements<test_stream, IStream>
{
public:
test_stream(const bool fail_on_read, int fail_on_seek_counter) noexcept :
fail_on_read_{fail_on_read}, fail_on_seek_counter_{fail_on_seek_counter}
{
Expand Down
Loading