Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
scoped_select_object.h
Go to the documentation of this file.
1// Copyright 2024 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CORE_FXCRT_WIN_SCOPED_SELECT_OBJECT_H_
6#define CORE_FXCRT_WIN_SCOPED_SELECT_OBJECT_H_
7
8#include <windows.h>
9
10#include "core/fxcrt/check.h"
11
12namespace pdfium {
13
14// Helper class for deselecting object from DC.
16 public:
17 ScopedSelectObject(HDC hdc, HGDIOBJ object)
19 DCHECK(hdc_);
20 DCHECK(object);
21 DCHECK(oldobj_);
22 DCHECK(oldobj_ != HGDI_ERROR);
23 }
24
27
29 [[maybe_unused]] HGDIOBJ object = SelectObject(hdc_, oldobj_);
30 DCHECK((GetObjectType(oldobj_) != OBJ_REGION && object) ||
31 (GetObjectType(oldobj_) == OBJ_REGION && object != HGDI_ERROR));
32 }
33
34 private:
35 const HDC hdc_;
36 const HGDIOBJ oldobj_;
37};
38
39} // namespace pdfium
40
41#endif // CORE_FXCRT_WIN_SCOPED_SELECT_OBJECT_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
void * GetSubstFont(const ByteString &face)
void * FindFont(int weight, bool bItalic, FX_Charset charset, int pitch_family, const ByteString &family, bool bMatchName)
static CFX_GEModule * Get()
const char ** GetUserFontPaths() const
std::unique_ptr< SystemFontInfoIface > CreateDefaultSystemFontInfo() override
void Init() override
~CWin32Platform() override
bool EqualNoCase(ByteStringView str) const
ByteString()=default
ByteString & operator+=(const char *str)
ByteString & operator=(const char *str)
bool operator!=(const char *ptr) const
Definition bytestring.h:65
bool operator==(const WideString &other) const
static WideString FromDefANSI(ByteStringView str)
WideString(const wchar_t *ptr)
ScopedSelectObject(HDC hdc, HGDIOBJ object)
ScopedSelectObject & operator=(const ScopedSelectObject &)=delete
ScopedSelectObject(const ScopedSelectObject &)=delete
#define UNSAFE_TODO(...)
FX_Charset
Definition fx_codepage.h:71
@ kChineseTraditional
Definition fx_codepage.h:91
@ kChineseSimplified
Definition fx_codepage.h:90
constexpr uint32_t FXBSTR_ID(uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4)
Definition fx_string.h:19
uint32_t FromBE32(uint32_t x)
Definition byteorder.h:82
bool IsUser32AndGdi32Available()
Definition win_util.cc:12
fxcrt::ByteStringView ByteStringView
fxcrt::WideString WideString
Definition widestring.h:207