FreeRDP
Loading...
Searching...
No Matches
SdlBlendModeGuard Class Reference

#include <sdl_blend_mode_guard.hpp>

Public Member Functions

 SdlBlendModeGuard (const std::shared_ptr< SDL_Renderer > &renderer, SDL_BlendMode mode=SDL_BLENDMODE_NONE)
 
 SdlBlendModeGuard (SdlBlendModeGuard &&other) noexcept
 
 SdlBlendModeGuard (const SdlBlendModeGuard &other)=delete
 
SdlBlendModeGuardoperator= (const SdlBlendModeGuard &other)=delete
 
SdlBlendModeGuardoperator= (SdlBlendModeGuard &&other)=delete
 
bool update (SDL_BlendMode mode)
 

Detailed Description

FreeRDP: A Remote Desktop Protocol Implementation SDL Client helper dialogs

Copyright 2025 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2025 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 27 of file sdl_blend_mode_guard.hpp.

Constructor & Destructor Documentation

◆ SdlBlendModeGuard()

SdlBlendModeGuard::SdlBlendModeGuard ( const std::shared_ptr< SDL_Renderer > &  renderer,
SDL_BlendMode  mode = SDL_BLENDMODE_NONE 
)
explicit

Definition at line 3 of file sdl_blend_mode_guard.cpp.

5 : _renderer(renderer)
6{
7 const auto rcb = SDL_GetRenderDrawBlendMode(_renderer.get(), &_restore_mode);
8 if (!rcb)
9 SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
10 "[%s] SDL_GetRenderDrawBlendMode() failed with %s", __func__, SDL_GetError());
11 else
12 {
13 const auto rbm = SDL_SetRenderDrawBlendMode(_renderer.get(), mode);
14 if (!rbm)
15 SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
16 "[%s] SDL_SetRenderDrawBlendMode() failed with %s", __func__,
17 SDL_GetError());
18 else
19 _current_mode = mode;
20 }
21}

◆ ~SdlBlendModeGuard()

SdlBlendModeGuard::~SdlBlendModeGuard ( )

Definition at line 39 of file sdl_blend_mode_guard.cpp.

40{
41 const auto rbm = SDL_SetRenderDrawBlendMode(_renderer.get(), _restore_mode);
42 if (!rbm)
43 SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
44 "[%s] SDL_SetRenderDrawBlendMode() failed with %s", __func__, SDL_GetError());
45}

Member Function Documentation

◆ update()

bool SdlBlendModeGuard::update ( SDL_BlendMode  mode)

Definition at line 23 of file sdl_blend_mode_guard.cpp.

24{
25 if (_current_mode != mode)
26 {
27 if (!SDL_SetRenderDrawBlendMode(_renderer.get(), mode))
28 {
29 SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
30 "[%s] SDL_SetRenderDrawBlendMode() failed with %s", __func__,
31 SDL_GetError());
32 return false;
33 }
34 _current_mode = mode;
35 }
36 return true;
37}

The documentation for this class was generated from the following files: