mirror of
https://github.com/Dasharo/edk2-upstream.git
synced 2026-06-13 19:16:19 -07:00
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.
`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.
Compared to macro-based include guards, `#pragma once`:
- Eliminates the risk of macro name collisions or copy/paste errors
where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
(e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
file entirely, rather than re-reading it to find the matching
`#endif` ("multiple-include optimization").
- Note that some compilers may already optimize traditional include
guards, by recognzining the idiomatic pattern.
This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.
However, this is considered acceptable given:
1. edk2 already defines a subset of supported compilers in
BaseTools/Conf/tools_def.template, all of which have supported
`#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
include guard naming and potential macro collisions.
Approximate compiler support dates:
- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
(http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
85 lines
3.6 KiB
C
85 lines
3.6 KiB
C
/** @file
|
|
Library for performing UEFI GOP Blt operations on a framebuffer
|
|
|
|
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#pragma once
|
|
|
|
#include <Protocol/GraphicsOutput.h>
|
|
|
|
//
|
|
// Opaque structure for the frame buffer configure.
|
|
//
|
|
typedef struct FRAME_BUFFER_CONFIGURE FRAME_BUFFER_CONFIGURE;
|
|
|
|
/**
|
|
Create the configuration for a video frame buffer.
|
|
|
|
The configuration is returned in the caller provided buffer.
|
|
|
|
@param[in] FrameBuffer Pointer to the start of the frame buffer.
|
|
@param[in] FrameBufferInfo Describes the frame buffer characteristics.
|
|
@param[in,out] Configure The created configuration information.
|
|
@param[in,out] ConfigureSize Size of the configuration information.
|
|
|
|
@retval RETURN_SUCCESS The configuration was successful created.
|
|
@retval RETURN_BUFFER_TOO_SMALL The Configure is to too small. The required
|
|
size is returned in ConfigureSize.
|
|
@retval RETURN_UNSUPPORTED The requested mode is not supported by
|
|
this implementaion.
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
FrameBufferBltConfigure (
|
|
IN VOID *FrameBuffer,
|
|
IN EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *FrameBufferInfo,
|
|
IN OUT FRAME_BUFFER_CONFIGURE *Configure,
|
|
IN OUT UINTN *ConfigureSize
|
|
);
|
|
|
|
/**
|
|
Performs a UEFI Graphics Output Protocol Blt operation.
|
|
|
|
@param[in] Configure Pointer to a configuration which was successfully
|
|
created by FrameBufferBltConfigure ().
|
|
@param[in,out] BltBuffer The data to transfer to screen.
|
|
@param[in] BltOperation The operation to perform.
|
|
@param[in] SourceX The X coordinate of the source for BltOperation.
|
|
@param[in] SourceY The Y coordinate of the source for BltOperation.
|
|
@param[in] DestinationX The X coordinate of the destination for
|
|
BltOperation.
|
|
@param[in] DestinationY The Y coordinate of the destination for
|
|
BltOperation.
|
|
@param[in] Width The width of a rectangle in the blt rectangle
|
|
in pixels.
|
|
@param[in] Height The height of a rectangle in the blt rectangle
|
|
in pixels.
|
|
@param[in] Delta Not used for EfiBltVideoFill and
|
|
EfiBltVideoToVideo operation. If a Delta of 0
|
|
is used, the entire BltBuffer will be operated
|
|
on. If a subrectangle of the BltBuffer is
|
|
used, then Delta represents the number of
|
|
bytes in a row of the BltBuffer.
|
|
|
|
@retval RETURN_INVALID_PARAMETER Invalid parameter were passed in.
|
|
@retval RETURN_SUCCESS The Blt operation was performed successfully.
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
FrameBufferBlt (
|
|
IN FRAME_BUFFER_CONFIGURE *Configure,
|
|
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
|
|
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
|
|
IN UINTN SourceX,
|
|
IN UINTN SourceY,
|
|
IN UINTN DestinationX,
|
|
IN UINTN DestinationY,
|
|
IN UINTN Width,
|
|
IN UINTN Height,
|
|
IN UINTN Delta
|
|
);
|