init
This commit is contained in:
commit
2c2202e60d
2491 files changed
+1295990
No files matched your search
@@ -0,0 +1,192 @@
|
|||||||
|
# AGENTS.md
|
||||||
|
|
||||||
|
## Hardware
|
||||||
|
|
||||||
|
- **Board**: STM32H7S78-DK evaluation board
|
||||||
|
- **MCU**: STM32H7S78 (Cortex-M7 @ 480MHz)
|
||||||
|
- **Flash**: 2 MB external OSPI Flash (for Boot)
|
||||||
|
- **RAM**: 1 MB internal + external PSRAM (for Audio/Framebuffers)
|
||||||
|
|
||||||
|
## Project Architecture
|
||||||
|
|
||||||
|
### Dual-Boot Structure
|
||||||
|
|
||||||
|
This project uses a **dual-project architecture**:
|
||||||
|
|
||||||
|
| Project | Directory | Purpose |
|
||||||
|
|---------|-----------|---------|
|
||||||
|
| **Boot** | `/Boot/` | Bootloader - initializes hardware, loads application from external flash |
|
||||||
|
| **Appli** | `/Appli/` | Main application - TouchGFX UI + audio processing |
|
||||||
|
|
||||||
|
**Flashing order**: Boot must be flashed first, then Appli. After flashing Appli, press NRST button to start.
|
||||||
|
|
||||||
|
## Project Setup
|
||||||
|
|
||||||
|
- **IDE**: STM32CubeIDE with STM32CubeMX plugin
|
||||||
|
- **RTOS**: FreeRTOS V10.5.1 (CMSIS-RTOS V2)
|
||||||
|
- **GUI**: TouchGFX 4.26.1 with NemaGFX GPU acceleration
|
||||||
|
- **Language**: C/C++
|
||||||
|
- **Build System**: GCC Makefile (not CMake)
|
||||||
|
|
||||||
|
## Key Constraints
|
||||||
|
|
||||||
|
1. **Dual-boot flashing sequence**: Flash Boot first, then Appli. Press NRST after Appli flash.
|
||||||
|
2. **Never edit `Core/Src/` and `Core/Inc/` directly** - regenerate via STM32CubeMX instead
|
||||||
|
3. **High-speed audio acquisition (48kHz)** - uses DMA for ADF1 (microphone) and audio codec
|
||||||
|
4. **External memory usage**: Audio buffers (>900KB) stored in external PSRAM (section `AudioLooperBuffer`)
|
||||||
|
5. **TouchGFX architecture**: Two-stage debug - debug Boot first, then Appli
|
||||||
|
6. **FreeRTOS heap size**: Configured to 50KB in `FreeRTOSConfig.h` (heap_4)
|
||||||
|
7. **Interrupt priorities**: Audio interrupts at priority 2 (high priority), touch/SD at 14-15
|
||||||
|
|
||||||
|
## Build & Flash
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
- STM32CubeIDE (for CubeMX GUI, code generation)
|
||||||
|
- gcc-arm-embedded (`arm-none-eabi-gcc`)
|
||||||
|
- OpenOCD (for flashing)
|
||||||
|
- TouchGFX 4.26.1 (for GUI generation)
|
||||||
|
|
||||||
|
### Build Commands
|
||||||
|
|
||||||
|
**From `/gcc/` directory:**
|
||||||
|
```bash
|
||||||
|
make # Build both Boot and Appli
|
||||||
|
make clean # Clean all build artifacts
|
||||||
|
```
|
||||||
|
|
||||||
|
**Individual projects:**
|
||||||
|
```bash
|
||||||
|
# Build only Boot
|
||||||
|
make -f makefile_boot all
|
||||||
|
|
||||||
|
# Build only Appli
|
||||||
|
make -f makefile_appli all
|
||||||
|
|
||||||
|
# Flash Appli (after Boot is already flashed)
|
||||||
|
make -f makefile_appli flash
|
||||||
|
```
|
||||||
|
|
||||||
|
### Debugging
|
||||||
|
|
||||||
|
**Two-stage debugging process:**
|
||||||
|
|
||||||
|
1. **Debug Boot project first:**
|
||||||
|
```bash
|
||||||
|
# In STM32CubeIDE:
|
||||||
|
# 1. Open Boot project
|
||||||
|
# 2. Launch debug session
|
||||||
|
# 3. Wait for compilation/flash complete
|
||||||
|
# 4. Terminate session (Ctrl+F2)
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Debug Appli project:**
|
||||||
|
```bash
|
||||||
|
# In STM32CubeIDE:
|
||||||
|
# 1. Open Appli project
|
||||||
|
# 2. Launch debug session
|
||||||
|
# 3. Wait for compilation/flash complete
|
||||||
|
# 4. Click Resume (F8)
|
||||||
|
# 5. Press the black NRST button on the board
|
||||||
|
# 6. Application breaks at first line of main() in Appli
|
||||||
|
```
|
||||||
|
|
||||||
|
**Command line (if needed):**
|
||||||
|
```bash
|
||||||
|
# Start GDB server
|
||||||
|
openocd -f interface/jlink.cfg -f target/sth7rs.cfg
|
||||||
|
|
||||||
|
# In another terminal
|
||||||
|
arm-none-eabi-gdb gcc/target.elf
|
||||||
|
(gdb) target remote :3333
|
||||||
|
(gdb) load
|
||||||
|
(gdb) break main
|
||||||
|
(gdb) continue
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sensors/Peripherals
|
||||||
|
|
||||||
|
### Audio (Primary Function)
|
||||||
|
- **ADF1** - Digital microphone (PDM interface, 48kHz sample rate)
|
||||||
|
- **I2C1** - Audio codec (STM32 Audio BSP)
|
||||||
|
- **DMA2D/GPDMA1/HPDMA1** - Audio DMA channels
|
||||||
|
|
||||||
|
### Display
|
||||||
|
- **LTDC** - LCD-TFT controller
|
||||||
|
- **GPU2D (NemaGFX)** - 2D acceleration
|
||||||
|
- **Display**: ST7789 (240x240 RGB)
|
||||||
|
|
||||||
|
### Storage & Communication
|
||||||
|
- **XSPI1** - External PSRAM (for audio buffers)
|
||||||
|
- **XSPI2** - External Flash (for TouchGFX assets)
|
||||||
|
- **I2C1** - Touch controller (FT5336), sensors
|
||||||
|
|
||||||
|
### Touch Control
|
||||||
|
- **FT5336** - Capacitive touch controller
|
||||||
|
- **SPI** - Touch interface
|
||||||
|
- **GPIO** - Touch interrupt (TP_IRQ)
|
||||||
|
|
||||||
|
## Audio Processing
|
||||||
|
|
||||||
|
### Effects Chain (in order)
|
||||||
|
1. **Octaver** - Dual-grain pitch shifting (-2, -1, +1, +2 octaves)
|
||||||
|
2. **Equalizer** - 5-band graphic EQ
|
||||||
|
3. **Overdrive** - Distortion effect
|
||||||
|
4. **Saturation** - Audio saturation
|
||||||
|
5. **Echo** - Delay-based echo
|
||||||
|
6. **Reverb** - Room reverb
|
||||||
|
|
||||||
|
### Analysis
|
||||||
|
- **FFT**: 2048-point real FFT (CMSIS-DSP)
|
||||||
|
- **Sample rate**: 48kHz
|
||||||
|
- **Bins**: 1024 (0-24kHz spectrum)
|
||||||
|
- **Peak detection**: Frequency with maximum magnitude
|
||||||
|
|
||||||
|
### Looping
|
||||||
|
- **Duration**: Up to 5 seconds at 48kHz
|
||||||
|
- **Playback**: 2x speed (raises pitch by octave)
|
||||||
|
- **Storage**: External PSRAM (937.5KB buffer)
|
||||||
|
|
||||||
|
## TouchGFX Architecture
|
||||||
|
|
||||||
|
### Project Structure
|
||||||
|
```
|
||||||
|
Appli/
|
||||||
|
├── TouchGFX/
|
||||||
|
│ ├── App/ # Application code (user created)
|
||||||
|
│ ├── assets/ # Images, fonts, videos
|
||||||
|
│ ├── build/ # Generated build files
|
||||||
|
│ ├── config/ # Build configuration
|
||||||
|
│ ├── generated/ # Auto-generated code (DO NOT EDIT)
|
||||||
|
│ ├── gui/ # Custom GUI code (views, presenters)
|
||||||
|
│ ├── simulator/ # Simulator files
|
||||||
|
│ └── target/ # Target-specific code
|
||||||
|
```
|
||||||
|
|
||||||
|
### GUI Screens
|
||||||
|
- **InitScreen** - Initial splash screen
|
||||||
|
- **Overview** - Main screen with audio on/off, volume, looper button
|
||||||
|
- **Oscillo** - Spectrum analyzer display
|
||||||
|
- **Octaver, Equalizer, Overdrive, Saturation, Echo, Reverb** - Effect tuning screens
|
||||||
|
|
||||||
|
## Memory Map
|
||||||
|
|
||||||
|
### Key Sections
|
||||||
|
- **AudioLooperBuffer** - External PSRAM (audio loop recording)
|
||||||
|
- **TouchGFX framebuffers** - External PSRAM (LCD display)
|
||||||
|
- **Heap** - Internal RAM (50KB FreeRTOS heap)
|
||||||
|
- **Stack** - Internal RAM (task stacks)
|
||||||
|
|
||||||
|
### External Memory
|
||||||
|
- **PSRAM**: 8MB (XSPI1) - Audio buffers + framebuffers
|
||||||
|
- **Flash**: 128MB (XSPI2) - TouchGFX assets (compressed images/fonts)
|
||||||
|
|
||||||
|
## Data Logging
|
||||||
|
|
||||||
|
- **Format**: CSV (to be implemented)
|
||||||
|
- **Storage**: SD card via SPI (not currently implemented in main code)
|
||||||
|
- **FATFS**: File system (available via Middlewares/ST)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Last updated: October 2026*
|
||||||
|
*Project: STM32H7S78-DK Audio Effects Processor with TouchGFX*
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,179 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/*
|
||||||
|
* FreeRTOS Kernel V10.5.1
|
||||||
|
* Portion Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
* Portion Copyright (C) 2019 StMicroelectronics, Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE .
|
||||||
|
*
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
*
|
||||||
|
* 1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
#ifndef __FREERTOS_CONFIG_H
|
||||||
|
#define __FREERTOS_CONFIG_H
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Application specific definitions.
|
||||||
|
*
|
||||||
|
* These definitions should be adjusted for your particular hardware and
|
||||||
|
* application requirements.
|
||||||
|
*
|
||||||
|
* These parameters and more are described within the 'configuration' section of the
|
||||||
|
* FreeRTOS API documentation available on the FreeRTOS.org web site.
|
||||||
|
*
|
||||||
|
* See http://www.freertos.org/a00110.html
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
/* Section where include file can be added */
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Ensure definitions are only used by the compiler, and not by the assembler. */
|
||||||
|
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__)
|
||||||
|
#include <stdint.h>
|
||||||
|
extern uint32_t SystemCoreClock;
|
||||||
|
#endif
|
||||||
|
#ifndef CMSIS_device_header
|
||||||
|
#define CMSIS_device_header "stm32h7rsxx.h"
|
||||||
|
#endif /* CMSIS_device_header */
|
||||||
|
|
||||||
|
#define configENABLE_FPU 0
|
||||||
|
#define configENABLE_MPU 0
|
||||||
|
|
||||||
|
#define configUSE_PREEMPTION 1
|
||||||
|
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||||
|
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||||
|
#define configUSE_IDLE_HOOK 1
|
||||||
|
#define configUSE_TICK_HOOK 0
|
||||||
|
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||||
|
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||||
|
#define configMAX_PRIORITIES ( 56 )
|
||||||
|
#define configUSE_SB_COMPLETED_CALLBACK ( 0 )
|
||||||
|
#define configUSE_MINI_LIST_ITEM ( 1 )
|
||||||
|
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||||
|
#define configTOTAL_HEAP_SIZE ((size_t)50000)
|
||||||
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
|
#define configHEAP_CLEAR_MEMORY_ON_FREE 0
|
||||||
|
#define configUSE_TRACE_FACILITY 1
|
||||||
|
#define configUSE_16_BIT_TICKS 0
|
||||||
|
#define configUSE_MUTEXES 1
|
||||||
|
#define configQUEUE_REGISTRY_SIZE 8
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
|
#define configUSE_APPLICATION_TASK_TAG 1
|
||||||
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
|
/* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */
|
||||||
|
/* Defaults to size_t for backward compatibility, but can be changed
|
||||||
|
if lengths will always be less than the number of bytes in a size_t. */
|
||||||
|
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
|
||||||
|
/* USER CODE END MESSAGE_BUFFER_LENGTH_TYPE */
|
||||||
|
|
||||||
|
/* Co-routine definitions. */
|
||||||
|
#define configUSE_CO_ROUTINES 0
|
||||||
|
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||||
|
|
||||||
|
/* Software timer definitions. */
|
||||||
|
#define configUSE_TIMERS 1
|
||||||
|
#define configTIMER_TASK_PRIORITY ( 2 )
|
||||||
|
#define configTIMER_QUEUE_LENGTH 10
|
||||||
|
#define configTIMER_TASK_STACK_DEPTH 256
|
||||||
|
|
||||||
|
/* The following flag must be enabled only when using newlib */
|
||||||
|
#define configUSE_NEWLIB_REENTRANT 1
|
||||||
|
|
||||||
|
/* CMSIS-RTOS V2 flags */
|
||||||
|
#define configUSE_OS2_THREAD_SUSPEND_RESUME 1
|
||||||
|
#define configUSE_OS2_THREAD_ENUMERATE 1
|
||||||
|
#define configUSE_OS2_EVENTFLAGS_FROM_ISR 1
|
||||||
|
#define configUSE_OS2_THREAD_FLAGS 1
|
||||||
|
#define configUSE_OS2_TIMER 1
|
||||||
|
#define configUSE_OS2_MUTEX 1
|
||||||
|
#define configTEX_S_C_B_SRAM ( 0x03UL )
|
||||||
|
#define configTOTAL_MPU_REGIONS 16
|
||||||
|
/* Set the following definitions to 1 to include the API function, or zero
|
||||||
|
to exclude the API function. */
|
||||||
|
#define INCLUDE_vTaskPrioritySet 1
|
||||||
|
#define INCLUDE_uxTaskPriorityGet 1
|
||||||
|
#define INCLUDE_vTaskDelete 1
|
||||||
|
#define INCLUDE_vTaskCleanUpResources 0
|
||||||
|
#define INCLUDE_vTaskSuspend 1
|
||||||
|
#define INCLUDE_xTaskDelayUntil 1
|
||||||
|
#define INCLUDE_vTaskDelay 1
|
||||||
|
#define INCLUDE_xTaskGetSchedulerState 1
|
||||||
|
#define INCLUDE_xTimerPendFunctionCall 1
|
||||||
|
#define INCLUDE_xQueueGetMutexHolder 1
|
||||||
|
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||||
|
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||||
|
#define INCLUDE_eTaskGetState 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used
|
||||||
|
* by the application thus the correct define need to be enabled below
|
||||||
|
*/
|
||||||
|
#define USE_FreeRTOS_HEAP_4
|
||||||
|
|
||||||
|
/* Cortex-M specific definitions. */
|
||||||
|
#ifdef __NVIC_PRIO_BITS
|
||||||
|
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
|
||||||
|
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||||
|
#else
|
||||||
|
#define configPRIO_BITS 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||||
|
function. */
|
||||||
|
|
||||||
|
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
|
||||||
|
|
||||||
|
/* The highest interrupt priority that can be used by any interrupt service
|
||||||
|
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||||
|
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||||
|
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||||
|
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||||
|
|
||||||
|
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||||
|
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||||
|
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||||
|
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||||
|
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||||
|
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||||
|
|
||||||
|
/* Normal assert() semantics without relying on the provision of an assert.h
|
||||||
|
header file. */
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
|
||||||
|
standard names. */
|
||||||
|
#define vPortSVCHandler SVC_Handler
|
||||||
|
#define xPortPendSVHandler PendSV_Handler
|
||||||
|
/* IMPORTANT: After 10.3.1 update, Systick_Handler comes from NVIC (if SYS timebase = systick), otherwise from cmsis_os2.c */
|
||||||
|
|
||||||
|
#define USE_CUSTOM_SYSTICK_HANDLER_IMPLEMENTATION 0
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Defines */
|
||||||
|
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
||||||
|
#define traceTASK_SWITCHED_OUT() xTaskCallApplicationTaskHook( pxCurrentTCB, (void*)1 )
|
||||||
|
#define traceTASK_SWITCHED_IN() xTaskCallApplicationTaskHook( pxCurrentTCB, (void*)0 )
|
||||||
|
/* USER CODE END Defines */
|
||||||
|
|
||||||
|
#endif /* __FREERTOS_CONFIG_H */
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @version V2.0.0
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __RTE_COMPONENTS_H__
|
||||||
|
#define __RTE_COMPONENTS_H__
|
||||||
|
|
||||||
|
/* Defines ------------------------------------------------------------------*/
|
||||||
|
/* STMicroelectronics.X-CUBE-TOUCHGFX.4.26.1 */
|
||||||
|
#define TOUCHGFX_APP
|
||||||
|
|
||||||
|
#endif /* __RTE_COMPONENTS_H__ */
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#ifndef AUDIO_ANALYSIS_H
|
||||||
|
#define AUDIO_ANALYSIS_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* FFT calculee sur 2048 points : le spectre d'un signal reel est symetrique, donc
|
||||||
|
* seule la moitie (0 a Fe/2) est utile -> exactement 1024 points affichables,
|
||||||
|
* correspondant a la capacite du widget Graph cote IHM. */
|
||||||
|
#define AUDIO_ANALYSIS_SAMPLE_RATE_HZ 48000U
|
||||||
|
#define AUDIO_ANALYSIS_FFT_SIZE 2048U
|
||||||
|
#define AUDIO_ANALYSIS_NUM_BINS (AUDIO_ANALYSIS_FFT_SIZE / 2U) /* 1024 : 0 a Fe/2 */
|
||||||
|
|
||||||
|
/* A appeler une fois au demarrage, comme AudioEffects_Init(). */
|
||||||
|
void AudioAnalysis_Init(void);
|
||||||
|
|
||||||
|
/* A appeler depuis le chemin audio temps reel (ex: push_to_fifo), un echantillon
|
||||||
|
* a la fois. Ne fait rien (cout quasi nul) tant que l'analyse n'est pas activee. */
|
||||||
|
void AudioAnalysis_PushSample(float sample);
|
||||||
|
|
||||||
|
/* A appeler depuis la tache IHM (jamais depuis le contexte audio) : si un bloc de
|
||||||
|
* AUDIO_ANALYSIS_FFT_SIZE echantillons est pret, calcule son spectre (fenetrage +
|
||||||
|
* FFT + magnitude en dB). Retourne true si un nouveau spectre vient d'etre calcule. */
|
||||||
|
bool AudioAnalysis_Update(void);
|
||||||
|
|
||||||
|
/* Spectre courant, AUDIO_ANALYSIS_NUM_BINS valeurs en dB (echelle approximative,
|
||||||
|
* pour affichage uniquement), du bin 0 (continu) au bin NUM_BINS-1 (~Fe/2). Le
|
||||||
|
* pas entre deux bins vaut AUDIO_ANALYSIS_SAMPLE_RATE_HZ / AUDIO_ANALYSIS_FFT_SIZE
|
||||||
|
* (23.4375 Hz ici). Valide apres un AudioAnalysis_Update() ayant retourne true ;
|
||||||
|
* inchange sinon (dernier spectre calcule). */
|
||||||
|
const float *AudioAnalysis_GetMagnitudesDb(void);
|
||||||
|
|
||||||
|
/* Frequence (en Hz) du bin de plus forte magnitude dans le dernier spectre calcule
|
||||||
|
* (frequence dominante / pic). Valide dans les memes conditions que
|
||||||
|
* AudioAnalysis_GetMagnitudesDb(). */
|
||||||
|
float AudioAnalysis_GetPeakFrequencyHz(void);
|
||||||
|
|
||||||
|
/* Active/desactive la capture et le calcul (pilote par le toggle de l'ecran Oscillo). */
|
||||||
|
void AudioAnalysis_SetEnabled(bool enabled);
|
||||||
|
bool AudioAnalysis_IsEnabled(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* AUDIO_ANALYSIS_H */
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef AUDIO_EFFECTS_H
|
||||||
|
#define AUDIO_EFFECTS_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "fx_octaver.h"
|
||||||
|
#include "fx_equalizer.h"
|
||||||
|
#include "fx_overdrive.h"
|
||||||
|
#include "fx_saturation.h"
|
||||||
|
#include "fx_echo.h"
|
||||||
|
#include "fx_reverb.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Structure regroupant les parametres de tous les effets. Modifiable directement
|
||||||
|
* (ex: depuis l'IHM) via AudioEffects_GetParams(). L'ordre de traitement fixe est :
|
||||||
|
* octaveur -> egaliseur -> overdrive -> saturation -> echo -> reverberation. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool audio_on_off;
|
||||||
|
float master_volume; /* volume general en sortie de chaine, 0.0 a 1.0 */
|
||||||
|
FxOctaverParams octaver;
|
||||||
|
FxEqualizerParams equalizer;
|
||||||
|
FxOverdriveParams overdrive;
|
||||||
|
FxSaturationParams saturation;
|
||||||
|
FxEchoParams echo;
|
||||||
|
FxReverbParams reverb;
|
||||||
|
} AudioEffectsParams;
|
||||||
|
|
||||||
|
void AudioEffects_Init(void);
|
||||||
|
float AudioEffects_Process(float input);
|
||||||
|
AudioEffectsParams *AudioEffects_GetParams(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* AUDIO_EFFECTS_H */
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#ifndef AUDIO_LOOPER_H
|
||||||
|
#define AUDIO_LOOPER_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Effet "repeatButton" de l'ecran Overview : tant que le bouton est maintenu, l'audio
|
||||||
|
* (apres la chaine d'effets) est enregistre ; au relachement, l'enregistrement est
|
||||||
|
* rejoue plus vite, ce qui rend aussi la voix/le son plus aigu (pas de correction de
|
||||||
|
* pitch independante : c'est un simple changement de vitesse de lecture, comme une
|
||||||
|
* bande accéléree). */
|
||||||
|
#define AUDIO_LOOPER_SAMPLE_RATE_HZ 48000U
|
||||||
|
#define AUDIO_LOOPER_MAX_SECONDS 5U
|
||||||
|
#define AUDIO_LOOPER_MAX_SAMPLES (AUDIO_LOOPER_SAMPLE_RATE_HZ * AUDIO_LOOPER_MAX_SECONDS)
|
||||||
|
|
||||||
|
/* Ratio de vitesse de lecture (>1 = plus rapide et plus aigu). 2.0 = une octave au-dessus,
|
||||||
|
* duree divisee par deux. */
|
||||||
|
#define AUDIO_LOOPER_PLAYBACK_RATIO 2.0f
|
||||||
|
|
||||||
|
/* A appeler une fois au demarrage, comme AudioEffects_Init(). */
|
||||||
|
void AudioLooper_Init(void);
|
||||||
|
|
||||||
|
/* A appeler depuis la tache IHM sur front montant du bouton (appui). Demarre une
|
||||||
|
* nouvelle capture (ecrase la precedente). */
|
||||||
|
void AudioLooper_StartRecording(void);
|
||||||
|
|
||||||
|
/* A appeler depuis la tache IHM sur front descendant du bouton (relachement). Termine
|
||||||
|
* la capture et declenche la lecture acceleree de ce qui a ete enregistre. */
|
||||||
|
void AudioLooper_StopRecordingAndPlay(void);
|
||||||
|
|
||||||
|
/* A appeler depuis le chemin audio temps reel, un echantillon a la fois, juste apres
|
||||||
|
* la chaine d'effets (AudioEffects_Process). Hors enregistrement/lecture, retourne
|
||||||
|
* sample_in inchange. Pendant l'enregistrement, retourne sample_in inchange (l'ecoute
|
||||||
|
* live continue normalement pendant la capture). Pendant la lecture, retourne
|
||||||
|
* l'echantillon rejoue a la place de sample_in, jusqu'a la fin du buffer enregistre. */
|
||||||
|
float AudioLooper_Process(float sample_in);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* AUDIO_LOOPER_H */
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef FX_ECHO_H
|
||||||
|
#define FX_ECHO_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FX_ECHO_SAMPLE_RATE 48000U
|
||||||
|
#define FX_ECHO_MAX_DELAY_MS 1000U
|
||||||
|
#define FX_ECHO_BUFFER_SIZE (FX_ECHO_SAMPLE_RATE * FX_ECHO_MAX_DELAY_MS / 1000U)
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
float delay_ms; /* 0 a FX_ECHO_MAX_DELAY_MS */
|
||||||
|
float feedback; /* 0.0 a <1.0 */
|
||||||
|
float mix; /* 0.0 (sec) a 1.0 (100% repetitions) */
|
||||||
|
} FxEchoParams;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int16_t buffer[FX_ECHO_BUFFER_SIZE];
|
||||||
|
uint32_t write_idx;
|
||||||
|
} FxEchoState;
|
||||||
|
|
||||||
|
void FxEcho_Init(FxEchoState *state, FxEchoParams *params);
|
||||||
|
float FxEcho_Process(FxEchoState *state, const FxEchoParams *params, float input);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_ECHO_H */
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#ifndef FX_EQUALIZER_H
|
||||||
|
#define FX_EQUALIZER_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FX_EQ_NUM_BANDS 10U
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float freq_hz; /* frequence centrale de la bande */
|
||||||
|
float gain_db; /* -24.0 a +24.0 dB */
|
||||||
|
float q; /* facteur de qualite, typiquement 0.5 a 5.0 */
|
||||||
|
} FxEqBand;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
FxEqBand bands[FX_EQ_NUM_BANDS];
|
||||||
|
} FxEqualizerParams;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/* coefficients biquad mis en cache, recalcules seulement si les parametres changent */
|
||||||
|
float b0, b1, b2, a1, a2;
|
||||||
|
/* dernieres valeurs de parametres utilisees pour calculer les coefficients ci-dessus */
|
||||||
|
float last_freq_hz;
|
||||||
|
float last_gain_db;
|
||||||
|
float last_q;
|
||||||
|
} FxEqBandState;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
FxEqBandState band_state[FX_EQ_NUM_BANDS];
|
||||||
|
/* etat du filtre (direct form 1), par bande */
|
||||||
|
float x1[FX_EQ_NUM_BANDS];
|
||||||
|
float x2[FX_EQ_NUM_BANDS];
|
||||||
|
float y1[FX_EQ_NUM_BANDS];
|
||||||
|
float y2[FX_EQ_NUM_BANDS];
|
||||||
|
} FxEqualizerState;
|
||||||
|
|
||||||
|
void FxEqualizer_Init(FxEqualizerState *state, FxEqualizerParams *params);
|
||||||
|
float FxEqualizer_Process(FxEqualizerState *state, const FxEqualizerParams *params, float input);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_EQUALIZER_H */
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#ifndef FX_OCTAVER_H
|
||||||
|
#define FX_OCTAVER_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FX_OCTAVER_BUFFER_SIZE 4096U /* buffer circulaire (puissance de 2) */
|
||||||
|
#define FX_OCTAVER_GRAIN_SIZE 2048U /* taille de grain, en echantillons (~43ms a 48kHz) :
|
||||||
|
* doit largement couvrir la periode des notes les plus
|
||||||
|
* graves jouees (ex. do2 ~65Hz, periode ~734 echantillons
|
||||||
|
* a 48kHz) pour limiter les artefacts de phase entre les
|
||||||
|
* deux grains en fondu croise. */
|
||||||
|
#define FX_OCTAVER_NUM_VOICES 4U /* -2oct, -1oct, +1oct, +2oct (la voie seche est geree a part) */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
float level_down2; /* niveau voix -2 octaves, 0.0 a 1.0 */
|
||||||
|
float level_down1; /* niveau voix -1 octave, 0.0 a 1.0 */
|
||||||
|
float level_dry; /* niveau voix originale, 0.0 a 1.0 */
|
||||||
|
float level_up1; /* niveau voix +1 octave, 0.0 a 1.0 */
|
||||||
|
float level_up2; /* niveau voix +2 octaves, 0.0 a 1.0 */
|
||||||
|
} FxOctaverParams;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float delay[2]; /* decalage courant (en echantillons) des deux grains en fondu croise */
|
||||||
|
} FxOctaverVoiceState;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float buffer[FX_OCTAVER_BUFFER_SIZE];
|
||||||
|
uint32_t write_idx;
|
||||||
|
FxOctaverVoiceState voices[FX_OCTAVER_NUM_VOICES];
|
||||||
|
} FxOctaverState;
|
||||||
|
|
||||||
|
void FxOctaver_Init(FxOctaverState *state, FxOctaverParams *params);
|
||||||
|
float FxOctaver_Process(FxOctaverState *state, const FxOctaverParams *params, float input);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_OCTAVER_H */
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef FX_OVERDRIVE_H
|
||||||
|
#define FX_OVERDRIVE_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
float drive; /* 0.0 a 1.0 : quantite de distorsion */
|
||||||
|
float tone; /* 0.0 (sombre) a 1.0 (brillant) : filtre passe-bas post-distorsion */
|
||||||
|
float level; /* gain de compensation en sortie */
|
||||||
|
} FxOverdriveParams;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float tone_lp_state;
|
||||||
|
} FxOverdriveState;
|
||||||
|
|
||||||
|
void FxOverdrive_Init(FxOverdriveState *state, FxOverdriveParams *params);
|
||||||
|
float FxOverdrive_Process(FxOverdriveState *state, const FxOverdriveParams *params, float input);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_OVERDRIVE_H */
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#ifndef FX_REVERB_H
|
||||||
|
#define FX_REVERB_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FX_REVERB_NUM_COMBS 8U
|
||||||
|
#define FX_REVERB_NUM_ALLPASS 4U
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
float room_size; /* 0.0 a 1.0 */
|
||||||
|
float damping; /* 0.0 (brillant) a 1.0 (etouffe) */
|
||||||
|
float mix; /* 0.0 (sec) a 1.0 (100% reverbere) */
|
||||||
|
} FxReverbParams;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float *buffer;
|
||||||
|
uint32_t size;
|
||||||
|
uint32_t idx;
|
||||||
|
float filter_store;
|
||||||
|
} FxCombState;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float *buffer;
|
||||||
|
uint32_t size;
|
||||||
|
uint32_t idx;
|
||||||
|
} FxAllpassState;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
FxCombState combs[FX_REVERB_NUM_COMBS];
|
||||||
|
FxAllpassState allpass[FX_REVERB_NUM_ALLPASS];
|
||||||
|
} FxReverbState;
|
||||||
|
|
||||||
|
void FxReverb_Init(FxReverbState *state, FxReverbParams *params);
|
||||||
|
float FxReverb_Process(FxReverbState *state, const FxReverbParams *params, float input);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_REVERB_H */
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef FX_SATURATION_H
|
||||||
|
#define FX_SATURATION_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
float drive; /* 0.0 (aucun effet) a 1.0 (saturation maximale) */
|
||||||
|
float level; /* gain de compensation en sortie, typiquement 0.0 - 1.0 */
|
||||||
|
} FxSaturationParams;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float dc_block_x1;
|
||||||
|
float dc_block_y1;
|
||||||
|
} FxSaturationState;
|
||||||
|
|
||||||
|
void FxSaturation_Init(FxSaturationState *state, FxSaturationParams *params);
|
||||||
|
float FxSaturation_Process(FxSaturationState *state, const FxSaturationParams *params, float input);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FX_SATURATION_H */
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file jpeg_utils_conf.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief jpeg_utils configuration file.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __JPEG_UTILS_CONF_H__
|
||||||
|
#define __JPEG_UTILS_CONF_H__
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "stm32h7rsxx_hal.h"
|
||||||
|
#include "stm32h7rsxx_hal_jpeg.h"
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/** @addtogroup JPEG_Private_Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* RGB Color format definition for JPEG encoding/Decoding : Should not be modified*/
|
||||||
|
#define JPEG_ARGB8888 0 /* ARGB8888 Color Format */
|
||||||
|
#define JPEG_RGB888 1 /* RGB888 Color Format */
|
||||||
|
#define JPEG_RGB565 2 /* RGB565 Color Format */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define USE_JPEG_DECODER
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USE_JPEG_DECODER 1 /* 1 or 0 ********* Value different from default value : 1 ********** */
|
||||||
|
/*
|
||||||
|
* Define USE_JPEG_ENCODER
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USE_JPEG_ENCODER 0 /* 1 or 0 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define JPEG_RGB_FORMAT
|
||||||
|
*/
|
||||||
|
#define JPEG_RGB_FORMAT JPEG_ARGB8888 /* JPEG_ARGB8888, JPEG_RGB888, JPEG_RGB565 ********* Value different from default value : 0 ********** */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define JPEG_SWAP_RB
|
||||||
|
*/
|
||||||
|
#define JPEG_SWAP_RB 0 /* 0 or 1 ********* Value different from default value : 0 ********** */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
|
||||||
|
#endif /* __JPEG_UTILS_CONF_H__ */
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file : main.h
|
||||||
|
* @brief : Header for main.c file.
|
||||||
|
* This file contains the common defines of the application.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __MAIN_H
|
||||||
|
#define __MAIN_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32h7rsxx_hal.h"
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ET */
|
||||||
|
|
||||||
|
/* USER CODE END ET */
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EC */
|
||||||
|
|
||||||
|
/* USER CODE END EC */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EM */
|
||||||
|
|
||||||
|
/* USER CODE END EM */
|
||||||
|
|
||||||
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
|
void Error_Handler(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
#define FRAME_RATE_Pin GPIO_PIN_3
|
||||||
|
#define FRAME_RATE_GPIO_Port GPIOF
|
||||||
|
#define RENDER_TIME_Pin GPIO_PIN_2
|
||||||
|
#define RENDER_TIME_GPIO_Port GPIOF
|
||||||
|
#define ADF1_CK_Pin GPIO_PIN_2
|
||||||
|
#define ADF1_CK_GPIO_Port GPIOE
|
||||||
|
#define MCU_ACTIVE_Pin GPIO_PIN_4
|
||||||
|
#define MCU_ACTIVE_GPIO_Port GPIOF
|
||||||
|
#define VSYNC_FREQ_Pin GPIO_PIN_1
|
||||||
|
#define VSYNC_FREQ_GPIO_Port GPIOF
|
||||||
|
#define LCD_EN_Pin GPIO_PIN_15
|
||||||
|
#define LCD_EN_GPIO_Port GPIOE
|
||||||
|
#define ADF1_D_Pin GPIO_PIN_6
|
||||||
|
#define ADF1_D_GPIO_Port GPIOD
|
||||||
|
#define TP_IRQ_Pin GPIO_PIN_3
|
||||||
|
#define TP_IRQ_GPIO_Port GPIOE
|
||||||
|
#define TP_IRQ_EXTI_IRQn EXTI3_IRQn
|
||||||
|
#define LCD_BL_CTRL_Pin GPIO_PIN_15
|
||||||
|
#define LCD_BL_CTRL_GPIO_Port GPIOG
|
||||||
|
#define MIC_DET_Pin GPIO_PIN_1
|
||||||
|
#define MIC_DET_GPIO_Port GPIOH
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __MAIN_H */
|
||||||
@@ -0,0 +1,520 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7rsxx_hal_conf.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief HAL configuration template file.
|
||||||
|
* This file should be copied to the application folder and renamed
|
||||||
|
* to stm32h7rsxx_hal_conf.h.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32H7RSxx_HAL_CONF_H
|
||||||
|
#define STM32H7RSxx_HAL_CONF_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ########################## Module Selection ############################## */
|
||||||
|
/**
|
||||||
|
* @brief This is the list of modules to be used in the HAL driver
|
||||||
|
*/
|
||||||
|
#define HAL_MODULE_ENABLED
|
||||||
|
/* #define HAL_ADC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_CEC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_CORDIC_MODULE_ENABLED */
|
||||||
|
#define HAL_CRC_MODULE_ENABLED
|
||||||
|
/* #define HAL_CRYP_MODULE_ENABLED */
|
||||||
|
/* #define HAL_DCMIPP_MODULE_ENABLED */
|
||||||
|
#define HAL_DMA2D_MODULE_ENABLED
|
||||||
|
/* #define HAL_DTS_MODULE_ENABLED */
|
||||||
|
/* #define HAL_ETH_MODULE_ENABLED */
|
||||||
|
/* #define HAL_FDCAN_MODULE_ENABLED */
|
||||||
|
/* #define HAL_GFXMMU_MODULE_ENABLED */
|
||||||
|
/* #define HAL_GFXTIM_MODULE_ENABLED */
|
||||||
|
#define HAL_GPU2D_MODULE_ENABLED
|
||||||
|
/* #define HAL_HASH_MODULE_ENABLED */
|
||||||
|
/* #define HAL_HCD_MODULE_ENABLED */
|
||||||
|
#define HAL_I2C_MODULE_ENABLED
|
||||||
|
#define HAL_I2S_MODULE_ENABLED
|
||||||
|
/* #define HAL_I3C_MODULE_ENABLED */
|
||||||
|
#define HAL_ICACHE_MODULE_ENABLED
|
||||||
|
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||||
|
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||||
|
#define HAL_JPEG_MODULE_ENABLED
|
||||||
|
/* #define HAL_LPTIM_MODULE_ENABLED */
|
||||||
|
#define HAL_LTDC_MODULE_ENABLED
|
||||||
|
/* #define HAL_MCE_MODULE_ENABLED */
|
||||||
|
#define HAL_MDF_MODULE_ENABLED
|
||||||
|
/* #define HAL_MMC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_NAND_MODULE_ENABLED */
|
||||||
|
/* #define HAL_NOR_MODULE_ENABLED */
|
||||||
|
/* #define HAL_PCD_MODULE_ENABLED */
|
||||||
|
/* #define HAL_PKA_MODULE_ENABLED */
|
||||||
|
/* #define HAL_PSSI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_RAMECC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_RCC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_RNG_MODULE_ENABLED */
|
||||||
|
/* #define HAL_RTC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SAI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SD_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SDIO_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SDRAM_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SPI_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SRAM_MODULE_ENABLED */
|
||||||
|
#define HAL_TIM_MODULE_ENABLED
|
||||||
|
#define HAL_UART_MODULE_ENABLED
|
||||||
|
/* #define HAL_USART_MODULE_ENABLED */
|
||||||
|
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||||
|
/* #define HAL_XSPI_MODULE_ENABLED */
|
||||||
|
#define HAL_GPIO_MODULE_ENABLED
|
||||||
|
#define HAL_PWR_MODULE_ENABLED
|
||||||
|
#define HAL_DMA_MODULE_ENABLED
|
||||||
|
#define HAL_RCC_MODULE_ENABLED
|
||||||
|
#define HAL_FLASH_MODULE_ENABLED
|
||||||
|
#define HAL_EXTI_MODULE_ENABLED
|
||||||
|
#define HAL_CORTEX_MODULE_ENABLED
|
||||||
|
|
||||||
|
/* ########################## Oscillator Values adaptation ####################*/
|
||||||
|
/**
|
||||||
|
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||||
|
* This value is used by the RCC HAL module to compute the system frequency
|
||||||
|
* (when HSE is used as system clock source, directly or through the PLL).
|
||||||
|
*/
|
||||||
|
#if !defined (HSE_VALUE)
|
||||||
|
#define HSE_VALUE 24000000UL /*!< Value of the External oscillator in Hz */
|
||||||
|
#endif /* HSE_VALUE */
|
||||||
|
|
||||||
|
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||||
|
#define HSE_STARTUP_TIMEOUT 100UL /*!< Time out for HSE start up (in ms) */
|
||||||
|
#endif /* HSE_STARTUP_TIMEOUT */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal High Speed oscillator (HSI) value.
|
||||||
|
* This value is used by the RCC HAL module to compute the system frequency
|
||||||
|
* (when HSI is used as system clock source, directly or through the PLL).
|
||||||
|
*/
|
||||||
|
#if !defined (HSI_VALUE)
|
||||||
|
#define HSI_VALUE 64000000UL /*!< Value of the Internal oscillator in Hz */
|
||||||
|
#endif /* HSI_VALUE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal Low-power oscillator (CSI) default value.
|
||||||
|
* This value is the default CSI range value after Reset.
|
||||||
|
*/
|
||||||
|
#if !defined (CSI_VALUE)
|
||||||
|
#define CSI_VALUE 4000000UL /*!< Value of the Internal oscillator in Hz */
|
||||||
|
#endif /* CSI_VALUE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal High Speed oscillator (HSI48) value for USB OTG FS and RNG.
|
||||||
|
* This internal oscillator is mainly dedicated to provide a high precision clock to
|
||||||
|
* the USB peripheral by means of a special Clock Recovery System (CRS) circuitry.
|
||||||
|
* When the CRS is not used, the HSI48 RC oscillator runs on it default frequency
|
||||||
|
* which is subject to manufacturing process variations.
|
||||||
|
*/
|
||||||
|
#if !defined (HSI48_VALUE)
|
||||||
|
#define HSI48_VALUE 48000000UL /*!< Value of the Internal High Speed oscillator for USB OTG FS/RNG in Hz.
|
||||||
|
The real value my vary depending on manufacturing process variations. */
|
||||||
|
#endif /* HSI48_VALUE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal Low Speed oscillator (LSI) value.
|
||||||
|
*/
|
||||||
|
#if !defined (LSI_VALUE)
|
||||||
|
#define LSI_VALUE 32000UL /*!< LSI Typical Value in Hz.
|
||||||
|
Value of the Internal Low Speed oscillator in Hz.
|
||||||
|
The real value may vary depending on the variations
|
||||||
|
in voltage and temperature.*/
|
||||||
|
#endif /* LSI_VALUE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief External Low Speed oscillator (LSE) value.
|
||||||
|
*/
|
||||||
|
#if !defined (LSE_VALUE)
|
||||||
|
#define LSE_VALUE 32768UL /*!< Value of the External oscillator in Hz*/
|
||||||
|
#endif /* LSE_VALUE */
|
||||||
|
|
||||||
|
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||||
|
#define LSE_STARTUP_TIMEOUT 5000UL /*!< Time out for LSE start up (in ms) */
|
||||||
|
#endif /* LSE_STARTUP_TIMEOUT */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief External clock source for digital audio interfaces: SPI/I2S, SAI and ADF
|
||||||
|
* This value is used by the RCC HAL module to provide the digital audio interfaces
|
||||||
|
* frequency. This clock source is inserted directly through I2S_CKIN pad.
|
||||||
|
*/
|
||||||
|
#if !defined (EXTERNAL_CLOCK_VALUE)
|
||||||
|
#define EXTERNAL_CLOCK_VALUE 48000UL /*!< Value of the external clock source in Hz */
|
||||||
|
#endif /* EXTERNAL_CLOCK_VALUE */
|
||||||
|
|
||||||
|
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||||
|
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
||||||
|
|
||||||
|
/* ########################### System Configuration ######################### */
|
||||||
|
/**
|
||||||
|
* @brief This is the HAL system configuration section
|
||||||
|
*/
|
||||||
|
#define VDD_VALUE 3300UL /*!< Value of VDD in mv */
|
||||||
|
#define TICK_INT_PRIORITY (4UL)/*!< tick interrupt priority (lowest by default) */
|
||||||
|
#define USE_RTOS 0U
|
||||||
|
|
||||||
|
/* ########################## Assert Selection ############################## */
|
||||||
|
/**
|
||||||
|
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||||
|
* HAL drivers code
|
||||||
|
*/
|
||||||
|
/* #define USE_FULL_ASSERT 1U */
|
||||||
|
|
||||||
|
/* ################## Register callback feature configuration ############### */
|
||||||
|
/**
|
||||||
|
* @brief Set below the peripheral configuration to "1U" to add the support
|
||||||
|
* of HAL callback registration/unregistration feature for the HAL
|
||||||
|
* driver(s). This allows user application to provide specific callback
|
||||||
|
* functions thanks to HAL_PPP_RegisterCallback() rather than overwriting
|
||||||
|
* the default weak callback functions (see each stm32h7rsxx_hal_ppp.h file
|
||||||
|
* for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef
|
||||||
|
* for each PPP peripheral).
|
||||||
|
*/
|
||||||
|
#define USE_HAL_ADC_REGISTER_CALLBACKS 1U
|
||||||
|
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_CORDIC_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_DCMIPP_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_HASH_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_I2C_REGISTER_CALLBACKS 1U
|
||||||
|
#define USE_HAL_I2S_REGISTER_CALLBACKS 1U
|
||||||
|
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_JPEG_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_MDF_REGISTER_CALLBACKS 1U
|
||||||
|
#define USE_HAL_MMC_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_NAND_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_NOR_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_PCD_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_PKA_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_PSSI_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_RNG_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_RTC_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_SAI_REGISTER_CALLBACKS 1U
|
||||||
|
#define USE_HAL_SD_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_SDIO_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_SPI_REGISTER_CALLBACKS 1U
|
||||||
|
#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_UART_REGISTER_CALLBACKS 1U
|
||||||
|
#define USE_HAL_USART_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U
|
||||||
|
#define USE_HAL_XSPI_REGISTER_CALLBACKS 1U
|
||||||
|
|
||||||
|
/* ################## SPI peripheral configuration ########################## */
|
||||||
|
|
||||||
|
/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
|
||||||
|
* Activated: CRC code is present inside driver
|
||||||
|
* Deactivated: CRC code cleaned from driver
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USE_SPI_CRC 1U
|
||||||
|
|
||||||
|
/* ################## CRYP peripheral configuration ########################## */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief For code optimization purpose, uncomment and set to "1U" the USE_HAL_CRYP_ONLY or USE_HAL_SAES_ONLY,
|
||||||
|
* to use only one peripheral. Both defines cannot be set to "1U" at the same time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* #define USE_HAL_CRYP_ONLY 1U */
|
||||||
|
/* #define USE_HAL_SAES_ONLY 0U */
|
||||||
|
|
||||||
|
#define USE_HAL_CRYP_SUSPEND_RESUME 0U
|
||||||
|
|
||||||
|
/* ################## HASH peripheral configuration ########################## */
|
||||||
|
|
||||||
|
#define USE_HAL_HASH_SUSPEND_RESUME 0U
|
||||||
|
|
||||||
|
/* ################## SDMMC peripheral configuration ######################### */
|
||||||
|
|
||||||
|
#define USE_SD_TRANSCEIVER 0U
|
||||||
|
|
||||||
|
/* ################## SDIO peripheral configuration ######################### */
|
||||||
|
|
||||||
|
#define USE_SDIO_TRANSCEIVER 0U
|
||||||
|
#define SDIO_MAX_IO_NUMBER 7U
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief Include module's header file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAL_RCC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_rcc.h"
|
||||||
|
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_gpio.h"
|
||||||
|
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DMA_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_dma.h"
|
||||||
|
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_cortex.h"
|
||||||
|
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_ADC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_adc.h"
|
||||||
|
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CEC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_cec.h"
|
||||||
|
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CORDIC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_cordic.h"
|
||||||
|
#endif /* HAL_CORDIC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CRC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_crc.h"
|
||||||
|
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_cryp.h"
|
||||||
|
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DCMIPP_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_dcmipp.h"
|
||||||
|
#endif /* HAL_DCMIPP_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DMA2D_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_dma2d.h"
|
||||||
|
#endif /* HAL_DMA2D_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_DTS_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_dts.h"
|
||||||
|
#endif /* HAL_DTS_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_ETH_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_eth.h"
|
||||||
|
#endif /* HAL_ETH_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_exti.h"
|
||||||
|
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_FDCAN_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_fdcan.h"
|
||||||
|
#endif /* HAL_FDCAN_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_flash.h"
|
||||||
|
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_GFXMMU_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_gfxmmu.h"
|
||||||
|
#endif /* HAL_GFXMMU_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_GFXTIM_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_gfxtim.h"
|
||||||
|
#endif /* HAL_GFXTIM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_GPU2D_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_gpu2d.h"
|
||||||
|
#endif /* HAL_GPU2D_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_HASH_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_hash.h"
|
||||||
|
#endif /* HAL_HASH_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_HCD_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_hcd.h"
|
||||||
|
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_I2C_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_i2c.h"
|
||||||
|
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_I2S_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_i2s.h"
|
||||||
|
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_I3C_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_i3c.h"
|
||||||
|
#endif /* HAL_I3C_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_ICACHE_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_icache.h"
|
||||||
|
#endif /* HAL_ICACHE_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_irda.h"
|
||||||
|
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_iwdg.h"
|
||||||
|
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_JPEG_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_jpeg.h"
|
||||||
|
#endif /* HAL_JPEG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_LTDC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_ltdc.h"
|
||||||
|
#endif /* HAL_LTDC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_lptim.h"
|
||||||
|
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_MCE_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_mce.h"
|
||||||
|
#endif /* HAL_MCE_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_MDF_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_mdf.h"
|
||||||
|
#endif /* HAL_MDF_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_MMC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_mmc.h"
|
||||||
|
#endif /* HAL_MMC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_NAND_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_nand.h"
|
||||||
|
#endif /* HAL_NAND_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_NOR_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_nor.h"
|
||||||
|
#endif /* HAL_NOR_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_PCD_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_pcd.h"
|
||||||
|
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_PKA_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_pka.h"
|
||||||
|
#endif /* HAL_PKA_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_PSSI_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_pssi.h"
|
||||||
|
#endif /* HAL_PSSI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_PWR_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_pwr.h"
|
||||||
|
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_RAMECC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_ramecc.h"
|
||||||
|
#endif /* HAL_RAMECC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_RNG_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_rng.h"
|
||||||
|
#endif /* HAL_RNG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_RTC_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_rtc.h"
|
||||||
|
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SAI_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_sai.h"
|
||||||
|
#endif /* HAL_SAI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SD_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_sd.h"
|
||||||
|
#endif /* HAL_SD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SDIO_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_sdio.h"
|
||||||
|
#endif /* HAL_SDIO_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SDRAM_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_sdram.h"
|
||||||
|
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_smartcard.h"
|
||||||
|
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_smbus.h"
|
||||||
|
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_spdifrx.h"
|
||||||
|
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SPI_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_spi.h"
|
||||||
|
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_sram.h"
|
||||||
|
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_TIM_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_tim.h"
|
||||||
|
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_UART_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_uart.h"
|
||||||
|
#endif /* HAL_UART_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_USART_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_usart.h"
|
||||||
|
#endif /* HAL_USART_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_wwdg.h"
|
||||||
|
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_XSPI_MODULE_ENABLED
|
||||||
|
#include "stm32h7rsxx_hal_xspi.h"
|
||||||
|
#endif /* HAL_XSPI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
/**
|
||||||
|
* @brief The assert_param macro is used for function's parameters check.
|
||||||
|
* @param expr If expr is false, it calls assert_failed function
|
||||||
|
* which reports the name of the source file and the source
|
||||||
|
* line number of the call that failed.
|
||||||
|
* If expr is true, it returns no value.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
void assert_failed(uint8_t *file, uint32_t line);
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* STM32H7RSxx_HAL_CONF_H */
|
||||||
|
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7rsxx_it.h
|
||||||
|
* @brief This file contains the headers of the interrupt handlers.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32H7RSxx_IT_H
|
||||||
|
#define __STM32H7RSxx_IT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ET */
|
||||||
|
|
||||||
|
/* USER CODE END ET */
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EC */
|
||||||
|
|
||||||
|
/* USER CODE END EC */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EM */
|
||||||
|
|
||||||
|
/* USER CODE END EM */
|
||||||
|
|
||||||
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
|
void NMI_Handler(void);
|
||||||
|
void HardFault_Handler(void);
|
||||||
|
void MemManage_Handler(void);
|
||||||
|
void BusFault_Handler(void);
|
||||||
|
void UsageFault_Handler(void);
|
||||||
|
void DebugMon_Handler(void);
|
||||||
|
void EXTI3_IRQHandler(void);
|
||||||
|
void GPDMA1_Channel0_IRQHandler(void);
|
||||||
|
void GPDMA1_Channel2_IRQHandler(void);
|
||||||
|
void TIM6_IRQHandler(void);
|
||||||
|
void HPDMA1_Channel0_IRQHandler(void);
|
||||||
|
void HPDMA1_Channel1_IRQHandler(void);
|
||||||
|
void LTDC_IRQHandler(void);
|
||||||
|
void DMA2D_IRQHandler(void);
|
||||||
|
void JPEG_IRQHandler(void);
|
||||||
|
void ADF1_FLT0_IRQHandler(void);
|
||||||
|
void GPU2D_IRQHandler(void);
|
||||||
|
void GPU2D_ER_IRQHandler(void);
|
||||||
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __STM32H7RSxx_IT_H */
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7s78_discovery_conf.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief STM32H7S78-DK board configuration file.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32H7S78_DISCOVERY_CONF_H
|
||||||
|
#define STM32H7S78_DISCOVERY_CONF_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32h7rsxx_hal.h"
|
||||||
|
|
||||||
|
/* COM defines */
|
||||||
|
#define USE_COM_LOG 0U
|
||||||
|
#define USE_BSP_COM_FEATURE 1U
|
||||||
|
|
||||||
|
/* Touch Sensing controller defines */
|
||||||
|
#define USE_FT5336_TS_CTRL 1U
|
||||||
|
/* TS supported features defines */
|
||||||
|
#define USE_TS_GESTURE 1U
|
||||||
|
#define USE_TS_MULTI_TOUCH 1U
|
||||||
|
/* Default TS touch number */
|
||||||
|
#define TS_TOUCH_NBR 2U
|
||||||
|
|
||||||
|
/* LCD defines */
|
||||||
|
#define LCD_LAYER_0_ADDRESS 0x90000000U
|
||||||
|
#define LCD_LAYER_1_ADDRESS 0x90200000U
|
||||||
|
|
||||||
|
/* Default Audio IN internal buffer size */
|
||||||
|
#define DEFAULT_AUDIO_IN_BUFFER_SIZE 2048U
|
||||||
|
|
||||||
|
/* IRQ priorities (Default is 15 as lowest priority level) */
|
||||||
|
#define BSP_SDRAM_IT_PRIORITY 15U
|
||||||
|
#define BSP_BUTTON_USER_IT_PRIORITY 15U
|
||||||
|
#define BSP_AUDIO_OUT_IT_PRIORITY 2U // testé à 1 (au-dessus du micro) sur plusieurs redémarrages : aucun effet -> la contention NVIC n'est pas en cause
|
||||||
|
#define BSP_AUDIO_IN_IT_PRIORITY 2U
|
||||||
|
#define BSP_SD_IT_PRIORITY 14U
|
||||||
|
#define BSP_SD_RX_IT_PRIORITY 14U
|
||||||
|
#define BSP_SD_TX_IT_PRIORITY 15U
|
||||||
|
#define BSP_TS_IT_PRIORITY 15U
|
||||||
|
#define BSP_XSPI_RAM_IT_PRIORITY 15U
|
||||||
|
#define BSP_XSPI_RAM_DMA_IT_PRIORITY 15U
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* STM32H7S78_DISCOVERY_CONF_H */
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
#include "audio_analysis.h"
|
||||||
|
#include "arm_math.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define FFT_SIZE AUDIO_ANALYSIS_FFT_SIZE
|
||||||
|
#define NUM_BINS AUDIO_ANALYSIS_NUM_BINS
|
||||||
|
|
||||||
|
/* --- Capture en double buffer (ping-pong), ecrite depuis le chemin audio temps
|
||||||
|
* reel, lue depuis la tache IHM. Un seul ecrivain, un seul lecteur : pas de verrou
|
||||||
|
* necessaire, meme principe que la FIFO audio principale. --- */
|
||||||
|
static float g_capture_buf[2][FFT_SIZE];
|
||||||
|
static uint32_t g_capture_fill_idx = 0;
|
||||||
|
static uint8_t g_capture_write_buf = 0;
|
||||||
|
static volatile uint8_t g_capture_ready_buf = 0xFFU; /* 0xFF = aucun buffer complet en attente */
|
||||||
|
|
||||||
|
static bool g_analysis_enabled = false;
|
||||||
|
|
||||||
|
/* --- Fenetre precalculee (a l'init uniquement, jamais recalculee en boucle) --- */
|
||||||
|
static float g_hann_window[FFT_SIZE];
|
||||||
|
|
||||||
|
/* --- FFT reelle CMSIS-DSP : instance initialisee une fois, buffers de travail --- */
|
||||||
|
static arm_rfft_fast_instance_f32 g_rfft_instance;
|
||||||
|
static float g_fft_work[FFT_SIZE]; /* echantillons fenetres ; ecrase (scratch) par arm_rfft_fast_f32 */
|
||||||
|
static float g_fft_out[FFT_SIZE]; /* spectre complexe empaquete, format CMSIS (voir plus bas) */
|
||||||
|
|
||||||
|
static float g_magnitudes_db[NUM_BINS]; /* seule la moitie 0..Fe/2 est conservee */
|
||||||
|
static float g_peak_freq_hz = 0.0f;
|
||||||
|
|
||||||
|
static void AudioAnalysis_BuildTables(void)
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < FFT_SIZE; i++)
|
||||||
|
{
|
||||||
|
/* Fenetre de Hann : reduit les fuites spectrales dues a la troncature du bloc. */
|
||||||
|
g_hann_window[i] = 0.5f - 0.5f * cosf(2.0f * (float)M_PI * (float)i / (float)(FFT_SIZE - 1U));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioAnalysis_Init(void)
|
||||||
|
{
|
||||||
|
memset(g_capture_buf, 0, sizeof(g_capture_buf));
|
||||||
|
g_capture_fill_idx = 0;
|
||||||
|
g_capture_write_buf = 0;
|
||||||
|
g_capture_ready_buf = 0xFFU;
|
||||||
|
g_analysis_enabled = false;
|
||||||
|
|
||||||
|
memset(g_magnitudes_db, 0, sizeof(g_magnitudes_db));
|
||||||
|
|
||||||
|
AudioAnalysis_BuildTables();
|
||||||
|
arm_rfft_fast_init_f32(&g_rfft_instance, FFT_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioAnalysis_PushSample(float sample)
|
||||||
|
{
|
||||||
|
if (!g_analysis_enabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_capture_buf[g_capture_write_buf][g_capture_fill_idx] = sample;
|
||||||
|
g_capture_fill_idx++;
|
||||||
|
|
||||||
|
if (g_capture_fill_idx >= FFT_SIZE)
|
||||||
|
{
|
||||||
|
g_capture_fill_idx = 0;
|
||||||
|
g_capture_ready_buf = g_capture_write_buf;
|
||||||
|
g_capture_write_buf = 1U - g_capture_write_buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AudioAnalysis_Update(void)
|
||||||
|
{
|
||||||
|
if (!g_analysis_enabled)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ready = g_capture_ready_buf;
|
||||||
|
if (ready == 0xFFU)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
g_capture_ready_buf = 0xFFU;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < FFT_SIZE; i++)
|
||||||
|
{
|
||||||
|
g_fft_work[i] = g_capture_buf[ready][i] * g_hann_window[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* arm_rfft_fast_f32 (forward, ifftFlag=0) empaquete le spectre d'un signal reel
|
||||||
|
* en NUM_BINS paires {re,im}, sauf la premiere qui contient les deux seules
|
||||||
|
* valeurs reelles (DC et Nyquist) : g_fft_out[0]=X[0] (DC), g_fft_out[1]=X[N/2]
|
||||||
|
* (Nyquist, non utilise ici). Pour k=1..NUM_BINS-1 : re=g_fft_out[2k], im=g_fft_out[2k+1]. */
|
||||||
|
arm_rfft_fast_f32(&g_rfft_instance, g_fft_work, g_fft_out, 0);
|
||||||
|
|
||||||
|
/* Magnitude normalisee (une sinusoide plein-echelle donne ~0dB) puis convertie
|
||||||
|
* en dB, avec un plancher pour eviter log(0). Destine a un affichage visuel,
|
||||||
|
* pas a une mesure calibree. Seule la moitie 0..Fe/2 du spectre est conservee :
|
||||||
|
* le spectre d'un signal reel est symetrique, la seconde moitie n'apporte rien. */
|
||||||
|
/* Recherche du pic en meme temps que le calcul des magnitudes. Le bin 0 (continu,
|
||||||
|
* 0Hz) est ignore : une composante DC ne doit pas etre rapportee comme "frequence
|
||||||
|
* dominante". */
|
||||||
|
uint32_t peak_bin = 1U;
|
||||||
|
float peak_mag = 0.0f;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < NUM_BINS; i++)
|
||||||
|
{
|
||||||
|
float re = (i == 0U) ? g_fft_out[0] : g_fft_out[2U * i];
|
||||||
|
float im = (i == 0U) ? 0.0f : g_fft_out[2U * i + 1U];
|
||||||
|
float mag = sqrtf(re * re + im * im) / ((float)FFT_SIZE / 4.0f);
|
||||||
|
|
||||||
|
if (i >= 1U && mag > peak_mag)
|
||||||
|
{
|
||||||
|
peak_mag = mag;
|
||||||
|
peak_bin = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mag < 1.0e-6f)
|
||||||
|
{
|
||||||
|
mag = 1.0e-6f;
|
||||||
|
}
|
||||||
|
g_magnitudes_db[i] = 20.0f * log10f(mag);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_peak_freq_hz = (float)peak_bin * (float)AUDIO_ANALYSIS_SAMPLE_RATE_HZ / (float)FFT_SIZE;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float *AudioAnalysis_GetMagnitudesDb(void)
|
||||||
|
{
|
||||||
|
return g_magnitudes_db;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AudioAnalysis_GetPeakFrequencyHz(void)
|
||||||
|
{
|
||||||
|
return g_peak_freq_hz;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioAnalysis_SetEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
if (enabled && !g_analysis_enabled)
|
||||||
|
{
|
||||||
|
/* Redemarre une capture propre a chaque activation. */
|
||||||
|
g_capture_fill_idx = 0;
|
||||||
|
g_capture_write_buf = 0;
|
||||||
|
g_capture_ready_buf = 0xFFU;
|
||||||
|
}
|
||||||
|
g_analysis_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AudioAnalysis_IsEnabled(void)
|
||||||
|
{
|
||||||
|
return g_analysis_enabled;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#include "audio_effects.h"
|
||||||
|
|
||||||
|
static AudioEffectsParams g_params;
|
||||||
|
|
||||||
|
static FxOctaverState g_octaverState;
|
||||||
|
static FxEqualizerState g_eqState;
|
||||||
|
static FxOverdriveState g_overdriveState;
|
||||||
|
static FxSaturationState g_saturationState;
|
||||||
|
static FxEchoState g_echoState;
|
||||||
|
static FxReverbState g_reverbState;
|
||||||
|
|
||||||
|
void AudioEffects_Init(void)
|
||||||
|
{
|
||||||
|
g_params.audio_on_off = false;
|
||||||
|
g_params.master_volume = 0.0f;
|
||||||
|
FxOctaver_Init(&g_octaverState, &g_params.octaver);
|
||||||
|
FxEqualizer_Init(&g_eqState, &g_params.equalizer);
|
||||||
|
FxOverdrive_Init(&g_overdriveState, &g_params.overdrive);
|
||||||
|
FxSaturation_Init(&g_saturationState, &g_params.saturation);
|
||||||
|
FxEcho_Init(&g_echoState, &g_params.echo);
|
||||||
|
FxReverb_Init(&g_reverbState, &g_params.reverb);
|
||||||
|
}
|
||||||
|
|
||||||
|
float AudioEffects_Process(float input)
|
||||||
|
{
|
||||||
|
float sample = input;
|
||||||
|
sample = FxOctaver_Process(&g_octaverState, &g_params.octaver, sample);
|
||||||
|
sample = FxEqualizer_Process(&g_eqState, &g_params.equalizer, sample);
|
||||||
|
sample = FxOverdrive_Process(&g_overdriveState, &g_params.overdrive, sample);
|
||||||
|
sample = FxSaturation_Process(&g_saturationState, &g_params.saturation, sample);
|
||||||
|
sample = FxEcho_Process(&g_echoState, &g_params.echo, sample);
|
||||||
|
sample = FxReverb_Process(&g_reverbState, &g_params.reverb, sample);
|
||||||
|
|
||||||
|
/* Coupure de sortie : les effets continuent de tourner (pas de discontinuite
|
||||||
|
* d'etat au reactivation), seule la sortie audible est reduite au silence. */
|
||||||
|
if (!g_params.audio_on_off)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sample * g_params.master_volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioEffectsParams *AudioEffects_GetParams(void)
|
||||||
|
{
|
||||||
|
return &g_params;
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
#include "audio_looper.h"
|
||||||
|
|
||||||
|
/* 5s a 48kHz en float = 937.5 Ko : ne rentre pas en RAM interne, place en EXTRAM (meme
|
||||||
|
* section/region que le framebuffer TouchGFX, cf. AudioLooperBuffer dans le script de
|
||||||
|
* link). Accede uniquement par ce coeur (pas de DMA dessus) : pas de probleme de
|
||||||
|
* coherence de cache a gerer explicitement. */
|
||||||
|
__attribute__((section("AudioLooperBuffer")))
|
||||||
|
static float g_buffer[AUDIO_LOOPER_MAX_SAMPLES];
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
LOOPER_IDLE = 0,
|
||||||
|
LOOPER_RECORDING,
|
||||||
|
LOOPER_PLAYBACK
|
||||||
|
} LooperState;
|
||||||
|
|
||||||
|
/* g_state est ecrit depuis la tache IHM (Start/Stop) et lu/ecrit depuis le contexte
|
||||||
|
* audio temps reel (Process) : meme principe "un seul ecrivain a la fois par variable,
|
||||||
|
* volatile pour le flag d'etat partage" que le reste du projet (cf. audio_analysis.c). */
|
||||||
|
static volatile LooperState g_state = LOOPER_IDLE;
|
||||||
|
static uint32_t g_record_len = 0; /* nb d'echantillons valides captures, fige au relachement */
|
||||||
|
static uint32_t g_write_idx = 0; /* ecrit uniquement depuis Process() en RECORDING */
|
||||||
|
static float g_read_pos = 0.0f; /* lu/ecrit uniquement depuis Process() en PLAYBACK */
|
||||||
|
|
||||||
|
void AudioLooper_Init(void)
|
||||||
|
{
|
||||||
|
g_state = LOOPER_IDLE;
|
||||||
|
g_record_len = 0;
|
||||||
|
g_write_idx = 0;
|
||||||
|
g_read_pos = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioLooper_StartRecording(void)
|
||||||
|
{
|
||||||
|
g_write_idx = 0;
|
||||||
|
g_state = LOOPER_RECORDING;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioLooper_StopRecordingAndPlay(void)
|
||||||
|
{
|
||||||
|
if (g_state != LOOPER_RECORDING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_record_len = g_write_idx;
|
||||||
|
g_read_pos = 0.0f;
|
||||||
|
g_state = (g_record_len > 0U) ? LOOPER_PLAYBACK : LOOPER_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AudioLooper_Process(float sample_in)
|
||||||
|
{
|
||||||
|
switch (g_state)
|
||||||
|
{
|
||||||
|
case LOOPER_RECORDING:
|
||||||
|
if (g_write_idx < AUDIO_LOOPER_MAX_SAMPLES)
|
||||||
|
{
|
||||||
|
g_buffer[g_write_idx++] = sample_in;
|
||||||
|
}
|
||||||
|
/* Buffer plein (5s atteintes) : on cesse de capturer mais on reste en
|
||||||
|
* enregistrement, l'ecoute live continue jusqu'au relachement du bouton. */
|
||||||
|
return sample_in;
|
||||||
|
|
||||||
|
case LOOPER_PLAYBACK:
|
||||||
|
{
|
||||||
|
uint32_t idx0 = (uint32_t)g_read_pos;
|
||||||
|
if (idx0 >= g_record_len - 1U)
|
||||||
|
{
|
||||||
|
g_state = LOOPER_IDLE;
|
||||||
|
return sample_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Interpolation lineaire entre les deux echantillons encadrant la position de
|
||||||
|
* lecture fractionnaire : necessaire car AUDIO_LOOPER_PLAYBACK_RATIO avance le
|
||||||
|
* pointeur de lecture plus vite qu'un pas entier. */
|
||||||
|
float frac = g_read_pos - (float)idx0;
|
||||||
|
float s0 = g_buffer[idx0];
|
||||||
|
float s1 = g_buffer[idx0 + 1U];
|
||||||
|
float out = s0 + (s1 - s0) * frac;
|
||||||
|
|
||||||
|
g_read_pos += AUDIO_LOOPER_PLAYBACK_RATIO;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
case LOOPER_IDLE:
|
||||||
|
default:
|
||||||
|
return sample_in;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : freertos.c
|
||||||
|
* Description : Code for freertos applications
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PTD */
|
||||||
|
|
||||||
|
/* USER CODE END PTD */
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PD */
|
||||||
|
|
||||||
|
/* USER CODE END PD */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PM */
|
||||||
|
|
||||||
|
/* USER CODE END PM */
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Variables */
|
||||||
|
|
||||||
|
/* USER CODE END Variables */
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN FunctionPrototypes */
|
||||||
|
extern portBASE_TYPE IdleTaskHook(void* p);
|
||||||
|
/* USER CODE END FunctionPrototypes */
|
||||||
|
|
||||||
|
/* Hook prototypes */
|
||||||
|
void vApplicationIdleHook(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 2 */
|
||||||
|
void vApplicationIdleHook( void )
|
||||||
|
{
|
||||||
|
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||||
|
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||||
|
task. It is essential that code added to this hook function never attempts
|
||||||
|
to block in any way (for example, call xQueueReceive() with a block time
|
||||||
|
specified, or call vTaskDelay()). If the application makes use of the
|
||||||
|
vTaskDelete() API function (as this demo application does) then it is also
|
||||||
|
important that vApplicationIdleHook() is permitted to return to its calling
|
||||||
|
function, because it is the responsibility of the idle task to clean up
|
||||||
|
memory allocated by the kernel to any task that has since been deleted. */
|
||||||
|
|
||||||
|
vTaskSetApplicationTaskTag(NULL, IdleTaskHook);
|
||||||
|
}
|
||||||
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
|
/* Private application code --------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Application */
|
||||||
|
|
||||||
|
/* USER CODE END Application */
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#include "fx_echo.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void FxEcho_Init(FxEchoState *state, FxEchoParams *params)
|
||||||
|
{
|
||||||
|
memset(state->buffer, 0, sizeof(state->buffer));
|
||||||
|
state->write_idx = 0;
|
||||||
|
|
||||||
|
params->enabled = false;
|
||||||
|
params->delay_ms = 300.0f;
|
||||||
|
params->feedback = 0.35f;
|
||||||
|
params->mix = 0.3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float FxEcho_Process(FxEchoState *state, const FxEchoParams *params, float input)
|
||||||
|
{
|
||||||
|
if (!params->enabled)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t delay_samples = (uint32_t)(params->delay_ms * (FX_ECHO_SAMPLE_RATE / 1000.0f));
|
||||||
|
if (delay_samples >= FX_ECHO_BUFFER_SIZE)
|
||||||
|
{
|
||||||
|
delay_samples = FX_ECHO_BUFFER_SIZE - 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t read_idx = (state->write_idx + FX_ECHO_BUFFER_SIZE - delay_samples) % FX_ECHO_BUFFER_SIZE;
|
||||||
|
float delayed = (float)state->buffer[read_idx] / 32768.0f;
|
||||||
|
|
||||||
|
float to_store = input + delayed * params->feedback;
|
||||||
|
if (to_store > 1.0f) to_store = 1.0f;
|
||||||
|
if (to_store < -1.0f) to_store = -1.0f;
|
||||||
|
state->buffer[state->write_idx] = (int16_t)(to_store * 32767.0f);
|
||||||
|
state->write_idx = (state->write_idx + 1U) % FX_ECHO_BUFFER_SIZE;
|
||||||
|
|
||||||
|
return input * (1.0f - params->mix) + delayed * params->mix;
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#include "fx_equalizer.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define FX_EQ_SAMPLE_RATE 48000.0f
|
||||||
|
|
||||||
|
static const float fx_eq_default_freqs[FX_EQ_NUM_BANDS] =
|
||||||
|
{
|
||||||
|
31.0f, 62.0f, 125.0f, 250.0f, 500.0f, 1000.0f, 2000.0f, 4000.0f, 8000.0f, 16000.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
void FxEqualizer_Init(FxEqualizerState *state, FxEqualizerParams *params)
|
||||||
|
{
|
||||||
|
params->enabled = true;
|
||||||
|
for (uint32_t i = 0; i < FX_EQ_NUM_BANDS; i++)
|
||||||
|
{
|
||||||
|
params->bands[i].freq_hz = fx_eq_default_freqs[i];
|
||||||
|
params->bands[i].gain_db = 0.0f;
|
||||||
|
params->bands[i].q = 1.0f;
|
||||||
|
|
||||||
|
state->band_state[i].last_freq_hz = -1.0f; /* force le calcul des coefficients au 1er sample */
|
||||||
|
state->band_state[i].last_gain_db = 0.0f;
|
||||||
|
state->band_state[i].last_q = 0.0f;
|
||||||
|
state->x1[i] = state->x2[i] = state->y1[i] = state->y2[i] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pour couper les basses par defaukt et éviter les larsens :
|
||||||
|
params->bands[0].gain_db = -15.0f;
|
||||||
|
params->bands[1].gain_db = -10.0f;
|
||||||
|
params->bands[2].gain_db = -2.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filtre "peaking EQ" (cloche), formule de l'Audio EQ Cookbook (Robert Bristow-Johnson). */
|
||||||
|
static void FxEq_ComputeBandCoeffs(FxEqBandState *bs, const FxEqBand *band)
|
||||||
|
{
|
||||||
|
float A = powf(10.0f, band->gain_db / 40.0f);
|
||||||
|
float w0 = 2.0f * (float)M_PI * band->freq_hz / FX_EQ_SAMPLE_RATE;
|
||||||
|
float alpha = sinf(w0) / (2.0f * band->q);
|
||||||
|
float cosw0 = cosf(w0);
|
||||||
|
|
||||||
|
float a0 = 1.0f + alpha / A;
|
||||||
|
bs->b0 = (1.0f + alpha * A) / a0;
|
||||||
|
bs->b1 = (-2.0f * cosw0) / a0;
|
||||||
|
bs->b2 = (1.0f - alpha * A) / a0;
|
||||||
|
bs->a1 = (-2.0f * cosw0) / a0;
|
||||||
|
bs->a2 = (1.0f - alpha / A) / a0;
|
||||||
|
|
||||||
|
bs->last_freq_hz = band->freq_hz;
|
||||||
|
bs->last_gain_db = band->gain_db;
|
||||||
|
bs->last_q = band->q;
|
||||||
|
}
|
||||||
|
|
||||||
|
float FxEqualizer_Process(FxEqualizerState *state, const FxEqualizerParams *params, float input)
|
||||||
|
{
|
||||||
|
if (!params->enabled)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
float y = input;
|
||||||
|
for (uint32_t i = 0; i < FX_EQ_NUM_BANDS; i++)
|
||||||
|
{
|
||||||
|
const FxEqBand *band = ¶ms->bands[i];
|
||||||
|
FxEqBandState *bs = &state->band_state[i];
|
||||||
|
|
||||||
|
if (band->freq_hz != bs->last_freq_hz || band->gain_db != bs->last_gain_db || band->q != bs->last_q)
|
||||||
|
{
|
||||||
|
FxEq_ComputeBandCoeffs(bs, band);
|
||||||
|
}
|
||||||
|
|
||||||
|
float x = y;
|
||||||
|
y = bs->b0 * x + bs->b1 * state->x1[i] + bs->b2 * state->x2[i]
|
||||||
|
- bs->a1 * state->y1[i] - bs->a2 * state->y2[i];
|
||||||
|
|
||||||
|
state->x2[i] = state->x1[i];
|
||||||
|
state->x1[i] = x;
|
||||||
|
state->y2[i] = state->y1[i];
|
||||||
|
state->y1[i] = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return y;
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
#include "fx_octaver.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define FX_OCTAVER_BUFFER_MASK (FX_OCTAVER_BUFFER_SIZE - 1U)
|
||||||
|
#define FX_OCTAVER_ENV_TABLE_SIZE 256U
|
||||||
|
|
||||||
|
/* Rapport de vitesse de lecture pour chaque voix : lire le buffer plus vite que
|
||||||
|
* l'ecriture multiplie la frequence (octave au-dessus), plus lentement la divise
|
||||||
|
* (octave en-dessous). */
|
||||||
|
static const float fx_octaver_ratios[FX_OCTAVER_NUM_VOICES] =
|
||||||
|
{
|
||||||
|
0.25f, /* -2 octaves */
|
||||||
|
0.5f, /* -1 octave */
|
||||||
|
2.0f, /* +1 octave */
|
||||||
|
4.0f /* +2 octaves */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Fenetre de Hann tabulee (evite un cosf() par grain et par echantillon). */
|
||||||
|
static float fx_octaver_env_table[FX_OCTAVER_ENV_TABLE_SIZE + 1U];
|
||||||
|
static bool fx_octaver_env_table_ready = false;
|
||||||
|
|
||||||
|
static void FxOctaver_BuildEnvTable(void)
|
||||||
|
{
|
||||||
|
if (fx_octaver_env_table_ready)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (uint32_t i = 0; i <= FX_OCTAVER_ENV_TABLE_SIZE; i++)
|
||||||
|
{
|
||||||
|
float phase = (float)i / (float)FX_OCTAVER_ENV_TABLE_SIZE;
|
||||||
|
fx_octaver_env_table[i] = 0.5f - 0.5f * cosf(2.0f * (float)M_PI * phase);
|
||||||
|
}
|
||||||
|
fx_octaver_env_table_ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline float FxOctaver_EnvLookup(float phase)
|
||||||
|
{
|
||||||
|
float pos = phase * (float)FX_OCTAVER_ENV_TABLE_SIZE;
|
||||||
|
uint32_t i0 = (uint32_t)pos;
|
||||||
|
if (i0 >= FX_OCTAVER_ENV_TABLE_SIZE)
|
||||||
|
{
|
||||||
|
i0 = FX_OCTAVER_ENV_TABLE_SIZE - 1U;
|
||||||
|
}
|
||||||
|
float frac = pos - (float)i0;
|
||||||
|
return fx_octaver_env_table[i0] * (1.0f - frac) + fx_octaver_env_table[i0 + 1U] * frac;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline float FxOctaver_ReadInterpolated(const float *buffer, uint32_t write_idx, float delay)
|
||||||
|
{
|
||||||
|
/* write_idx grandit sans jamais etre replie (compteur perpetuel) ; le convertir
|
||||||
|
* directement en float finirait par perdre en precision (un float ne represente
|
||||||
|
* exactement les entiers que jusqu'a ~16.7 millions, soit quelques minutes a
|
||||||
|
* 48kHz). On calcule donc la position de lecture uniquement a partir de l'index
|
||||||
|
* DEJA REPLIE dans le buffer, qui reste toujours petit. */
|
||||||
|
float write_pos = (float)(write_idx & FX_OCTAVER_BUFFER_MASK);
|
||||||
|
float read_pos = write_pos - delay;
|
||||||
|
while (read_pos < 0.0f)
|
||||||
|
{
|
||||||
|
read_pos += (float)FX_OCTAVER_BUFFER_SIZE;
|
||||||
|
}
|
||||||
|
uint32_t i0 = (uint32_t)read_pos & FX_OCTAVER_BUFFER_MASK;
|
||||||
|
uint32_t i1 = (i0 + 1U) & FX_OCTAVER_BUFFER_MASK;
|
||||||
|
float frac = read_pos - (float)(uint32_t)read_pos;
|
||||||
|
return buffer[i0] * (1.0f - frac) + buffer[i1] * frac;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lecteur de grains a deux pointeurs en fondu croise : chaque pointeur avance
|
||||||
|
* (ou recule) dans le buffer a une vitesse "ratio" differente de celle de
|
||||||
|
* l'ecriture, ce qui change la hauteur percue. Les deux grains sont toujours
|
||||||
|
* en opposition de phase exacte (decales d'un demi-grain a l'origine, et le
|
||||||
|
* meme increment est applique aux deux avant chaque repli) : la fenetre de
|
||||||
|
* Hann du second grain vaut donc toujours 1 moins celle du premier, ce qui
|
||||||
|
* garantit un niveau de sortie constant pendant le fondu et evite un second
|
||||||
|
* calcul de fenetre. */
|
||||||
|
static float FxOctaver_ProcessVoice(FxOctaverVoiceState *vs, const float *buffer, uint32_t write_idx, float ratio)
|
||||||
|
{
|
||||||
|
float step = 1.0f - ratio;
|
||||||
|
|
||||||
|
for (uint32_t g = 0; g < 2U; g++)
|
||||||
|
{
|
||||||
|
vs->delay[g] += step;
|
||||||
|
if (vs->delay[g] >= (float)FX_OCTAVER_GRAIN_SIZE)
|
||||||
|
{
|
||||||
|
vs->delay[g] -= (float)FX_OCTAVER_GRAIN_SIZE;
|
||||||
|
}
|
||||||
|
else if (vs->delay[g] < 0.0f)
|
||||||
|
{
|
||||||
|
vs->delay[g] += (float)FX_OCTAVER_GRAIN_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float phase0 = vs->delay[0] / (float)FX_OCTAVER_GRAIN_SIZE;
|
||||||
|
float env0 = FxOctaver_EnvLookup(phase0);
|
||||||
|
float env1 = 1.0f - env0;
|
||||||
|
|
||||||
|
float sample0 = FxOctaver_ReadInterpolated(buffer, write_idx, vs->delay[0]);
|
||||||
|
float sample1 = FxOctaver_ReadInterpolated(buffer, write_idx, vs->delay[1]);
|
||||||
|
|
||||||
|
return env0 * sample0 + env1 * sample1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FxOctaver_Init(FxOctaverState *state, FxOctaverParams *params)
|
||||||
|
{
|
||||||
|
params->enabled = false;
|
||||||
|
params->level_down2 = 0.0f;
|
||||||
|
params->level_down1 = 0.0f;
|
||||||
|
params->level_dry = 1.0f;
|
||||||
|
params->level_up1 = 0.0f;
|
||||||
|
params->level_up2 = 0.0f;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < FX_OCTAVER_BUFFER_SIZE; i++)
|
||||||
|
{
|
||||||
|
state->buffer[i] = 0.0f;
|
||||||
|
}
|
||||||
|
state->write_idx = 0U;
|
||||||
|
|
||||||
|
for (uint32_t v = 0; v < FX_OCTAVER_NUM_VOICES; v++)
|
||||||
|
{
|
||||||
|
state->voices[v].delay[0] = 0.0f;
|
||||||
|
state->voices[v].delay[1] = (float)FX_OCTAVER_GRAIN_SIZE * 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
FxOctaver_BuildEnvTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
float FxOctaver_Process(FxOctaverState *state, const FxOctaverParams *params, float input)
|
||||||
|
{
|
||||||
|
if (!params->enabled)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
state->buffer[state->write_idx & FX_OCTAVER_BUFFER_MASK] = input;
|
||||||
|
|
||||||
|
float down2 = FxOctaver_ProcessVoice(&state->voices[0], state->buffer, state->write_idx, fx_octaver_ratios[0]);
|
||||||
|
float down1 = FxOctaver_ProcessVoice(&state->voices[1], state->buffer, state->write_idx, fx_octaver_ratios[1]);
|
||||||
|
float up1 = FxOctaver_ProcessVoice(&state->voices[2], state->buffer, state->write_idx, fx_octaver_ratios[2]);
|
||||||
|
float up2 = FxOctaver_ProcessVoice(&state->voices[3], state->buffer, state->write_idx, fx_octaver_ratios[3]);
|
||||||
|
|
||||||
|
state->write_idx++;
|
||||||
|
|
||||||
|
return input * params->level_dry
|
||||||
|
+ down2 * params->level_down2
|
||||||
|
+ down1 * params->level_down1
|
||||||
|
+ up1 * params->level_up1
|
||||||
|
+ up2 * params->level_up2;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include "fx_overdrive.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
void FxOverdrive_Init(FxOverdriveState *state, FxOverdriveParams *params)
|
||||||
|
{
|
||||||
|
state->tone_lp_state = 0.0f;
|
||||||
|
|
||||||
|
params->enabled = false;
|
||||||
|
params->drive = 0.4f;
|
||||||
|
params->tone = 0.6f;
|
||||||
|
params->level = 0.7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float FxOverdrive_Process(FxOverdriveState *state, const FxOverdriveParams *params, float input)
|
||||||
|
{
|
||||||
|
if (!params->enabled)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
float driven = input * (1.0f + params->drive * 20.0f);
|
||||||
|
|
||||||
|
/* Ecretage asymetrique (exponentiel) : plus caracteristique/agressif qu'un tanh symetrique. */
|
||||||
|
float shaped;
|
||||||
|
if (driven >= 0.0f)
|
||||||
|
{
|
||||||
|
shaped = 1.0f - expf(-driven);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shaped = -1.0f + expf(driven);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filtre passe-bas une pole pour la tonalite : coefficient = tone (0..1). */
|
||||||
|
float coeff = 0.05f + params->tone * 0.9f;
|
||||||
|
state->tone_lp_state += coeff * (shaped - state->tone_lp_state);
|
||||||
|
|
||||||
|
return state->tone_lp_state * params->level;
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
#include "fx_reverb.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Lignes a retard inspirees de Freeverb (Jezar), redimensionnees de 44.1kHz vers 48kHz. */
|
||||||
|
#define FX_REVERB_COMB0 1215U
|
||||||
|
#define FX_REVERB_COMB1 1293U
|
||||||
|
#define FX_REVERB_COMB2 1390U
|
||||||
|
#define FX_REVERB_COMB3 1476U
|
||||||
|
#define FX_REVERB_COMB4 1548U
|
||||||
|
#define FX_REVERB_COMB5 1623U
|
||||||
|
#define FX_REVERB_COMB6 1695U
|
||||||
|
#define FX_REVERB_COMB7 1761U
|
||||||
|
|
||||||
|
#define FX_REVERB_ALLPASS0 605U
|
||||||
|
#define FX_REVERB_ALLPASS1 480U
|
||||||
|
#define FX_REVERB_ALLPASS2 371U
|
||||||
|
#define FX_REVERB_ALLPASS3 245U
|
||||||
|
|
||||||
|
static float fx_reverb_comb_buf0[FX_REVERB_COMB0];
|
||||||
|
static float fx_reverb_comb_buf1[FX_REVERB_COMB1];
|
||||||
|
static float fx_reverb_comb_buf2[FX_REVERB_COMB2];
|
||||||
|
static float fx_reverb_comb_buf3[FX_REVERB_COMB3];
|
||||||
|
static float fx_reverb_comb_buf4[FX_REVERB_COMB4];
|
||||||
|
static float fx_reverb_comb_buf5[FX_REVERB_COMB5];
|
||||||
|
static float fx_reverb_comb_buf6[FX_REVERB_COMB6];
|
||||||
|
static float fx_reverb_comb_buf7[FX_REVERB_COMB7];
|
||||||
|
|
||||||
|
static float fx_reverb_allpass_buf0[FX_REVERB_ALLPASS0];
|
||||||
|
static float fx_reverb_allpass_buf1[FX_REVERB_ALLPASS1];
|
||||||
|
static float fx_reverb_allpass_buf2[FX_REVERB_ALLPASS2];
|
||||||
|
static float fx_reverb_allpass_buf3[FX_REVERB_ALLPASS3];
|
||||||
|
|
||||||
|
static float FxComb_Process(FxCombState *c, float input, float feedback, float damp1, float damp2)
|
||||||
|
{
|
||||||
|
float output = c->buffer[c->idx];
|
||||||
|
c->filter_store = (output * damp2) + (c->filter_store * damp1);
|
||||||
|
c->buffer[c->idx] = input + (c->filter_store * feedback);
|
||||||
|
c->idx = (c->idx + 1U) % c->size;
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float FxAllpass_Process(FxAllpassState *a, float input, float feedback)
|
||||||
|
{
|
||||||
|
float buf_out = a->buffer[a->idx];
|
||||||
|
float output = -input + buf_out;
|
||||||
|
a->buffer[a->idx] = input + buf_out * feedback;
|
||||||
|
a->idx = (a->idx + 1U) % a->size;
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FxReverb_Init(FxReverbState *state, FxReverbParams *params)
|
||||||
|
{
|
||||||
|
params->enabled = false;
|
||||||
|
params->room_size = 0.5f;
|
||||||
|
params->damping = 0.5f;
|
||||||
|
params->mix = 0.3f;
|
||||||
|
|
||||||
|
float *comb_buffers[FX_REVERB_NUM_COMBS] = {
|
||||||
|
fx_reverb_comb_buf0, fx_reverb_comb_buf1, fx_reverb_comb_buf2, fx_reverb_comb_buf3,
|
||||||
|
fx_reverb_comb_buf4, fx_reverb_comb_buf5, fx_reverb_comb_buf6, fx_reverb_comb_buf7
|
||||||
|
};
|
||||||
|
uint32_t comb_sizes[FX_REVERB_NUM_COMBS] = {
|
||||||
|
FX_REVERB_COMB0, FX_REVERB_COMB1, FX_REVERB_COMB2, FX_REVERB_COMB3,
|
||||||
|
FX_REVERB_COMB4, FX_REVERB_COMB5, FX_REVERB_COMB6, FX_REVERB_COMB7
|
||||||
|
};
|
||||||
|
for (uint32_t i = 0; i < FX_REVERB_NUM_COMBS; i++)
|
||||||
|
{
|
||||||
|
state->combs[i].buffer = comb_buffers[i];
|
||||||
|
state->combs[i].size = comb_sizes[i];
|
||||||
|
state->combs[i].idx = 0;
|
||||||
|
state->combs[i].filter_store = 0.0f;
|
||||||
|
memset(comb_buffers[i], 0, comb_sizes[i] * sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
|
float *allpass_buffers[FX_REVERB_NUM_ALLPASS] = {
|
||||||
|
fx_reverb_allpass_buf0, fx_reverb_allpass_buf1, fx_reverb_allpass_buf2, fx_reverb_allpass_buf3
|
||||||
|
};
|
||||||
|
uint32_t allpass_sizes[FX_REVERB_NUM_ALLPASS] = {
|
||||||
|
FX_REVERB_ALLPASS0, FX_REVERB_ALLPASS1, FX_REVERB_ALLPASS2, FX_REVERB_ALLPASS3
|
||||||
|
};
|
||||||
|
for (uint32_t i = 0; i < FX_REVERB_NUM_ALLPASS; i++)
|
||||||
|
{
|
||||||
|
state->allpass[i].buffer = allpass_buffers[i];
|
||||||
|
state->allpass[i].size = allpass_sizes[i];
|
||||||
|
state->allpass[i].idx = 0;
|
||||||
|
memset(allpass_buffers[i], 0, allpass_sizes[i] * sizeof(float));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float FxReverb_Process(FxReverbState *state, const FxReverbParams *params, float input)
|
||||||
|
{
|
||||||
|
if (!params->enabled)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
float feedback = 0.28f + params->room_size * 0.7f;
|
||||||
|
float damp1 = params->damping * 0.4f;
|
||||||
|
float damp2 = 1.0f - damp1;
|
||||||
|
|
||||||
|
float out = 0.0f;
|
||||||
|
for (uint32_t i = 0; i < FX_REVERB_NUM_COMBS; i++)
|
||||||
|
{
|
||||||
|
out += FxComb_Process(&state->combs[i], input, feedback, damp1, damp2);
|
||||||
|
}
|
||||||
|
out /= (float)FX_REVERB_NUM_COMBS;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < FX_REVERB_NUM_ALLPASS; i++)
|
||||||
|
{
|
||||||
|
out = FxAllpass_Process(&state->allpass[i], out, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return input * (1.0f - params->mix) + out * params->mix;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#include "fx_saturation.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define FX_SATURATION_DC_BLOCK_R 0.995f
|
||||||
|
|
||||||
|
void FxSaturation_Init(FxSaturationState *state, FxSaturationParams *params)
|
||||||
|
{
|
||||||
|
state->dc_block_x1 = 0.0f;
|
||||||
|
state->dc_block_y1 = 0.0f;
|
||||||
|
|
||||||
|
params->enabled = false;
|
||||||
|
params->drive = 0.3f;
|
||||||
|
params->level = 0.8f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float FxSaturation_Process(FxSaturationState *state, const FxSaturationParams *params, float input)
|
||||||
|
{
|
||||||
|
if (!params->enabled)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
float driven = input * (1.0f + params->drive * 12.0f);
|
||||||
|
float shaped = tanhf(driven);
|
||||||
|
|
||||||
|
/* Le tanh sur un signal non symetrique introduit un leger DC : filtre bloqueur de DC. */
|
||||||
|
float y = shaped - state->dc_block_x1 + FX_SATURATION_DC_BLOCK_R * state->dc_block_y1;
|
||||||
|
state->dc_block_x1 = shaped;
|
||||||
|
state->dc_block_y1 = y;
|
||||||
|
|
||||||
|
return y * params->level;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,803 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7rsxx_hal_msp.c
|
||||||
|
* @brief This file provides code for the MSP Initialization
|
||||||
|
* and de-Initialization codes.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
extern DMA_NodeTypeDef Node_GPDMA1_Channel0;
|
||||||
|
|
||||||
|
extern DMA_QListTypeDef List_GPDMA1_Channel0;
|
||||||
|
|
||||||
|
extern DMA_HandleTypeDef handle_GPDMA1_Channel0;
|
||||||
|
|
||||||
|
extern DMA_HandleTypeDef handle_HPDMA1_Channel1;
|
||||||
|
|
||||||
|
extern DMA_HandleTypeDef handle_HPDMA1_Channel0;
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN TD */
|
||||||
|
|
||||||
|
/* USER CODE END TD */
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Define */
|
||||||
|
|
||||||
|
/* USER CODE END Define */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Macro */
|
||||||
|
|
||||||
|
/* USER CODE END Macro */
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
|
/* USER CODE END PV */
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
|
/* External functions --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ExternalFunctions */
|
||||||
|
|
||||||
|
/* USER CODE END ExternalFunctions */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
/**
|
||||||
|
* Initializes the Global MSP.
|
||||||
|
*/
|
||||||
|
void HAL_MspInit(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END MspInit 0 */
|
||||||
|
|
||||||
|
/* System interrupt init*/
|
||||||
|
/* PendSV_IRQn interrupt configuration */
|
||||||
|
HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MDF MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hmdf: MDF handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_MDF_MspInit(MDF_HandleTypeDef* hmdf)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
DMA_NodeConfTypeDef NodeConfig;
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||||
|
if(IS_MDF_ALL_INSTANCE(hmdf->Instance))
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADF1_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADF1_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADF1;
|
||||||
|
PeriphClkInit.Adf1ClockSelection = RCC_ADF1CLKSOURCE_PLL2P;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_ADF1_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
/**ADF1 GPIO Configuration
|
||||||
|
PE2 ------> ADF1_CCK0
|
||||||
|
PD6 ------> ADF1_SDI0
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = ADF1_CK_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; // était LOW : bien trop lent pour piloter proprement une horloge à 6-12MHz+ vers le micro PDM
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF1_ADF1;
|
||||||
|
HAL_GPIO_Init(ADF1_CK_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = ADF1_D_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF3_ADF1;
|
||||||
|
HAL_GPIO_Init(ADF1_D_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* ADF1 DMA Init */
|
||||||
|
/* GPDMA1_REQUEST_ADF1_FLT0 Init */
|
||||||
|
NodeConfig.NodeType = DMA_GPDMA_LINEAR_NODE;
|
||||||
|
NodeConfig.Init.Request = GPDMA1_REQUEST_ADF1_FLT0;
|
||||||
|
NodeConfig.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
|
||||||
|
NodeConfig.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||||
|
NodeConfig.Init.SrcInc = DMA_SINC_FIXED;
|
||||||
|
NodeConfig.Init.DestInc = DMA_DINC_INCREMENTED;
|
||||||
|
NodeConfig.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_WORD;
|
||||||
|
NodeConfig.Init.DestDataWidth = DMA_DEST_DATAWIDTH_WORD;
|
||||||
|
NodeConfig.Init.SrcBurstLength = 1;
|
||||||
|
NodeConfig.Init.DestBurstLength = 1;
|
||||||
|
NodeConfig.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0|DMA_DEST_ALLOCATED_PORT1;
|
||||||
|
NodeConfig.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
|
||||||
|
NodeConfig.Init.Mode = DMA_NORMAL;
|
||||||
|
NodeConfig.TriggerConfig.TriggerPolarity = DMA_TRIG_POLARITY_MASKED;
|
||||||
|
NodeConfig.DataHandlingConfig.DataExchange = DMA_EXCHANGE_NONE;
|
||||||
|
NodeConfig.DataHandlingConfig.DataAlignment = DMA_DATA_RIGHTALIGN_ZEROPADDED;
|
||||||
|
if (HAL_DMAEx_List_BuildNode(&NodeConfig, &Node_GPDMA1_Channel0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HAL_DMAEx_List_InsertNode(&List_GPDMA1_Channel0, NULL, &Node_GPDMA1_Channel0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HAL_DMAEx_List_SetCircularMode(&List_GPDMA1_Channel0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_GPDMA1_Channel0.Instance = GPDMA1_Channel0;
|
||||||
|
handle_GPDMA1_Channel0.InitLinkedList.Priority = DMA_HIGH_PRIORITY;
|
||||||
|
handle_GPDMA1_Channel0.InitLinkedList.LinkStepMode = DMA_LSM_FULL_EXECUTION;
|
||||||
|
handle_GPDMA1_Channel0.InitLinkedList.LinkAllocatedPort = DMA_LINK_ALLOCATED_PORT1;
|
||||||
|
handle_GPDMA1_Channel0.InitLinkedList.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
|
||||||
|
handle_GPDMA1_Channel0.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_CIRCULAR;
|
||||||
|
if (HAL_DMAEx_List_Init(&handle_GPDMA1_Channel0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HAL_DMAEx_List_LinkQ(&handle_GPDMA1_Channel0, &List_GPDMA1_Channel0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
__HAL_LINKDMA(hmdf, hdma, handle_GPDMA1_Channel0);
|
||||||
|
|
||||||
|
if (HAL_DMA_ConfigChannelAttributes(&handle_GPDMA1_Channel0, DMA_CHANNEL_NPRIV) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ADF1 interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(ADF1_FLT0_IRQn, 2, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(ADF1_FLT0_IRQn);
|
||||||
|
/* USER CODE BEGIN ADF1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADF1_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MDF MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hmdf: MDF handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_MDF_MspDeInit(MDF_HandleTypeDef* hmdf)
|
||||||
|
{
|
||||||
|
if(IS_MDF_ALL_INSTANCE(hmdf->Instance))
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADF1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADF1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_ADF1_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**ADF1 GPIO Configuration
|
||||||
|
PE2 ------> ADF1_CCK0
|
||||||
|
PD6 ------> ADF1_SDI0
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(ADF1_CK_GPIO_Port, ADF1_CK_Pin);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(ADF1_D_GPIO_Port, ADF1_D_Pin);
|
||||||
|
|
||||||
|
/* ADF1 DMA DeInit */
|
||||||
|
HAL_DMA_DeInit(hmdf->hdma);
|
||||||
|
|
||||||
|
/* ADF1 interrupt DeInit */
|
||||||
|
HAL_NVIC_DisableIRQ(ADF1_FLT0_IRQn);
|
||||||
|
/* USER CODE BEGIN ADF1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADF1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CRC MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hcrc: CRC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_CRC_MspInit(CRC_HandleTypeDef* hcrc)
|
||||||
|
{
|
||||||
|
if(hcrc->Instance==CRC)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN CRC_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END CRC_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_CRC_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN CRC_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END CRC_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CRC MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hcrc: CRC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_CRC_MspDeInit(CRC_HandleTypeDef* hcrc)
|
||||||
|
{
|
||||||
|
if(hcrc->Instance==CRC)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN CRC_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END CRC_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_CRC_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN CRC_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END CRC_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DMA2D MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hdma2d: DMA2D handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d)
|
||||||
|
{
|
||||||
|
if(hdma2d->Instance==DMA2D)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DMA2D_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_DMA2D_CLK_ENABLE();
|
||||||
|
/* DMA2D interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(DMA2D_IRQn, 5, 0);
|
||||||
|
/* USER CODE BEGIN DMA2D_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DMA2D MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hdma2d: DMA2D handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d)
|
||||||
|
{
|
||||||
|
if(hdma2d->Instance==DMA2D)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DMA2D_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_DMA2D_CLK_DISABLE();
|
||||||
|
|
||||||
|
/* DMA2D interrupt DeInit */
|
||||||
|
HAL_NVIC_DisableIRQ(DMA2D_IRQn);
|
||||||
|
/* USER CODE BEGIN DMA2D_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GPU2D MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hgpu2d: GPU2D handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_GPU2D_MspInit(GPU2D_HandleTypeDef* hgpu2d)
|
||||||
|
{
|
||||||
|
if(hgpu2d->Instance==GPU2D)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN GPU2D_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_GPU2D_CLK_ENABLE();
|
||||||
|
/* GPU2D interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(GPU2D_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(GPU2D_IRQn);
|
||||||
|
HAL_NVIC_SetPriority(GPU2D_ER_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(GPU2D_ER_IRQn);
|
||||||
|
/* USER CODE BEGIN GPU2D_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GPU2D MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hgpu2d: GPU2D handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_GPU2D_MspDeInit(GPU2D_HandleTypeDef* hgpu2d)
|
||||||
|
{
|
||||||
|
if(hgpu2d->Instance==GPU2D)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN GPU2D_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_GPU2D_CLK_DISABLE();
|
||||||
|
|
||||||
|
/* GPU2D interrupt DeInit */
|
||||||
|
HAL_NVIC_DisableIRQ(GPU2D_IRQn);
|
||||||
|
HAL_NVIC_DisableIRQ(GPU2D_ER_IRQn);
|
||||||
|
/* USER CODE BEGIN GPU2D_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief I2C MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hi2c: I2C handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||||
|
if(hi2c->Instance==I2C1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN I2C1_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_I2C1_I3C1;
|
||||||
|
PeriphClkInit.I2c1_I3c1ClockSelection = RCC_I2C1_I3C1CLKSOURCE_PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**I2C1 GPIO Configuration
|
||||||
|
PB9 ------> I2C1_SDA
|
||||||
|
PB6 ------> I2C1_SCL
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_I2C1_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN I2C1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief I2C MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hi2c: I2C handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
|
||||||
|
{
|
||||||
|
if(hi2c->Instance==I2C1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN I2C1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_I2C1_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**I2C1 GPIO Configuration
|
||||||
|
PB9 ------> I2C1_SDA
|
||||||
|
PB6 ------> I2C1_SCL
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_9);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN I2C1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief JPEG MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hjpeg: JPEG handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_JPEG_MspInit(JPEG_HandleTypeDef* hjpeg)
|
||||||
|
{
|
||||||
|
DMA_DataHandlingConfTypeDef DataHandlingConfig;
|
||||||
|
if(hjpeg->Instance==JPEG)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN JPEG_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_JPEG_CLK_ENABLE();
|
||||||
|
|
||||||
|
/* JPEG DMA Init */
|
||||||
|
/* HPDMA1_REQUEST_JPEG_TX Init */
|
||||||
|
handle_HPDMA1_Channel1.Instance = HPDMA1_Channel1;
|
||||||
|
handle_HPDMA1_Channel1.Init.Request = HPDMA1_REQUEST_JPEG_TX;
|
||||||
|
handle_HPDMA1_Channel1.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
|
||||||
|
handle_HPDMA1_Channel1.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||||
|
handle_HPDMA1_Channel1.Init.SrcInc = DMA_SINC_FIXED;
|
||||||
|
handle_HPDMA1_Channel1.Init.DestInc = DMA_DINC_INCREMENTED;
|
||||||
|
handle_HPDMA1_Channel1.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_WORD;
|
||||||
|
handle_HPDMA1_Channel1.Init.DestDataWidth = DMA_DEST_DATAWIDTH_WORD;
|
||||||
|
handle_HPDMA1_Channel1.Init.Priority = DMA_HIGH_PRIORITY;
|
||||||
|
handle_HPDMA1_Channel1.Init.SrcBurstLength = 8;
|
||||||
|
handle_HPDMA1_Channel1.Init.DestBurstLength = 8;
|
||||||
|
handle_HPDMA1_Channel1.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT1|DMA_DEST_ALLOCATED_PORT0;
|
||||||
|
handle_HPDMA1_Channel1.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
|
||||||
|
handle_HPDMA1_Channel1.Init.Mode = DMA_NORMAL;
|
||||||
|
if (HAL_DMA_Init(&handle_HPDMA1_Channel1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
__HAL_LINKDMA(hjpeg, hdmaout, handle_HPDMA1_Channel1);
|
||||||
|
|
||||||
|
if (HAL_DMA_ConfigChannelAttributes(&handle_HPDMA1_Channel1, DMA_CHANNEL_NPRIV) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HPDMA1_REQUEST_JPEG_RX Init */
|
||||||
|
handle_HPDMA1_Channel0.Instance = HPDMA1_Channel0;
|
||||||
|
handle_HPDMA1_Channel0.Init.Request = HPDMA1_REQUEST_JPEG_RX;
|
||||||
|
handle_HPDMA1_Channel0.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
|
||||||
|
handle_HPDMA1_Channel0.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||||
|
handle_HPDMA1_Channel0.Init.SrcInc = DMA_SINC_INCREMENTED;
|
||||||
|
handle_HPDMA1_Channel0.Init.DestInc = DMA_DINC_FIXED;
|
||||||
|
handle_HPDMA1_Channel0.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_BYTE;
|
||||||
|
handle_HPDMA1_Channel0.Init.DestDataWidth = DMA_DEST_DATAWIDTH_WORD;
|
||||||
|
handle_HPDMA1_Channel0.Init.Priority = DMA_HIGH_PRIORITY;
|
||||||
|
handle_HPDMA1_Channel0.Init.SrcBurstLength = 8;
|
||||||
|
handle_HPDMA1_Channel0.Init.DestBurstLength = 8;
|
||||||
|
handle_HPDMA1_Channel0.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0|DMA_DEST_ALLOCATED_PORT1;
|
||||||
|
handle_HPDMA1_Channel0.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
|
||||||
|
handle_HPDMA1_Channel0.Init.Mode = DMA_NORMAL;
|
||||||
|
if (HAL_DMA_Init(&handle_HPDMA1_Channel0) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
DataHandlingConfig.DataExchange = DMA_EXCHANGE_NONE;
|
||||||
|
DataHandlingConfig.DataAlignment = DMA_DATA_PACK;
|
||||||
|
if (HAL_DMAEx_ConfigDataHandling(&handle_HPDMA1_Channel0, &DataHandlingConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
__HAL_LINKDMA(hjpeg, hdmain, handle_HPDMA1_Channel0);
|
||||||
|
|
||||||
|
if (HAL_DMA_ConfigChannelAttributes(&handle_HPDMA1_Channel0, DMA_CHANNEL_NPRIV) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* JPEG interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(JPEG_IRQn, 8, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(JPEG_IRQn);
|
||||||
|
/* USER CODE BEGIN JPEG_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief JPEG MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hjpeg: JPEG handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_JPEG_MspDeInit(JPEG_HandleTypeDef* hjpeg)
|
||||||
|
{
|
||||||
|
if(hjpeg->Instance==JPEG)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN JPEG_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_JPEG_CLK_DISABLE();
|
||||||
|
|
||||||
|
/* JPEG DMA DeInit */
|
||||||
|
HAL_DMA_DeInit(hjpeg->hdmaout);
|
||||||
|
HAL_DMA_DeInit(hjpeg->hdmain);
|
||||||
|
|
||||||
|
/* JPEG interrupt DeInit */
|
||||||
|
HAL_NVIC_DisableIRQ(JPEG_IRQn);
|
||||||
|
/* USER CODE BEGIN JPEG_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LTDC MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hltdc: LTDC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||||
|
if(hltdc->Instance==LTDC)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LTDC_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
|
||||||
|
PeriphClkInit.LtdcClockSelection = RCC_LTDCCLKSOURCE_PLL3R;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_LTDC_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
/**LTDC GPIO Configuration
|
||||||
|
PF0 ------> LTDC_R2
|
||||||
|
PG0 ------> LTDC_R7
|
||||||
|
PB3(JTDO/TRACESWO) ------> LTDC_R4
|
||||||
|
PG2 ------> LTDC_HSYNC
|
||||||
|
PE11 ------> LTDC_VSYNC
|
||||||
|
PA12 ------> LTDC_B2
|
||||||
|
PA11 ------> LTDC_B3
|
||||||
|
PB4(NJTRST) ------> LTDC_R3
|
||||||
|
PA9 ------> LTDC_B5
|
||||||
|
PG1 ------> LTDC_R6
|
||||||
|
PA10 ------> LTDC_B4
|
||||||
|
PG14 ------> LTDC_B1
|
||||||
|
PA8 ------> LTDC_B6
|
||||||
|
PG13 ------> LTDC_CLK
|
||||||
|
PA15(JTDI) ------> LTDC_R5
|
||||||
|
PF7 ------> LTDC_G0
|
||||||
|
PF9 ------> LTDC_R0
|
||||||
|
PF10 ------> LTDC_R1
|
||||||
|
PB12 ------> LTDC_G5
|
||||||
|
PA0 ------> LTDC_G3
|
||||||
|
PA1 ------> LTDC_G2
|
||||||
|
PF11 ------> LTDC_B0
|
||||||
|
PB14 ------> LTDC_DE
|
||||||
|
PB15 ------> LTDC_G7
|
||||||
|
PF15 ------> LTDC_G1
|
||||||
|
PB11 ------> LTDC_G6
|
||||||
|
PB13 ------> LTDC_G4
|
||||||
|
PA6 ------> LTDC_B7
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF11_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_2|GPIO_PIN_1|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_13;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF13_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_12|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF13_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF11_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_11|GPIO_PIN_8|GPIO_PIN_15
|
||||||
|
|GPIO_PIN_0|GPIO_PIN_1;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF13_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_9|GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF13_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_15|GPIO_PIN_13;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF10_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_LTDC;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* LTDC interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(LTDC_IRQn, 5, 0);
|
||||||
|
/* USER CODE BEGIN LTDC_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LTDC MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hltdc: LTDC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc)
|
||||||
|
{
|
||||||
|
if(hltdc->Instance==LTDC)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LTDC_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_LTDC_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**LTDC GPIO Configuration
|
||||||
|
PF0 ------> LTDC_R2
|
||||||
|
PG0 ------> LTDC_R7
|
||||||
|
PB3(JTDO/TRACESWO) ------> LTDC_R4
|
||||||
|
PG2 ------> LTDC_HSYNC
|
||||||
|
PE11 ------> LTDC_VSYNC
|
||||||
|
PA12 ------> LTDC_B2
|
||||||
|
PA11 ------> LTDC_B3
|
||||||
|
PB4(NJTRST) ------> LTDC_R3
|
||||||
|
PA9 ------> LTDC_B5
|
||||||
|
PG1 ------> LTDC_R6
|
||||||
|
PA10 ------> LTDC_B4
|
||||||
|
PG14 ------> LTDC_B1
|
||||||
|
PA8 ------> LTDC_B6
|
||||||
|
PG13 ------> LTDC_CLK
|
||||||
|
PA15(JTDI) ------> LTDC_R5
|
||||||
|
PF7 ------> LTDC_G0
|
||||||
|
PF9 ------> LTDC_R0
|
||||||
|
PF10 ------> LTDC_R1
|
||||||
|
PB12 ------> LTDC_G5
|
||||||
|
PA0 ------> LTDC_G3
|
||||||
|
PA1 ------> LTDC_G2
|
||||||
|
PF11 ------> LTDC_B0
|
||||||
|
PB14 ------> LTDC_DE
|
||||||
|
PB15 ------> LTDC_G7
|
||||||
|
PF15 ------> LTDC_G1
|
||||||
|
PB11 ------> LTDC_G6
|
||||||
|
PB13 ------> LTDC_G4
|
||||||
|
PA6 ------> LTDC_B7
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_0|GPIO_PIN_7|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_11|GPIO_PIN_15);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_0|GPIO_PIN_2|GPIO_PIN_1|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_13);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_12|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15|GPIO_PIN_11|GPIO_PIN_13);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOE, GPIO_PIN_11);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_12|GPIO_PIN_11|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_8|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1
|
||||||
|
|GPIO_PIN_6);
|
||||||
|
|
||||||
|
/* LTDC interrupt DeInit */
|
||||||
|
HAL_NVIC_DisableIRQ(LTDC_IRQn);
|
||||||
|
/* USER CODE BEGIN LTDC_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7rsxx_hal_timebase_tim.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Template for HAL time base based on the peripheral hardware TIM6.
|
||||||
|
*
|
||||||
|
* This file override the native HAL time base functions (defined as weak)
|
||||||
|
* the TIM time base:
|
||||||
|
* + Initializes the TIM6 peripheral to generate a Period elapsed Event each 1ms
|
||||||
|
* + HAL_IncTick is called inside HAL_TIM_PeriodElapsedCallback ie each 1ms
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32h7rsxx_hal.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup HAL_TimeBase
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
#define TIM_CNT_FREQ 1000000U /* Timer counter frequency : 1 MHz */
|
||||||
|
#define TIM_FREQ 1000U /* Timer frequency : 1 kHz => to have 1 ms interrupt */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
TIM_HandleTypeDef htim6;
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1U)
|
||||||
|
void TimeBase_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim);
|
||||||
|
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function configures the TIM6 as a time base source.
|
||||||
|
* The time source is configured to have 1ms time base with a dedicated
|
||||||
|
* Tick interrupt priority.
|
||||||
|
* @note This function is called automatically at the beginning of program after
|
||||||
|
* reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
|
||||||
|
* @param TickPriority Tick interrupt priority.
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||||
|
{
|
||||||
|
RCC_ClkInitTypeDef clkconfig;
|
||||||
|
uint32_t uwTimclock;
|
||||||
|
uint32_t uwAPB1Prescaler;
|
||||||
|
uint32_t uwPrescalerValue;
|
||||||
|
uint32_t pFLatency;
|
||||||
|
HAL_StatusTypeDef Status;
|
||||||
|
|
||||||
|
/* Enable TIM6 clock */
|
||||||
|
__HAL_RCC_TIM6_CLK_ENABLE();
|
||||||
|
|
||||||
|
/* Get clock configuration */
|
||||||
|
HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
|
||||||
|
|
||||||
|
/* Get APB1 prescaler */
|
||||||
|
uwAPB1Prescaler = clkconfig.APB1CLKDivider;
|
||||||
|
|
||||||
|
/* Compute TIM6 clock */
|
||||||
|
if (uwAPB1Prescaler == RCC_APB1_DIV1)
|
||||||
|
{
|
||||||
|
uwTimclock = HAL_RCC_GetPCLK1Freq();
|
||||||
|
}
|
||||||
|
else if (uwAPB1Prescaler == RCC_APB1_DIV2)
|
||||||
|
{
|
||||||
|
uwTimclock = 2UL * HAL_RCC_GetPCLK1Freq();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (__HAL_RCC_GET_TIMCLKPRESCALER() == RCC_TIMPRES_DISABLE)
|
||||||
|
{
|
||||||
|
uwTimclock = 2UL * HAL_RCC_GetPCLK1Freq();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uwTimclock = 4UL * HAL_RCC_GetPCLK1Freq();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compute the prescaler value to have TIM6 counter clock equal to TIM_CNT_FREQ */
|
||||||
|
uwPrescalerValue = (uint32_t)((uwTimclock / TIM_CNT_FREQ) - 1U);
|
||||||
|
|
||||||
|
/* Initialize TIM6 */
|
||||||
|
htim6.Instance = TIM6;
|
||||||
|
|
||||||
|
/* Initialize TIMx peripheral as follow:
|
||||||
|
+ Period = [uwTickFreq * (TIM_CNT_FREQ/TIM_FREQ) - 1]. to have a (uwTickFreq/TIM_FREQ) s time base.
|
||||||
|
+ Prescaler = (uwTimclock/TIM_CNT_FREQ - 1) to have a TIM_CNT_FREQ counter clock.
|
||||||
|
+ ClockDivision = 0
|
||||||
|
+ Counter direction = Up
|
||||||
|
*/
|
||||||
|
htim6.Init.Period = ((uint32_t)uwTickFreq * (TIM_CNT_FREQ / TIM_FREQ)) - 1U;
|
||||||
|
htim6.Init.Prescaler = uwPrescalerValue;
|
||||||
|
htim6.Init.ClockDivision = 0;
|
||||||
|
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
|
htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
|
Status = HAL_TIM_Base_Init(&htim6);
|
||||||
|
if (Status == HAL_OK)
|
||||||
|
{
|
||||||
|
#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1U)
|
||||||
|
HAL_TIM_RegisterCallback(&htim6, HAL_TIM_PERIOD_ELAPSED_CB_ID, TimeBase_TIM_PeriodElapsedCallback);
|
||||||
|
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
|
||||||
|
/* Start the TIM time Base generation in interrupt mode */
|
||||||
|
Status = HAL_TIM_Base_Start_IT(&htim6);
|
||||||
|
if (Status == HAL_OK)
|
||||||
|
{
|
||||||
|
if (TickPriority < (1UL << __NVIC_PRIO_BITS))
|
||||||
|
{
|
||||||
|
/* Configure the TIM6 global Interrupt priority */
|
||||||
|
HAL_NVIC_SetPriority(TIM6_IRQn, TickPriority, 0);
|
||||||
|
|
||||||
|
/* Enable the TIM6 global Interrupt */
|
||||||
|
HAL_NVIC_EnableIRQ(TIM6_IRQn);
|
||||||
|
|
||||||
|
uwTickPrio = TickPriority;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = HAL_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return function status */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Suspend Tick increment.
|
||||||
|
* @note Disable the tick increment by disabling TIM6 update interrupt.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_SuspendTick(void)
|
||||||
|
{
|
||||||
|
/* Disable TIM6 update interrupt */
|
||||||
|
__HAL_TIM_DISABLE_IT(&htim6, TIM_IT_UPDATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Resume Tick increment.
|
||||||
|
* @note Enable the tick increment by enabling TIM6 update interrupt.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_ResumeTick(void)
|
||||||
|
{
|
||||||
|
/* Enable TIM6 update interrupt */
|
||||||
|
__HAL_TIM_ENABLE_IT(&htim6, TIM_IT_UPDATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Period elapsed callback in non blocking mode
|
||||||
|
* @note This function is called when TIM6 interrupt took place, inside
|
||||||
|
* HAL_TIM6_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
|
||||||
|
* a global variable "uwTick" used as application time base.
|
||||||
|
* @param htim TIM handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1U)
|
||||||
|
void TimeBase_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||||
|
{
|
||||||
|
/* Prevent unused argument(s) compilation warning */
|
||||||
|
UNUSED(htim);
|
||||||
|
|
||||||
|
HAL_IncTick();
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
@@ -0,0 +1,337 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7rsxx_it.c
|
||||||
|
* @brief Interrupt Service Routines.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
#include "stm32h7rsxx_it.h"
|
||||||
|
|
||||||
|
#include "stm32h7s78_discovery_audio.h"
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN TD */
|
||||||
|
|
||||||
|
/* USER CODE END TD */
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PD */
|
||||||
|
|
||||||
|
/* USER CODE END PD */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PM */
|
||||||
|
|
||||||
|
/* USER CODE END PM */
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
|
/* USER CODE END PV */
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
|
/* Private user code ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/* External variables --------------------------------------------------------*/
|
||||||
|
extern DMA_NodeTypeDef Node_GPDMA1_Channel0;
|
||||||
|
extern DMA_QListTypeDef List_GPDMA1_Channel0;
|
||||||
|
extern DMA_HandleTypeDef handle_GPDMA1_Channel0;
|
||||||
|
extern MDF_HandleTypeDef AdfHandle0;
|
||||||
|
extern DMA2D_HandleTypeDef hdma2d;
|
||||||
|
extern GPU2D_HandleTypeDef hgpu2d;
|
||||||
|
extern DMA_HandleTypeDef handle_HPDMA1_Channel1;
|
||||||
|
extern DMA_HandleTypeDef handle_HPDMA1_Channel0;
|
||||||
|
extern JPEG_HandleTypeDef hjpeg;
|
||||||
|
extern LTDC_HandleTypeDef hltdc;
|
||||||
|
extern TIM_HandleTypeDef htim6;
|
||||||
|
|
||||||
|
extern DMA_HandleTypeDef hDmaI2sTx;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN EV */
|
||||||
|
|
||||||
|
/* USER CODE END EV */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Cortex Processor Interruption and Exception Handlers */
|
||||||
|
/******************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief This function handles Non maskable interrupt.
|
||||||
|
*/
|
||||||
|
void NMI_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE END NonMaskableInt_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Hard fault interrupt.
|
||||||
|
*/
|
||||||
|
void HardFault_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN HardFault_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END HardFault_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
||||||
|
/* USER CODE END W1_HardFault_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Memory management fault.
|
||||||
|
*/
|
||||||
|
void MemManage_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END MemoryManagement_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
|
||||||
|
/* USER CODE END W1_MemoryManagement_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Pre-fetch fault, memory access fault.
|
||||||
|
*/
|
||||||
|
void BusFault_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN BusFault_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END BusFault_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
|
||||||
|
/* USER CODE END W1_BusFault_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Undefined instruction or illegal state.
|
||||||
|
*/
|
||||||
|
void UsageFault_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN UsageFault_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END UsageFault_IRQn 0 */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
|
||||||
|
/* USER CODE END W1_UsageFault_IRQn 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Debug monitor.
|
||||||
|
*/
|
||||||
|
void DebugMon_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DebugMonitor_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DebugMonitor_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* STM32H7RSxx Peripheral Interrupt Handlers */
|
||||||
|
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||||
|
/* For the available peripheral interrupt handler names, */
|
||||||
|
/* please refer to the startup file (startup_stm32h7rsxx.s). */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles EXTI line3 interrupt.
|
||||||
|
*/
|
||||||
|
void EXTI3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN EXTI3_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI3_IRQn 0 */
|
||||||
|
HAL_GPIO_EXTI_IRQHandler(TP_IRQ_Pin);
|
||||||
|
/* USER CODE BEGIN EXTI3_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI3_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles GPDMA1 Channel 0 global interrupt.
|
||||||
|
*/
|
||||||
|
void GPDMA1_Channel0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN GPDMA1_Channel0_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END GPDMA1_Channel0_IRQn 0 */
|
||||||
|
HAL_DMA_IRQHandler(&handle_GPDMA1_Channel0);
|
||||||
|
/* USER CODE BEGIN GPDMA1_Channel0_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END GPDMA1_Channel0_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPDMA1_Channel2_IRQHandler(void)
|
||||||
|
{
|
||||||
|
BSP_AUDIO_OUT_IRQHandler(0, AUDIO_OUT_HEADPHONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles TIM6 global interrupt.
|
||||||
|
*/
|
||||||
|
void TIM6_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM6_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM6_IRQn 0 */
|
||||||
|
HAL_TIM_IRQHandler(&htim6);
|
||||||
|
/* USER CODE BEGIN TIM6_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM6_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles HPDMA1 Channel 0 global interrupt.
|
||||||
|
*/
|
||||||
|
void HPDMA1_Channel0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN HPDMA1_Channel0_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END HPDMA1_Channel0_IRQn 0 */
|
||||||
|
HAL_DMA_IRQHandler(&handle_HPDMA1_Channel0);
|
||||||
|
/* USER CODE BEGIN HPDMA1_Channel0_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END HPDMA1_Channel0_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles HPDMA1 Channel 1 global interrupt.
|
||||||
|
*/
|
||||||
|
void HPDMA1_Channel1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN HPDMA1_Channel1_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END HPDMA1_Channel1_IRQn 0 */
|
||||||
|
HAL_DMA_IRQHandler(&handle_HPDMA1_Channel1);
|
||||||
|
/* USER CODE BEGIN HPDMA1_Channel1_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END HPDMA1_Channel1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles LTDC global interrupt.
|
||||||
|
*/
|
||||||
|
void LTDC_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LTDC_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_IRQn 0 */
|
||||||
|
HAL_LTDC_IRQHandler(&hltdc);
|
||||||
|
/* USER CODE BEGIN LTDC_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LTDC_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles DMA2D global interrupt.
|
||||||
|
*/
|
||||||
|
void DMA2D_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DMA2D_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_IRQn 0 */
|
||||||
|
HAL_DMA2D_IRQHandler(&hdma2d);
|
||||||
|
/* USER CODE BEGIN DMA2D_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2D_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles JPEG global interrupt.
|
||||||
|
*/
|
||||||
|
void JPEG_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN JPEG_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_IRQn 0 */
|
||||||
|
HAL_JPEG_IRQHandler(&hjpeg);
|
||||||
|
/* USER CODE BEGIN JPEG_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END JPEG_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles ADF1 Filter 0 global Interrupt.
|
||||||
|
*/
|
||||||
|
void ADF1_FLT0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADF1_FLT0_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADF1_FLT0_IRQn 0 */
|
||||||
|
HAL_MDF_IRQHandler(&AdfHandle0);
|
||||||
|
/* USER CODE BEGIN ADF1_FLT0_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADF1_FLT0_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles GPU2D global interrupt.
|
||||||
|
*/
|
||||||
|
void GPU2D_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN GPU2D_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_IRQn 0 */
|
||||||
|
HAL_GPU2D_IRQHandler(&hgpu2d);
|
||||||
|
/* USER CODE BEGIN GPU2D_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles GPU2D Error interrupt.
|
||||||
|
*/
|
||||||
|
void GPU2D_ER_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN GPU2D_ER_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_ER_IRQn 0 */
|
||||||
|
HAL_GPU2D_ER_IRQHandler(&hgpu2d);
|
||||||
|
/* USER CODE BEGIN GPU2D_ER_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END GPU2D_ER_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
@@ -0,0 +1,304 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file system_stm32h7rsxx.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief CMSIS Cortex-M7 Device Peripheral Access Layer System Source File
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* This file provides two functions and one global variable to be called from
|
||||||
|
* user application:
|
||||||
|
* - SystemInit(): This function is called at startup just after reset and
|
||||||
|
* before branch to main program. This call is made inside
|
||||||
|
* the "startup_stm32h7rsxx.s" file.
|
||||||
|
*
|
||||||
|
* - SystemCoreClock variable: Contains the core clock (sys_cpu_ck), it can
|
||||||
|
* be used by the user application to setup the
|
||||||
|
* SysTick timer or configure other parameters.
|
||||||
|
*
|
||||||
|
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
|
||||||
|
* be called whenever the core clock is changed
|
||||||
|
* during program execution.
|
||||||
|
*
|
||||||
|
* After each device reset the HSI (64 MHz) is used as system clock source.
|
||||||
|
* Then SystemInit() function is called, in "startup_stm32h7rsxx.s" file, to
|
||||||
|
* optionally configure the system clock before to branch to main program.
|
||||||
|
*
|
||||||
|
*=============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup CMSIS
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System_Private_Includes
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stm32h7rsxx.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System_Private_TypesDefinitions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System_Private_Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if !defined (HSE_VALUE)
|
||||||
|
#define HSE_VALUE 24000000UL /*!< Value of the High-Speed External oscillator in Hz */
|
||||||
|
#endif /* HSE_VALUE */
|
||||||
|
|
||||||
|
#if !defined (HSI_VALUE)
|
||||||
|
#define HSI_VALUE 64000000UL /*!< Value of the High-Speed Internal oscillator in Hz */
|
||||||
|
#endif /* HSI_VALUE */
|
||||||
|
|
||||||
|
#if !defined (CSI_VALUE)
|
||||||
|
#define CSI_VALUE 4000000UL /*!< Value of the Low-power Internal oscillator in Hz */
|
||||||
|
#endif /* CSI_VALUE */
|
||||||
|
|
||||||
|
/* Note: Following vector table addresses must be defined in line with linker
|
||||||
|
configuration. */
|
||||||
|
/*!< Uncomment the following line or define USER_VECT_TAB_ADDRESS at compiler level if you need
|
||||||
|
to relocate the vector table anywhere in Flash or Sram, else the vector table is kept at
|
||||||
|
the automatic remap of the selected boot address */
|
||||||
|
/* #define USER_VECT_TAB_ADDRESS */
|
||||||
|
|
||||||
|
#if defined(USER_VECT_TAB_ADDRESS)
|
||||||
|
/*!< Uncomment the following line or define VECT_TAB_SRAM at compiler level if you need
|
||||||
|
to relocate your vector Table in Sram else user remap will be done in Flash. */
|
||||||
|
/* #define VECT_TAB_SRAM */
|
||||||
|
|
||||||
|
#if defined(VECT_TAB_SRAM)
|
||||||
|
#if !defined(VECT_TAB_BASE_ADDRESS)
|
||||||
|
#define VECT_TAB_BASE_ADDRESS ITCM_BASE /*!< Vector Table base address field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#endif
|
||||||
|
#if !defined(VECT_TAB_OFFSET)
|
||||||
|
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if !defined(VECT_TAB_BASE_ADDRESS)
|
||||||
|
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#endif
|
||||||
|
#if !defined(VECT_TAB_OFFSET)
|
||||||
|
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||||
|
This value must be a multiple of 0x400. */
|
||||||
|
#endif
|
||||||
|
#endif /* VECT_TAB_SRAM */
|
||||||
|
#endif /* USER_VECT_TAB_ADDRESS */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System_Private_Variables
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* The SystemCoreClock variable is updated in two ways:
|
||||||
|
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||||
|
2) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||||
|
Note: If you use this function to configure the system clock; then there
|
||||||
|
is no need to call the first function listed above, since SystemCoreClock
|
||||||
|
variable is updated automatically.
|
||||||
|
*/
|
||||||
|
uint32_t SystemCoreClock = HSI_VALUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System_Private_FunctionPrototypes
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7RSxx_System_Private_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Setup the microcontroller system.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
|
||||||
|
void SystemInit(void)
|
||||||
|
{
|
||||||
|
/* Configure the Vector Table location -------------------------------------*/
|
||||||
|
#if defined(USER_VECT_TAB_ADDRESS)
|
||||||
|
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* FPU settings ------------------------------------------------------------*/
|
||||||
|
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||||
|
SCB->CPACR |= ((3UL << 20U)|(3UL << 22U)); /* set CP10 and CP11 Full Access */
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update SystemCoreClock variable according to RCC registers values.
|
||||||
|
* The SystemCoreClock variable contains the core clock (sys_cpu_ck), it can
|
||||||
|
* be used by the user application to setup the SysTick timer or configure
|
||||||
|
* other parameters.
|
||||||
|
*
|
||||||
|
* @note Each time the core clock changes, this function must be called
|
||||||
|
* to update SystemCoreClock variable value. Otherwise, any configuration
|
||||||
|
* based on this variable will be incorrect.
|
||||||
|
*
|
||||||
|
* @note - The system frequency computed by this function is not the real
|
||||||
|
* frequency in the chip. It is calculated based on the predefined
|
||||||
|
* constant and the selected clock source:
|
||||||
|
*
|
||||||
|
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
|
||||||
|
*
|
||||||
|
* - If SYSCLK source is CSI, SystemCoreClock will contain the CSI_VALUE(**)
|
||||||
|
*
|
||||||
|
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
|
||||||
|
*
|
||||||
|
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSI_VALUE(*)
|
||||||
|
* or CSI_VALUE(**) or HSE_VALUE(***) multiplied/divided by the PLL factors.
|
||||||
|
*
|
||||||
|
* (*) HSI_VALUE is a constant defined in stm32h7rsxx_hal.h file (default value
|
||||||
|
* 64 MHz) but the real value may vary depending on the variations
|
||||||
|
* in voltage and temperature.
|
||||||
|
*
|
||||||
|
* (**) CSI_VALUE is a constant defined in stm32h7rsxx_hal.h file (default value
|
||||||
|
* 4 MHz) but the real value may vary depending on the variations
|
||||||
|
* in voltage and temperature.
|
||||||
|
*
|
||||||
|
* (***) HSE_VALUE is a constant defined in stm32h7rsxx_hal.h file (default value
|
||||||
|
* 24 MHz), user has to ensure that HSE_VALUE is same as the real
|
||||||
|
* frequency of the crystal used. Otherwise, this function may
|
||||||
|
* have wrong result.
|
||||||
|
*
|
||||||
|
* - The result of this function could be not correct when using fractional
|
||||||
|
* value for HSE crystal.
|
||||||
|
*
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void SystemCoreClockUpdate(void)
|
||||||
|
{
|
||||||
|
uint32_t sysclk, hsivalue, pllsource, pllm, pllp, core_presc;
|
||||||
|
float_t pllfracn, pllvco;
|
||||||
|
|
||||||
|
/* Get SYSCLK source -------------------------------------------------------*/
|
||||||
|
switch (RCC->CFGR & RCC_CFGR_SWS)
|
||||||
|
{
|
||||||
|
case 0x00: /* HSI used as system clock source (default after reset) */
|
||||||
|
sysclk = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> RCC_CR_HSIDIV_Pos));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x08: /* CSI used as system clock source */
|
||||||
|
sysclk = CSI_VALUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x10: /* HSE used as system clock source */
|
||||||
|
sysclk = HSE_VALUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x18: /* PLL1 used as system clock source */
|
||||||
|
/* PLL1_VCO = (HSE_VALUE or HSI_VALUE or CSI_VALUE/ PLLM) * PLLN
|
||||||
|
SYSCLK = PLL1_VCO / PLL1R
|
||||||
|
*/
|
||||||
|
pllsource = (RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC);
|
||||||
|
pllm = ((RCC->PLLCKSELR & RCC_PLLCKSELR_DIVM1) >> RCC_PLLCKSELR_DIVM1_Pos) ;
|
||||||
|
if ((RCC->PLLCFGR & RCC_PLLCFGR_PLL1FRACEN) != 0U)
|
||||||
|
{
|
||||||
|
pllfracn = (float_t)(uint32_t)(((RCC->PLL1FRACR & RCC_PLL1FRACR_FRACN)>> RCC_PLL1FRACR_FRACN_Pos));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pllfracn = (float_t)0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pllm != 0U)
|
||||||
|
{
|
||||||
|
switch (pllsource)
|
||||||
|
{
|
||||||
|
case 0x02: /* HSE used as PLL1 clock source */
|
||||||
|
pllvco = ((float_t)HSE_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVN) + (pllfracn/(float_t)0x2000) +(float_t)1 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x01: /* CSI used as PLL1 clock source */
|
||||||
|
pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVN) + (pllfracn/(float_t)0x2000) +(float_t)1 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x00: /* HSI used as PLL1 clock source */
|
||||||
|
default:
|
||||||
|
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> RCC_CR_HSIDIV_Pos));
|
||||||
|
pllvco = ( (float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVN) + (pllfracn/(float_t)0x2000) +(float_t)1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pllp = (((RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVP) >> RCC_PLL1DIVR1_DIVP_Pos) + 1U ) ;
|
||||||
|
sysclk = (uint32_t)(float_t)(pllvco/(float_t)pllp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sysclk = 0U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* Unexpected, default to HSI used as system clock source (default after reset) */
|
||||||
|
sysclk = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> RCC_CR_HSIDIV_Pos));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* system clock frequency : CM7 CPU frequency */
|
||||||
|
core_presc = (RCC->CDCFGR & RCC_CDCFGR_CPRE);
|
||||||
|
if (core_presc >= 8U)
|
||||||
|
{
|
||||||
|
SystemCoreClock = (sysclk >> (core_presc - RCC_CDCFGR_CPRE_3 + 1U));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SystemCoreClock = sysclk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,351 @@
|
|||||||
|
The Independent JPEG Group's JPEG software
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
README for release 8d of 15-Jan-2012
|
||||||
|
====================================
|
||||||
|
|
||||||
|
This distribution contains the eighth public release of the Independent JPEG
|
||||||
|
Group's free JPEG software. You are welcome to redistribute this software and
|
||||||
|
to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
|
||||||
|
|
||||||
|
This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone,
|
||||||
|
Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson,
|
||||||
|
Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers,
|
||||||
|
and other members of the Independent JPEG Group.
|
||||||
|
|
||||||
|
IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee
|
||||||
|
(also known as JPEG, together with ITU-T SG16).
|
||||||
|
|
||||||
|
|
||||||
|
DOCUMENTATION ROADMAP
|
||||||
|
=====================
|
||||||
|
|
||||||
|
This file contains the following sections:
|
||||||
|
|
||||||
|
OVERVIEW General description of JPEG and the IJG software.
|
||||||
|
LEGAL ISSUES Copyright, lack of warranty, terms of distribution.
|
||||||
|
REFERENCES Where to learn more about JPEG.
|
||||||
|
ARCHIVE LOCATIONS Where to find newer versions of this software.
|
||||||
|
ACKNOWLEDGMENTS Special thanks.
|
||||||
|
FILE FORMAT WARS Software *not* to get.
|
||||||
|
TO DO Plans for future IJG releases.
|
||||||
|
|
||||||
|
Other documentation files in the distribution are:
|
||||||
|
|
||||||
|
User documentation:
|
||||||
|
install.txt How to configure and install the IJG software.
|
||||||
|
usage.txt Usage instructions for cjpeg, djpeg, jpegtran,
|
||||||
|
rdjpgcom, and wrjpgcom.
|
||||||
|
*.1 Unix-style man pages for programs (same info as usage.txt).
|
||||||
|
wizard.txt Advanced usage instructions for JPEG wizards only.
|
||||||
|
change.log Version-to-version change highlights.
|
||||||
|
Programmer and internal documentation:
|
||||||
|
libjpeg.txt How to use the JPEG library in your own programs.
|
||||||
|
example.c Sample code for calling the JPEG library.
|
||||||
|
structure.txt Overview of the JPEG library's internal structure.
|
||||||
|
filelist.txt Road map of IJG files.
|
||||||
|
coderules.txt Coding style rules --- please read if you contribute code.
|
||||||
|
|
||||||
|
Please read at least the files install.txt and usage.txt. Some information
|
||||||
|
can also be found in the JPEG FAQ (Frequently Asked Questions) article. See
|
||||||
|
ARCHIVE LOCATIONS below to find out where to obtain the FAQ article.
|
||||||
|
|
||||||
|
If you want to understand how the JPEG code works, we suggest reading one or
|
||||||
|
more of the REFERENCES, then looking at the documentation files (in roughly
|
||||||
|
the order listed) before diving into the code.
|
||||||
|
|
||||||
|
|
||||||
|
OVERVIEW
|
||||||
|
========
|
||||||
|
|
||||||
|
This package contains C software to implement JPEG image encoding, decoding,
|
||||||
|
and transcoding. JPEG (pronounced "jay-peg") is a standardized compression
|
||||||
|
method for full-color and gray-scale images.
|
||||||
|
|
||||||
|
This software implements JPEG baseline, extended-sequential, and progressive
|
||||||
|
compression processes. Provision is made for supporting all variants of these
|
||||||
|
processes, although some uncommon parameter settings aren't implemented yet.
|
||||||
|
We have made no provision for supporting the hierarchical or lossless
|
||||||
|
processes defined in the standard.
|
||||||
|
|
||||||
|
We provide a set of library routines for reading and writing JPEG image files,
|
||||||
|
plus two sample applications "cjpeg" and "djpeg", which use the library to
|
||||||
|
perform conversion between JPEG and some other popular image file formats.
|
||||||
|
The library is intended to be reused in other applications.
|
||||||
|
|
||||||
|
In order to support file conversion and viewing software, we have included
|
||||||
|
considerable functionality beyond the bare JPEG coding/decoding capability;
|
||||||
|
for example, the color quantization modules are not strictly part of JPEG
|
||||||
|
decoding, but they are essential for output to colormapped file formats or
|
||||||
|
colormapped displays. These extra functions can be compiled out of the
|
||||||
|
library if not required for a particular application.
|
||||||
|
|
||||||
|
We have also included "jpegtran", a utility for lossless transcoding between
|
||||||
|
different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple
|
||||||
|
applications for inserting and extracting textual comments in JFIF files.
|
||||||
|
|
||||||
|
The emphasis in designing this software has been on achieving portability and
|
||||||
|
flexibility, while also making it fast enough to be useful. In particular,
|
||||||
|
the software is not intended to be read as a tutorial on JPEG. (See the
|
||||||
|
REFERENCES section for introductory material.) Rather, it is intended to
|
||||||
|
be reliable, portable, industrial-strength code. We do not claim to have
|
||||||
|
achieved that goal in every aspect of the software, but we strive for it.
|
||||||
|
|
||||||
|
We welcome the use of this software as a component of commercial products.
|
||||||
|
No royalty is required, but we do ask for an acknowledgement in product
|
||||||
|
documentation, as described under LEGAL ISSUES.
|
||||||
|
|
||||||
|
|
||||||
|
LEGAL ISSUES
|
||||||
|
============
|
||||||
|
|
||||||
|
In plain English:
|
||||||
|
|
||||||
|
1. We don't promise that this software works. (But if you find any bugs,
|
||||||
|
please let us know!)
|
||||||
|
2. You can use this software for whatever you want. You don't have to pay us.
|
||||||
|
3. You may not pretend that you wrote this software. If you use it in a
|
||||||
|
program, you must acknowledge somewhere in your documentation that
|
||||||
|
you've used the IJG code.
|
||||||
|
|
||||||
|
In legalese:
|
||||||
|
|
||||||
|
The authors make NO WARRANTY or representation, either express or implied,
|
||||||
|
with respect to this software, its quality, accuracy, merchantability, or
|
||||||
|
fitness for a particular purpose. This software is provided "AS IS", and you,
|
||||||
|
its user, assume the entire risk as to its quality and accuracy.
|
||||||
|
|
||||||
|
This software is copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
|
||||||
|
All Rights Reserved except as specified below.
|
||||||
|
|
||||||
|
Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
|
software (or portions thereof) for any purpose, without fee, subject to these
|
||||||
|
conditions:
|
||||||
|
(1) If any part of the source code for this software is distributed, then this
|
||||||
|
README file must be included, with this copyright and no-warranty notice
|
||||||
|
unaltered; and any additions, deletions, or changes to the original files
|
||||||
|
must be clearly indicated in accompanying documentation.
|
||||||
|
(2) If only executable code is distributed, then the accompanying
|
||||||
|
documentation must state that "this software is based in part on the work of
|
||||||
|
the Independent JPEG Group".
|
||||||
|
(3) Permission for use of this software is granted only if the user accepts
|
||||||
|
full responsibility for any undesirable consequences; the authors accept
|
||||||
|
NO LIABILITY for damages of any kind.
|
||||||
|
|
||||||
|
These conditions apply to any software derived from or based on the IJG code,
|
||||||
|
not just to the unmodified library. If you use our work, you ought to
|
||||||
|
acknowledge us.
|
||||||
|
|
||||||
|
Permission is NOT granted for the use of any IJG author's name or company name
|
||||||
|
in advertising or publicity relating to this software or products derived from
|
||||||
|
it. This software may be referred to only as "the Independent JPEG Group's
|
||||||
|
software".
|
||||||
|
|
||||||
|
We specifically permit and encourage the use of this software as the basis of
|
||||||
|
commercial products, provided that all warranty or liability claims are
|
||||||
|
assumed by the product vendor.
|
||||||
|
|
||||||
|
|
||||||
|
ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
|
||||||
|
sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
|
||||||
|
ansi2knr.c is NOT covered by the above copyright and conditions, but instead
|
||||||
|
by the usual distribution terms of the Free Software Foundation; principally,
|
||||||
|
that you must include source code if you redistribute it. (See the file
|
||||||
|
ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
|
||||||
|
of any program generated from the IJG code, this does not limit you more than
|
||||||
|
the foregoing paragraphs do.
|
||||||
|
|
||||||
|
The Unix configuration script "configure" was produced with GNU Autoconf.
|
||||||
|
It is copyright by the Free Software Foundation but is freely distributable.
|
||||||
|
The same holds for its supporting scripts (config.guess, config.sub,
|
||||||
|
ltmain.sh). Another support script, install-sh, is copyright by X Consortium
|
||||||
|
but is also freely distributable.
|
||||||
|
|
||||||
|
The IJG distribution formerly included code to read and write GIF files.
|
||||||
|
To avoid entanglement with the Unisys LZW patent, GIF reading support has
|
||||||
|
been removed altogether, and the GIF writer has been simplified to produce
|
||||||
|
"uncompressed GIFs". This technique does not use the LZW algorithm; the
|
||||||
|
resulting GIF files are larger than usual, but are readable by all standard
|
||||||
|
GIF decoders.
|
||||||
|
|
||||||
|
We are required to state that
|
||||||
|
"The Graphics Interchange Format(c) is the Copyright property of
|
||||||
|
CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
||||||
|
CompuServe Incorporated."
|
||||||
|
|
||||||
|
|
||||||
|
REFERENCES
|
||||||
|
==========
|
||||||
|
|
||||||
|
We recommend reading one or more of these references before trying to
|
||||||
|
understand the innards of the JPEG software.
|
||||||
|
|
||||||
|
The best short technical introduction to the JPEG compression algorithm is
|
||||||
|
Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
|
||||||
|
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
|
||||||
|
(Adjacent articles in that issue discuss MPEG motion picture compression,
|
||||||
|
applications of JPEG, and related topics.) If you don't have the CACM issue
|
||||||
|
handy, a PostScript file containing a revised version of Wallace's article is
|
||||||
|
available at http://www.ijg.org/files/wallace.ps.gz. The file (actually
|
||||||
|
a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
|
||||||
|
omits the sample images that appeared in CACM, but it includes corrections
|
||||||
|
and some added material. Note: the Wallace article is copyright ACM and IEEE,
|
||||||
|
and it may not be used for commercial purposes.
|
||||||
|
|
||||||
|
A somewhat less technical, more leisurely introduction to JPEG can be found in
|
||||||
|
"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by
|
||||||
|
M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides
|
||||||
|
good explanations and example C code for a multitude of compression methods
|
||||||
|
including JPEG. It is an excellent source if you are comfortable reading C
|
||||||
|
code but don't know much about data compression in general. The book's JPEG
|
||||||
|
sample code is far from industrial-strength, but when you are ready to look
|
||||||
|
at a full implementation, you've got one here...
|
||||||
|
|
||||||
|
The best currently available description of JPEG is the textbook "JPEG Still
|
||||||
|
Image Data Compression Standard" by William B. Pennebaker and Joan L.
|
||||||
|
Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1.
|
||||||
|
Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG
|
||||||
|
standards (DIS 10918-1 and draft DIS 10918-2).
|
||||||
|
Although this is by far the most detailed and comprehensive exposition of
|
||||||
|
JPEG publicly available, we point out that it is still missing an explanation
|
||||||
|
of the most essential properties and algorithms of the underlying DCT
|
||||||
|
technology.
|
||||||
|
If you think that you know about DCT-based JPEG after reading this book,
|
||||||
|
then you are in delusion. The real fundamentals and corresponding potential
|
||||||
|
of DCT-based JPEG are not publicly known so far, and that is the reason for
|
||||||
|
all the mistaken developments taking place in the image coding domain.
|
||||||
|
|
||||||
|
The original JPEG standard is divided into two parts, Part 1 being the actual
|
||||||
|
specification, while Part 2 covers compliance testing methods. Part 1 is
|
||||||
|
titled "Digital Compression and Coding of Continuous-tone Still Images,
|
||||||
|
Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS
|
||||||
|
10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of
|
||||||
|
Continuous-tone Still Images, Part 2: Compliance testing" and has document
|
||||||
|
numbers ISO/IEC IS 10918-2, ITU-T T.83.
|
||||||
|
IJG JPEG 8 introduces an implementation of the JPEG SmartScale extension
|
||||||
|
which is specified in two documents: A contributed document at ITU and ISO
|
||||||
|
with title "ITU-T JPEG-Plus Proposal for Extending ITU-T T.81 for Advanced
|
||||||
|
Image Coding", April 2006, Geneva, Switzerland. The latest version of this
|
||||||
|
document is Revision 3. And a contributed document ISO/IEC JTC1/SC29/WG1 N
|
||||||
|
5799 with title "Evolution of JPEG", June/July 2011, Berlin, Germany.
|
||||||
|
|
||||||
|
The JPEG standard does not specify all details of an interchangeable file
|
||||||
|
format. For the omitted details we follow the "JFIF" conventions, revision
|
||||||
|
1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report
|
||||||
|
and thus received a formal publication status. It is available as a free
|
||||||
|
download in PDF format from
|
||||||
|
http://www.ecma-international.org/publications/techreports/E-TR-098.htm.
|
||||||
|
A PostScript version of the JFIF document is available at
|
||||||
|
http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at
|
||||||
|
http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures.
|
||||||
|
|
||||||
|
The TIFF 6.0 file format specification can be obtained by FTP from
|
||||||
|
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
|
||||||
|
found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems.
|
||||||
|
IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6).
|
||||||
|
Instead, we recommend the JPEG design proposed by TIFF Technical Note #2
|
||||||
|
(Compression tag 7). Copies of this Note can be obtained from
|
||||||
|
http://www.ijg.org/files/. It is expected that the next revision
|
||||||
|
of the TIFF spec will replace the 6.0 JPEG design with the Note's design.
|
||||||
|
Although IJG's own code does not support TIFF/JPEG, the free libtiff library
|
||||||
|
uses our library to implement TIFF/JPEG per the Note.
|
||||||
|
|
||||||
|
|
||||||
|
ARCHIVE LOCATIONS
|
||||||
|
=================
|
||||||
|
|
||||||
|
The "official" archive site for this software is www.ijg.org.
|
||||||
|
The most recent released version can always be found there in
|
||||||
|
directory "files". This particular version will be archived as
|
||||||
|
http://www.ijg.org/files/jpegsrc.v8d.tar.gz, and in Windows-compatible
|
||||||
|
"zip" archive format as http://www.ijg.org/files/jpegsr8d.zip.
|
||||||
|
|
||||||
|
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
||||||
|
general information about JPEG.
|
||||||
|
It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/
|
||||||
|
and other news.answers archive sites, including the official news.answers
|
||||||
|
archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/.
|
||||||
|
If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu
|
||||||
|
with body
|
||||||
|
send usenet/news.answers/jpeg-faq/part1
|
||||||
|
send usenet/news.answers/jpeg-faq/part2
|
||||||
|
|
||||||
|
|
||||||
|
ACKNOWLEDGMENTS
|
||||||
|
===============
|
||||||
|
|
||||||
|
Thank to Juergen Bruder for providing me with a copy of the common DCT
|
||||||
|
algorithm article, only to find out that I had come to the same result
|
||||||
|
in a more direct and comprehensible way with a more generative approach.
|
||||||
|
|
||||||
|
Thank to Istvan Sebestyen and Joan L. Mitchell for inviting me to the
|
||||||
|
ITU JPEG (Study Group 16) meeting in Geneva, Switzerland.
|
||||||
|
|
||||||
|
Thank to Thomas Wiegand and Gary Sullivan for inviting me to the
|
||||||
|
Joint Video Team (MPEG & ITU) meeting in Geneva, Switzerland.
|
||||||
|
|
||||||
|
Thank to Thomas Richter and Daniel Lee for inviting me to the
|
||||||
|
ISO/IEC JTC1/SC29/WG1 (also known as JPEG, together with ITU-T SG16)
|
||||||
|
meeting in Berlin, Germany.
|
||||||
|
|
||||||
|
Thank to John Korejwa and Massimo Ballerini for inviting me to
|
||||||
|
fruitful consultations in Boston, MA and Milan, Italy.
|
||||||
|
|
||||||
|
Thank to Hendrik Elstner, Roland Fassauer, Simone Zuck, Guenther
|
||||||
|
Maier-Gerber, Walter Stoeber, Fred Schmitz, and Norbert Braunagel
|
||||||
|
for corresponding business development.
|
||||||
|
|
||||||
|
Thank to Nico Zschach and Dirk Stelling of the technical support team
|
||||||
|
at the Digital Images company in Halle for providing me with extra
|
||||||
|
equipment for configuration tests.
|
||||||
|
|
||||||
|
Thank to Richard F. Lyon (then of Foveon Inc.) for fruitful
|
||||||
|
communication about JPEG configuration in Sigma Photo Pro software.
|
||||||
|
|
||||||
|
Thank to Andrew Finkenstadt for hosting the ijg.org site.
|
||||||
|
|
||||||
|
Last but not least special thank to Thomas G. Lane for the original
|
||||||
|
design and development of this singular software package.
|
||||||
|
|
||||||
|
|
||||||
|
FILE FORMAT WARS
|
||||||
|
================
|
||||||
|
|
||||||
|
The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together
|
||||||
|
with ITU-T SG16) currently promotes different formats containing the name
|
||||||
|
"JPEG" which is misleading because these formats are incompatible with
|
||||||
|
original DCT-based JPEG and are based on faulty technologies.
|
||||||
|
IJG therefore does not and will not support such momentary mistakes
|
||||||
|
(see REFERENCES).
|
||||||
|
There exist also distributions under the name "OpenJPEG" promoting such
|
||||||
|
kind of formats which is misleading because they don't support original
|
||||||
|
JPEG images.
|
||||||
|
We have no sympathy for the promotion of inferior formats. Indeed, one of
|
||||||
|
the original reasons for developing this free software was to help force
|
||||||
|
convergence on common, interoperable format standards for JPEG files.
|
||||||
|
Don't use an incompatible file format!
|
||||||
|
(In any case, our decoder will remain capable of reading existing JPEG
|
||||||
|
image files indefinitely.)
|
||||||
|
|
||||||
|
Furthermore, the ISO committee pretends to be "responsible for the popular
|
||||||
|
JPEG" in their public reports which is not true because they don't respond to
|
||||||
|
actual requirements for the maintenance of the original JPEG specification.
|
||||||
|
|
||||||
|
There are currently distributions in circulation containing the name
|
||||||
|
"libjpeg" which claim to be a "derivative" or "fork" of the original
|
||||||
|
libjpeg, but don't have the features and are incompatible with formats
|
||||||
|
supported by actual IJG libjpeg distributions. Furthermore, they
|
||||||
|
violate the license conditions as described under LEGAL ISSUES above.
|
||||||
|
We have no sympathy for the release of misleading and illegal
|
||||||
|
distributions derived from obsolete code bases.
|
||||||
|
Don't use an obsolete code base!
|
||||||
|
|
||||||
|
|
||||||
|
TO DO
|
||||||
|
=====
|
||||||
|
|
||||||
|
Version 8 is the first release of a new generation JPEG standard
|
||||||
|
to overcome the limitations of the original JPEG specification.
|
||||||
|
More features are being prepared for coming releases...
|
||||||
|
|
||||||
|
Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org.
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* cderror.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||||
|
* Modified 2009 by Guido Vollbeding.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file defines the error and message codes for the cjpeg/djpeg
|
||||||
|
* applications. These strings are not needed as part of the JPEG library
|
||||||
|
* proper.
|
||||||
|
* Edit this file to add new codes, or to translate the message strings to
|
||||||
|
* some other language.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To define the enum list of message codes, include this file without
|
||||||
|
* defining macro JMESSAGE. To create a message string table, include it
|
||||||
|
* again with a suitable JMESSAGE definition (see jerror.c for an example).
|
||||||
|
*/
|
||||||
|
#ifndef JMESSAGE
|
||||||
|
#ifndef CDERROR_H
|
||||||
|
#define CDERROR_H
|
||||||
|
/* First time through, define the enum list */
|
||||||
|
#define JMAKE_ENUM_LIST
|
||||||
|
#else
|
||||||
|
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
||||||
|
#define JMESSAGE(code,string)
|
||||||
|
#endif /* CDERROR_H */
|
||||||
|
#endif /* JMESSAGE */
|
||||||
|
|
||||||
|
#ifdef JMAKE_ENUM_LIST
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
#define JMESSAGE(code,string) code ,
|
||||||
|
|
||||||
|
#endif /* JMAKE_ENUM_LIST */
|
||||||
|
|
||||||
|
JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */
|
||||||
|
|
||||||
|
#ifdef BMP_SUPPORTED
|
||||||
|
JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
|
||||||
|
JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
|
||||||
|
JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
|
||||||
|
JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
|
||||||
|
JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
|
||||||
|
JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
|
||||||
|
JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
|
||||||
|
JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
|
||||||
|
JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
|
||||||
|
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
|
||||||
|
JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
|
||||||
|
JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
|
||||||
|
#endif /* BMP_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef GIF_SUPPORTED
|
||||||
|
JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
|
||||||
|
JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
|
||||||
|
JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
|
||||||
|
JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
|
||||||
|
JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
|
||||||
|
JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
|
||||||
|
JMESSAGE(JTRC_GIF_BADVERSION,
|
||||||
|
"Warning: unexpected GIF version number '%c%c%c'")
|
||||||
|
JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
|
||||||
|
JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
|
||||||
|
JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
|
||||||
|
JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
|
||||||
|
JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
|
||||||
|
JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
|
||||||
|
#endif /* GIF_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PPM_SUPPORTED
|
||||||
|
JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
|
||||||
|
JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
|
||||||
|
JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
|
||||||
|
JMESSAGE(JTRC_PGM, "%ux%u PGM image")
|
||||||
|
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
|
||||||
|
JMESSAGE(JTRC_PPM, "%ux%u PPM image")
|
||||||
|
JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
|
||||||
|
#endif /* PPM_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef RLE_SUPPORTED
|
||||||
|
JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
|
||||||
|
JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
|
||||||
|
JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
|
||||||
|
JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
|
||||||
|
JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
|
||||||
|
JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
|
||||||
|
JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
|
||||||
|
JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
|
||||||
|
JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
|
||||||
|
JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
|
||||||
|
JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
|
||||||
|
JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
|
||||||
|
JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
|
||||||
|
JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
|
||||||
|
#endif /* RLE_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef TARGA_SUPPORTED
|
||||||
|
JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
|
||||||
|
JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
|
||||||
|
JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
|
||||||
|
JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
|
||||||
|
JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
|
||||||
|
JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
|
||||||
|
#else
|
||||||
|
JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
|
||||||
|
#endif /* TARGA_SUPPORTED */
|
||||||
|
|
||||||
|
JMESSAGE(JERR_BAD_CMAP_FILE,
|
||||||
|
"Color map file is invalid or of unsupported format")
|
||||||
|
JMESSAGE(JERR_TOO_MANY_COLORS,
|
||||||
|
"Output file format cannot handle %d colormap entries")
|
||||||
|
JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
|
||||||
|
#ifdef TARGA_SUPPORTED
|
||||||
|
JMESSAGE(JERR_UNKNOWN_FORMAT,
|
||||||
|
"Unrecognized input file format --- perhaps you need -targa")
|
||||||
|
#else
|
||||||
|
JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
|
||||||
|
#endif
|
||||||
|
JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
|
||||||
|
|
||||||
|
#ifdef JMAKE_ENUM_LIST
|
||||||
|
|
||||||
|
JMSG_LASTADDONCODE
|
||||||
|
} ADDON_MESSAGE_CODE;
|
||||||
|
|
||||||
|
#undef JMAKE_ENUM_LIST
|
||||||
|
#endif /* JMAKE_ENUM_LIST */
|
||||||
|
|
||||||
|
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
|
||||||
|
#undef JMESSAGE
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
/*
|
||||||
|
* cdjpeg.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file contains common declarations for the sample applications
|
||||||
|
* cjpeg and djpeg. It is NOT used by the core JPEG library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
|
||||||
|
#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
|
||||||
|
#include "jinclude.h"
|
||||||
|
#include "jpeglib.h"
|
||||||
|
#include "jerror.h" /* get library error codes too */
|
||||||
|
#include "cderror.h" /* get application-specific error codes */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Object interface for cjpeg's source file decoding modules
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct cjpeg_source_struct * cjpeg_source_ptr;
|
||||||
|
|
||||||
|
struct cjpeg_source_struct {
|
||||||
|
JMETHOD(void, start_input, (j_compress_ptr cinfo,
|
||||||
|
cjpeg_source_ptr sinfo));
|
||||||
|
JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
|
||||||
|
cjpeg_source_ptr sinfo));
|
||||||
|
JMETHOD(void, finish_input, (j_compress_ptr cinfo,
|
||||||
|
cjpeg_source_ptr sinfo));
|
||||||
|
|
||||||
|
FILE *input_file;
|
||||||
|
|
||||||
|
JSAMPARRAY buffer;
|
||||||
|
JDIMENSION buffer_height;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Object interface for djpeg's output file encoding modules
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct djpeg_dest_struct * djpeg_dest_ptr;
|
||||||
|
|
||||||
|
struct djpeg_dest_struct {
|
||||||
|
/* start_output is called after jpeg_start_decompress finishes.
|
||||||
|
* The color map will be ready at this time, if one is needed.
|
||||||
|
*/
|
||||||
|
JMETHOD(void, start_output, (j_decompress_ptr cinfo,
|
||||||
|
djpeg_dest_ptr dinfo));
|
||||||
|
/* Emit the specified number of pixel rows from the buffer. */
|
||||||
|
JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo,
|
||||||
|
djpeg_dest_ptr dinfo,
|
||||||
|
JDIMENSION rows_supplied));
|
||||||
|
/* Finish up at the end of the image. */
|
||||||
|
JMETHOD(void, finish_output, (j_decompress_ptr cinfo,
|
||||||
|
djpeg_dest_ptr dinfo));
|
||||||
|
|
||||||
|
/* Target file spec; filled in by djpeg.c after object is created. */
|
||||||
|
FILE * output_file;
|
||||||
|
|
||||||
|
/* Output pixel-row buffer. Created by module init or start_output.
|
||||||
|
* Width is cinfo->output_width * cinfo->output_components;
|
||||||
|
* height is buffer_height.
|
||||||
|
*/
|
||||||
|
JSAMPARRAY buffer;
|
||||||
|
JDIMENSION buffer_height;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* cjpeg/djpeg may need to perform extra passes to convert to or from
|
||||||
|
* the source/destination file format. The JPEG library does not know
|
||||||
|
* about these passes, but we'd like them to be counted by the progress
|
||||||
|
* monitor. We use an expanded progress monitor object to hold the
|
||||||
|
* additional pass count.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct cdjpeg_progress_mgr {
|
||||||
|
struct jpeg_progress_mgr pub; /* fields known to JPEG library */
|
||||||
|
int completed_extra_passes; /* extra passes completed */
|
||||||
|
int total_extra_passes; /* total extra */
|
||||||
|
/* last printed percentage stored here to avoid multiple printouts */
|
||||||
|
int percent_done;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct cdjpeg_progress_mgr * cd_progress_ptr;
|
||||||
|
|
||||||
|
|
||||||
|
/* Short forms of external names for systems with brain-damaged linkers. */
|
||||||
|
|
||||||
|
#ifdef NEED_SHORT_EXTERNAL_NAMES
|
||||||
|
#define jinit_read_bmp jIRdBMP
|
||||||
|
#define jinit_write_bmp jIWrBMP
|
||||||
|
#define jinit_read_gif jIRdGIF
|
||||||
|
#define jinit_write_gif jIWrGIF
|
||||||
|
#define jinit_read_ppm jIRdPPM
|
||||||
|
#define jinit_write_ppm jIWrPPM
|
||||||
|
#define jinit_read_rle jIRdRLE
|
||||||
|
#define jinit_write_rle jIWrRLE
|
||||||
|
#define jinit_read_targa jIRdTarga
|
||||||
|
#define jinit_write_targa jIWrTarga
|
||||||
|
#define read_quant_tables RdQTables
|
||||||
|
#define read_scan_script RdScnScript
|
||||||
|
#define set_quality_ratings SetQRates
|
||||||
|
#define set_quant_slots SetQSlots
|
||||||
|
#define set_sample_factors SetSFacts
|
||||||
|
#define read_color_map RdCMap
|
||||||
|
#define enable_signal_catcher EnSigCatcher
|
||||||
|
#define start_progress_monitor StProgMon
|
||||||
|
#define end_progress_monitor EnProgMon
|
||||||
|
#define read_stdin RdStdin
|
||||||
|
#define write_stdout WrStdout
|
||||||
|
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
||||||
|
|
||||||
|
/* Module selection routines for I/O modules. */
|
||||||
|
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo,
|
||||||
|
boolean is_os2));
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo));
|
||||||
|
|
||||||
|
/* cjpeg support routines (in rdswitch.c) */
|
||||||
|
|
||||||
|
EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename,
|
||||||
|
boolean force_baseline));
|
||||||
|
EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename));
|
||||||
|
EXTERN(boolean) set_quality_ratings JPP((j_compress_ptr cinfo, char *arg,
|
||||||
|
boolean force_baseline));
|
||||||
|
EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg));
|
||||||
|
EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg));
|
||||||
|
|
||||||
|
/* djpeg support routines (in rdcolmap.c) */
|
||||||
|
|
||||||
|
EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile));
|
||||||
|
|
||||||
|
/* common support routines (in cdjpeg.c) */
|
||||||
|
|
||||||
|
EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo));
|
||||||
|
EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo,
|
||||||
|
cd_progress_ptr progress));
|
||||||
|
EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo));
|
||||||
|
EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars));
|
||||||
|
EXTERN(FILE *) read_stdin JPP((void));
|
||||||
|
EXTERN(FILE *) write_stdout JPP((void));
|
||||||
|
|
||||||
|
/* miscellaneous useful macros */
|
||||||
|
|
||||||
|
#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */
|
||||||
|
#define READ_BINARY "r"
|
||||||
|
#define WRITE_BINARY "w"
|
||||||
|
#else
|
||||||
|
#ifdef VMS /* VMS is very nonstandard */
|
||||||
|
#define READ_BINARY "rb", "ctx=stm"
|
||||||
|
#define WRITE_BINARY "wb", "ctx=stm"
|
||||||
|
#else /* standard ANSI-compliant case */
|
||||||
|
#define READ_BINARY "rb"
|
||||||
|
#define WRITE_BINARY "wb"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EXIT_FAILURE /* define exit() codes if not provided */
|
||||||
|
#define EXIT_FAILURE 1
|
||||||
|
#endif
|
||||||
|
#ifndef EXIT_SUCCESS
|
||||||
|
#ifdef VMS
|
||||||
|
#define EXIT_SUCCESS 1 /* VMS is very nonstandard */
|
||||||
|
#else
|
||||||
|
#define EXIT_SUCCESS 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef EXIT_WARNING
|
||||||
|
#ifdef VMS
|
||||||
|
#define EXIT_WARNING 1 /* VMS is very nonstandard */
|
||||||
|
#else
|
||||||
|
#define EXIT_WARNING 2
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/* jconfig.h. Generated from jconfig.cfg by configure. */
|
||||||
|
/* jconfig.cfg --- source file edited by configure script */
|
||||||
|
/* see jconfig.txt for explanations */
|
||||||
|
|
||||||
|
#define HAVE_PROTOTYPES 1
|
||||||
|
#define HAVE_UNSIGNED_CHAR 1
|
||||||
|
#define HAVE_UNSIGNED_SHORT 1
|
||||||
|
/* #undef void */
|
||||||
|
/* #undef const */
|
||||||
|
/* #undef CHAR_IS_UNSIGNED */
|
||||||
|
#define HAVE_STDDEF_H 1
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
#define HAVE_LOCALE_H 1
|
||||||
|
/* #undef NEED_BSD_STRINGS */
|
||||||
|
/* #undef NEED_SYS_TYPES_H */
|
||||||
|
/* #undef NEED_FAR_POINTERS */
|
||||||
|
/* #undef NEED_SHORT_EXTERNAL_NAMES */
|
||||||
|
/* Define this if you get warnings about undefined structures. */
|
||||||
|
/* #undef INCOMPLETE_TYPES_BROKEN */
|
||||||
|
|
||||||
|
/* Define "boolean" as unsigned char, not int, on Windows systems. */
|
||||||
|
#ifdef _WIN32
|
||||||
|
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||||
|
typedef unsigned char boolean;
|
||||||
|
#endif
|
||||||
|
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef JPEG_INTERNALS
|
||||||
|
|
||||||
|
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
|
||||||
|
#define INLINE __inline__
|
||||||
|
/* These are for configuring the JPEG memory manager. */
|
||||||
|
/* #undef DEFAULT_MAX_MEM */
|
||||||
|
/* #undef NO_MKTEMP */
|
||||||
|
|
||||||
|
#endif /* JPEG_INTERNALS */
|
||||||
|
|
||||||
|
#ifdef JPEG_CJPEG_DJPEG
|
||||||
|
|
||||||
|
#define BMP_SUPPORTED /* BMP image file format */
|
||||||
|
#define GIF_SUPPORTED /* GIF image file format */
|
||||||
|
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||||
|
/* #undef RLE_SUPPORTED */
|
||||||
|
#define TARGA_SUPPORTED /* Targa image file format */
|
||||||
|
|
||||||
|
/* #undef TWO_FILE_COMMANDLINE */
|
||||||
|
/* #undef NEED_SIGNAL_CATCHER */
|
||||||
|
/* #undef DONT_USE_B_MODE */
|
||||||
|
|
||||||
|
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
|
||||||
|
/* #undef PROGRESS_REPORT */
|
||||||
|
|
||||||
|
#endif /* JPEG_CJPEG_DJPEG */
|
||||||
@@ -0,0 +1,393 @@
|
|||||||
|
/*
|
||||||
|
* jdct.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This include file contains common declarations for the forward and
|
||||||
|
* inverse DCT modules. These declarations are private to the DCT managers
|
||||||
|
* (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
|
||||||
|
* The individual DCT algorithms are kept in separate files to ease
|
||||||
|
* machine-dependent tuning (e.g., assembly coding).
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A forward DCT routine is given a pointer to an input sample array and
|
||||||
|
* a pointer to a work area of type DCTELEM[]; the DCT is to be performed
|
||||||
|
* in-place in that buffer. Type DCTELEM is int for 8-bit samples, INT32
|
||||||
|
* for 12-bit samples. (NOTE: Floating-point DCT implementations use an
|
||||||
|
* array of type FAST_FLOAT, instead.)
|
||||||
|
* The input data is to be fetched from the sample array starting at a
|
||||||
|
* specified column. (Any row offset needed will be applied to the array
|
||||||
|
* pointer before it is passed to the FDCT code.)
|
||||||
|
* Note that the number of samples fetched by the FDCT routine is
|
||||||
|
* DCT_h_scaled_size * DCT_v_scaled_size.
|
||||||
|
* The DCT outputs are returned scaled up by a factor of 8; they therefore
|
||||||
|
* have a range of +-8K for 8-bit data, +-128K for 12-bit data. This
|
||||||
|
* convention improves accuracy in integer implementations and saves some
|
||||||
|
* work in floating-point ones.
|
||||||
|
* Quantization of the output coefficients is done by jcdctmgr.c.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if BITS_IN_JSAMPLE == 8
|
||||||
|
typedef int DCTELEM; /* 16 or 32 bits is fine */
|
||||||
|
#else
|
||||||
|
typedef INT32 DCTELEM; /* must have 32 bits */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data,
|
||||||
|
JSAMPARRAY sample_data,
|
||||||
|
JDIMENSION start_col));
|
||||||
|
typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data,
|
||||||
|
JSAMPARRAY sample_data,
|
||||||
|
JDIMENSION start_col));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An inverse DCT routine is given a pointer to the input JBLOCK and a pointer
|
||||||
|
* to an output sample array. The routine must dequantize the input data as
|
||||||
|
* well as perform the IDCT; for dequantization, it uses the multiplier table
|
||||||
|
* pointed to by compptr->dct_table. The output data is to be placed into the
|
||||||
|
* sample array starting at a specified column. (Any row offset needed will
|
||||||
|
* be applied to the array pointer before it is passed to the IDCT code.)
|
||||||
|
* Note that the number of samples emitted by the IDCT routine is
|
||||||
|
* DCT_h_scaled_size * DCT_v_scaled_size.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* typedef inverse_DCT_method_ptr is declared in jpegint.h */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Each IDCT routine has its own ideas about the best dct_table element type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
|
||||||
|
#if BITS_IN_JSAMPLE == 8
|
||||||
|
typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
|
||||||
|
#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */
|
||||||
|
#else
|
||||||
|
typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */
|
||||||
|
#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */
|
||||||
|
#endif
|
||||||
|
typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Each IDCT routine is responsible for range-limiting its results and
|
||||||
|
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
|
||||||
|
* be quite far out of range if the input data is corrupt, so a bulletproof
|
||||||
|
* range-limiting step is required. We use a mask-and-table-lookup method
|
||||||
|
* to do the combined operations quickly. See the comments with
|
||||||
|
* prepare_range_limit_table (in jdmaster.c) for more info.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE)
|
||||||
|
|
||||||
|
#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
|
||||||
|
|
||||||
|
|
||||||
|
/* Short forms of external names for systems with brain-damaged linkers. */
|
||||||
|
|
||||||
|
#ifdef NEED_SHORT_EXTERNAL_NAMES
|
||||||
|
#define jpeg_fdct_islow jFDislow
|
||||||
|
#define jpeg_fdct_ifast jFDifast
|
||||||
|
#define jpeg_fdct_float jFDfloat
|
||||||
|
#define jpeg_fdct_7x7 jFD7x7
|
||||||
|
#define jpeg_fdct_6x6 jFD6x6
|
||||||
|
#define jpeg_fdct_5x5 jFD5x5
|
||||||
|
#define jpeg_fdct_4x4 jFD4x4
|
||||||
|
#define jpeg_fdct_3x3 jFD3x3
|
||||||
|
#define jpeg_fdct_2x2 jFD2x2
|
||||||
|
#define jpeg_fdct_1x1 jFD1x1
|
||||||
|
#define jpeg_fdct_9x9 jFD9x9
|
||||||
|
#define jpeg_fdct_10x10 jFD10x10
|
||||||
|
#define jpeg_fdct_11x11 jFD11x11
|
||||||
|
#define jpeg_fdct_12x12 jFD12x12
|
||||||
|
#define jpeg_fdct_13x13 jFD13x13
|
||||||
|
#define jpeg_fdct_14x14 jFD14x14
|
||||||
|
#define jpeg_fdct_15x15 jFD15x15
|
||||||
|
#define jpeg_fdct_16x16 jFD16x16
|
||||||
|
#define jpeg_fdct_16x8 jFD16x8
|
||||||
|
#define jpeg_fdct_14x7 jFD14x7
|
||||||
|
#define jpeg_fdct_12x6 jFD12x6
|
||||||
|
#define jpeg_fdct_10x5 jFD10x5
|
||||||
|
#define jpeg_fdct_8x4 jFD8x4
|
||||||
|
#define jpeg_fdct_6x3 jFD6x3
|
||||||
|
#define jpeg_fdct_4x2 jFD4x2
|
||||||
|
#define jpeg_fdct_2x1 jFD2x1
|
||||||
|
#define jpeg_fdct_8x16 jFD8x16
|
||||||
|
#define jpeg_fdct_7x14 jFD7x14
|
||||||
|
#define jpeg_fdct_6x12 jFD6x12
|
||||||
|
#define jpeg_fdct_5x10 jFD5x10
|
||||||
|
#define jpeg_fdct_4x8 jFD4x8
|
||||||
|
#define jpeg_fdct_3x6 jFD3x6
|
||||||
|
#define jpeg_fdct_2x4 jFD2x4
|
||||||
|
#define jpeg_fdct_1x2 jFD1x2
|
||||||
|
#define jpeg_idct_islow jRDislow
|
||||||
|
#define jpeg_idct_ifast jRDifast
|
||||||
|
#define jpeg_idct_float jRDfloat
|
||||||
|
#define jpeg_idct_7x7 jRD7x7
|
||||||
|
#define jpeg_idct_6x6 jRD6x6
|
||||||
|
#define jpeg_idct_5x5 jRD5x5
|
||||||
|
#define jpeg_idct_4x4 jRD4x4
|
||||||
|
#define jpeg_idct_3x3 jRD3x3
|
||||||
|
#define jpeg_idct_2x2 jRD2x2
|
||||||
|
#define jpeg_idct_1x1 jRD1x1
|
||||||
|
#define jpeg_idct_9x9 jRD9x9
|
||||||
|
#define jpeg_idct_10x10 jRD10x10
|
||||||
|
#define jpeg_idct_11x11 jRD11x11
|
||||||
|
#define jpeg_idct_12x12 jRD12x12
|
||||||
|
#define jpeg_idct_13x13 jRD13x13
|
||||||
|
#define jpeg_idct_14x14 jRD14x14
|
||||||
|
#define jpeg_idct_15x15 jRD15x15
|
||||||
|
#define jpeg_idct_16x16 jRD16x16
|
||||||
|
#define jpeg_idct_16x8 jRD16x8
|
||||||
|
#define jpeg_idct_14x7 jRD14x7
|
||||||
|
#define jpeg_idct_12x6 jRD12x6
|
||||||
|
#define jpeg_idct_10x5 jRD10x5
|
||||||
|
#define jpeg_idct_8x4 jRD8x4
|
||||||
|
#define jpeg_idct_6x3 jRD6x3
|
||||||
|
#define jpeg_idct_4x2 jRD4x2
|
||||||
|
#define jpeg_idct_2x1 jRD2x1
|
||||||
|
#define jpeg_idct_8x16 jRD8x16
|
||||||
|
#define jpeg_idct_7x14 jRD7x14
|
||||||
|
#define jpeg_idct_6x12 jRD6x12
|
||||||
|
#define jpeg_idct_5x10 jRD5x10
|
||||||
|
#define jpeg_idct_4x8 jRD4x8
|
||||||
|
#define jpeg_idct_3x6 jRD3x8
|
||||||
|
#define jpeg_idct_2x4 jRD2x4
|
||||||
|
#define jpeg_idct_1x2 jRD1x2
|
||||||
|
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
||||||
|
|
||||||
|
/* Extern declarations for the forward and inverse DCT routines. */
|
||||||
|
|
||||||
|
EXTERN(void) jpeg_fdct_islow
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_ifast
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_float
|
||||||
|
JPP((FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_7x7
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_6x6
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_5x5
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_4x4
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_3x3
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_2x2
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_1x1
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_9x9
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_10x10
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_11x11
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_12x12
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_13x13
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_14x14
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_15x15
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_16x16
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_16x8
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_14x7
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_12x6
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_10x5
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_8x4
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_6x3
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_4x2
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_2x1
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_8x16
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_7x14
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_6x12
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_5x10
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_4x8
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_3x6
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_2x4
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
EXTERN(void) jpeg_fdct_1x2
|
||||||
|
JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
|
||||||
|
|
||||||
|
EXTERN(void) jpeg_idct_islow
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_ifast
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_float
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_7x7
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_6x6
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_5x5
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_4x4
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_3x3
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_2x2
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_1x1
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_9x9
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_10x10
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_11x11
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_12x12
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_13x13
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_14x14
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_15x15
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_16x16
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_16x8
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_14x7
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_12x6
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_10x5
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_8x4
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_6x3
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_4x2
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_2x1
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_8x16
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_7x14
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_6x12
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_5x10
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_4x8
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_3x6
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_2x4
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
EXTERN(void) jpeg_idct_1x2
|
||||||
|
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macros for handling fixed-point arithmetic; these are used by many
|
||||||
|
* but not all of the DCT/IDCT modules.
|
||||||
|
*
|
||||||
|
* All values are expected to be of type INT32.
|
||||||
|
* Fractional constants are scaled left by CONST_BITS bits.
|
||||||
|
* CONST_BITS is defined within each module using these macros,
|
||||||
|
* and may differ from one module to the next.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ONE ((INT32) 1)
|
||||||
|
#define CONST_SCALE (ONE << CONST_BITS)
|
||||||
|
|
||||||
|
/* Convert a positive real constant to an integer scaled by CONST_SCALE.
|
||||||
|
* Caution: some C compilers fail to reduce "FIX(constant)" at compile time,
|
||||||
|
* thus causing a lot of useless floating-point operations at run time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
|
||||||
|
|
||||||
|
/* Descale and correctly round an INT32 value that's scaled by N bits.
|
||||||
|
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
|
||||||
|
* the fudge factor is correct for either sign of X.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
|
||||||
|
|
||||||
|
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
|
||||||
|
* This macro is used only when the two inputs will actually be no more than
|
||||||
|
* 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a
|
||||||
|
* full 32x32 multiply. This provides a useful speedup on many machines.
|
||||||
|
* Unfortunately there is no way to specify a 16x16->32 multiply portably
|
||||||
|
* in C, but some C compilers will do the right thing if you provide the
|
||||||
|
* correct combination of casts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
|
||||||
|
#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const)))
|
||||||
|
#endif
|
||||||
|
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
|
||||||
|
#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MULTIPLY16C16 /* default definition */
|
||||||
|
#define MULTIPLY16C16(var,const) ((var) * (const))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Same except both inputs are variables. */
|
||||||
|
|
||||||
|
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
|
||||||
|
#define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MULTIPLY16V16 /* default definition */
|
||||||
|
#define MULTIPLY16V16(var1,var2) ((var1) * (var2))
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,304 @@
|
|||||||
|
/*
|
||||||
|
* jerror.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||||
|
* Modified 1997-2009 by Guido Vollbeding.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file defines the error and message codes for the JPEG library.
|
||||||
|
* Edit this file to add new codes, or to translate the message strings to
|
||||||
|
* some other language.
|
||||||
|
* A set of error-reporting macros are defined too. Some applications using
|
||||||
|
* the JPEG library may wish to include this file to get the error codes
|
||||||
|
* and/or the macros.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To define the enum list of message codes, include this file without
|
||||||
|
* defining macro JMESSAGE. To create a message string table, include it
|
||||||
|
* again with a suitable JMESSAGE definition (see jerror.c for an example).
|
||||||
|
*/
|
||||||
|
#ifndef JMESSAGE
|
||||||
|
#ifndef JERROR_H
|
||||||
|
/* First time through, define the enum list */
|
||||||
|
#define JMAKE_ENUM_LIST
|
||||||
|
#else
|
||||||
|
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
||||||
|
#define JMESSAGE(code,string)
|
||||||
|
#endif /* JERROR_H */
|
||||||
|
#endif /* JMESSAGE */
|
||||||
|
|
||||||
|
#ifdef JMAKE_ENUM_LIST
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
#define JMESSAGE(code,string) code ,
|
||||||
|
|
||||||
|
#endif /* JMAKE_ENUM_LIST */
|
||||||
|
|
||||||
|
JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
|
||||||
|
|
||||||
|
/* For maintenance convenience, list is alphabetical by message code name */
|
||||||
|
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
|
||||||
|
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
|
||||||
|
JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
|
||||||
|
JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
|
||||||
|
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
|
||||||
|
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
|
||||||
|
JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported")
|
||||||
|
JMESSAGE(JERR_BAD_DROP_SAMPLING,
|
||||||
|
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
|
||||||
|
JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
|
||||||
|
JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
|
||||||
|
JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
|
||||||
|
JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
|
||||||
|
JMESSAGE(JERR_BAD_LIB_VERSION,
|
||||||
|
"Wrong JPEG library version: library is %d, caller expects %d")
|
||||||
|
JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
|
||||||
|
JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
|
||||||
|
JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
|
||||||
|
JMESSAGE(JERR_BAD_PROGRESSION,
|
||||||
|
"Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
|
||||||
|
JMESSAGE(JERR_BAD_PROG_SCRIPT,
|
||||||
|
"Invalid progressive parameters at scan script entry %d")
|
||||||
|
JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
|
||||||
|
JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
|
||||||
|
JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
|
||||||
|
JMESSAGE(JERR_BAD_STRUCT_SIZE,
|
||||||
|
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
|
||||||
|
JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
|
||||||
|
JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
|
||||||
|
JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
|
||||||
|
JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
|
||||||
|
JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
|
||||||
|
JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
|
||||||
|
JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
|
||||||
|
JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
|
||||||
|
JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
|
||||||
|
JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
|
||||||
|
JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
|
||||||
|
JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
|
||||||
|
JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
|
||||||
|
JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
|
||||||
|
JMESSAGE(JERR_FILE_READ, "Input file read error")
|
||||||
|
JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
|
||||||
|
JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
|
||||||
|
JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
|
||||||
|
JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
|
||||||
|
JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
|
||||||
|
JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
|
||||||
|
JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
|
||||||
|
JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
|
||||||
|
"Cannot transcode due to multiple use of quantization table %d")
|
||||||
|
JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
|
||||||
|
JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
|
||||||
|
JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
|
||||||
|
JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
|
||||||
|
JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
|
||||||
|
JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
|
||||||
|
JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
|
||||||
|
JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
|
||||||
|
JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
|
||||||
|
JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
|
||||||
|
JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
|
||||||
|
JMESSAGE(JERR_QUANT_COMPONENTS,
|
||||||
|
"Cannot quantize more than %d color components")
|
||||||
|
JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
|
||||||
|
JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
|
||||||
|
JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
|
||||||
|
JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
|
||||||
|
JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
|
||||||
|
JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
|
||||||
|
JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
|
||||||
|
JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
|
||||||
|
JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
|
||||||
|
JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
|
||||||
|
JMESSAGE(JERR_TFILE_WRITE,
|
||||||
|
"Write failed on temporary file --- out of disk space?")
|
||||||
|
JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
|
||||||
|
JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
|
||||||
|
JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
|
||||||
|
JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
|
||||||
|
JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
|
||||||
|
JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
|
||||||
|
JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
|
||||||
|
JMESSAGE(JMSG_VERSION, JVERSION)
|
||||||
|
JMESSAGE(JTRC_16BIT_TABLES,
|
||||||
|
"Caution: quantization tables are too coarse for baseline JPEG")
|
||||||
|
JMESSAGE(JTRC_ADOBE,
|
||||||
|
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
|
||||||
|
JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
|
||||||
|
JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
|
||||||
|
JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
|
||||||
|
JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
|
||||||
|
JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
|
||||||
|
JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
|
||||||
|
JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
|
||||||
|
JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
|
||||||
|
JMESSAGE(JTRC_EOI, "End Of Image")
|
||||||
|
JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
|
||||||
|
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
|
||||||
|
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
|
||||||
|
"Warning: thumbnail image size does not match data length %u")
|
||||||
|
JMESSAGE(JTRC_JFIF_EXTENSION,
|
||||||
|
"JFIF extension marker: type 0x%02x, length %u")
|
||||||
|
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
|
||||||
|
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
|
||||||
|
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
|
||||||
|
JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
|
||||||
|
JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
|
||||||
|
JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
|
||||||
|
JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
|
||||||
|
JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
|
||||||
|
JMESSAGE(JTRC_RST, "RST%d")
|
||||||
|
JMESSAGE(JTRC_SMOOTH_NOTIMPL,
|
||||||
|
"Smoothing not supported with nonstandard sampling ratios")
|
||||||
|
JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
|
||||||
|
JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
|
||||||
|
JMESSAGE(JTRC_SOI, "Start of Image")
|
||||||
|
JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
|
||||||
|
JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
|
||||||
|
JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
|
||||||
|
JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
|
||||||
|
JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
|
||||||
|
JMESSAGE(JTRC_THUMB_JPEG,
|
||||||
|
"JFIF extension marker: JPEG-compressed thumbnail image, length %u")
|
||||||
|
JMESSAGE(JTRC_THUMB_PALETTE,
|
||||||
|
"JFIF extension marker: palette thumbnail image, length %u")
|
||||||
|
JMESSAGE(JTRC_THUMB_RGB,
|
||||||
|
"JFIF extension marker: RGB thumbnail image, length %u")
|
||||||
|
JMESSAGE(JTRC_UNKNOWN_IDS,
|
||||||
|
"Unrecognized component IDs %d %d %d, assuming YCbCr")
|
||||||
|
JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
|
||||||
|
JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
|
||||||
|
JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
|
||||||
|
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
|
||||||
|
JMESSAGE(JWRN_BOGUS_PROGRESSION,
|
||||||
|
"Inconsistent progression sequence for component %d coefficient %d")
|
||||||
|
JMESSAGE(JWRN_EXTRANEOUS_DATA,
|
||||||
|
"Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
|
||||||
|
JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
|
||||||
|
JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
|
||||||
|
JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
|
||||||
|
JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
|
||||||
|
JMESSAGE(JWRN_MUST_RESYNC,
|
||||||
|
"Corrupt JPEG data: found marker 0x%02x instead of RST%d")
|
||||||
|
JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
|
||||||
|
JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
|
||||||
|
|
||||||
|
#ifdef JMAKE_ENUM_LIST
|
||||||
|
|
||||||
|
JMSG_LASTMSGCODE
|
||||||
|
} J_MESSAGE_CODE;
|
||||||
|
|
||||||
|
#undef JMAKE_ENUM_LIST
|
||||||
|
#endif /* JMAKE_ENUM_LIST */
|
||||||
|
|
||||||
|
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
|
||||||
|
#undef JMESSAGE
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef JERROR_H
|
||||||
|
#define JERROR_H
|
||||||
|
|
||||||
|
/* Macros to simplify using the error and trace message stuff */
|
||||||
|
/* The first parameter is either type of cinfo pointer */
|
||||||
|
|
||||||
|
/* Fatal errors (print message and exit) */
|
||||||
|
#define ERREXIT(cinfo,code) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||||
|
#define ERREXIT1(cinfo,code,p1) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||||
|
#define ERREXIT2(cinfo,code,p1,p2) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||||
|
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||||
|
#define ERREXIT3(cinfo,code,p1,p2,p3) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||||
|
(cinfo)->err->msg_parm.i[2] = (p3), \
|
||||||
|
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||||
|
#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||||
|
(cinfo)->err->msg_parm.i[2] = (p3), \
|
||||||
|
(cinfo)->err->msg_parm.i[3] = (p4), \
|
||||||
|
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||||
|
#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||||
|
(cinfo)->err->msg_parm.i[2] = (p3), \
|
||||||
|
(cinfo)->err->msg_parm.i[3] = (p4), \
|
||||||
|
(cinfo)->err->msg_parm.i[4] = (p5), \
|
||||||
|
(cinfo)->err->msg_parm.i[5] = (p6), \
|
||||||
|
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||||
|
#define ERREXITS(cinfo,code,str) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
|
||||||
|
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||||
|
|
||||||
|
#define MAKESTMT(stuff) do { stuff } while (0)
|
||||||
|
|
||||||
|
/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
|
||||||
|
#define WARNMS(cinfo,code) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
|
||||||
|
#define WARNMS1(cinfo,code,p1) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
|
||||||
|
#define WARNMS2(cinfo,code,p1,p2) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
|
||||||
|
|
||||||
|
/* Informational/debugging messages */
|
||||||
|
#define TRACEMS(cinfo,lvl,code) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
|
||||||
|
#define TRACEMS1(cinfo,lvl,code,p1) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
|
||||||
|
#define TRACEMS2(cinfo,lvl,code,p1,p2) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||||
|
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
|
||||||
|
#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
|
||||||
|
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
|
||||||
|
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
|
||||||
|
(cinfo)->err->msg_code = (code); \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
|
||||||
|
#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
|
||||||
|
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
|
||||||
|
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
|
||||||
|
(cinfo)->err->msg_code = (code); \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
|
||||||
|
#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
|
||||||
|
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
|
||||||
|
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
|
||||||
|
_mp[4] = (p5); \
|
||||||
|
(cinfo)->err->msg_code = (code); \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
|
||||||
|
#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
|
||||||
|
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
|
||||||
|
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
|
||||||
|
_mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
|
||||||
|
(cinfo)->err->msg_code = (code); \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
|
||||||
|
#define TRACEMSS(cinfo,lvl,code,str) \
|
||||||
|
((cinfo)->err->msg_code = (code), \
|
||||||
|
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
|
||||||
|
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
|
||||||
|
|
||||||
|
#endif /* JERROR_H */
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* jinclude.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1991-1994, Thomas G. Lane.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file exists to provide a single place to fix any problems with
|
||||||
|
* including the wrong system include files. (Common problems are taken
|
||||||
|
* care of by the standard jconfig symbols, but on really weird systems
|
||||||
|
* you may have to edit this file.)
|
||||||
|
*
|
||||||
|
* NOTE: this file is NOT intended to be included by applications using the
|
||||||
|
* JPEG library. Most applications need only include jpeglib.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Include auto-config file to find out which system include files we need. */
|
||||||
|
|
||||||
|
#include "jconfig.h" /* auto configuration options */
|
||||||
|
#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need the NULL macro and size_t typedef.
|
||||||
|
* On an ANSI-conforming system it is sufficient to include <stddef.h>.
|
||||||
|
* Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
|
||||||
|
* pull in <sys/types.h> as well.
|
||||||
|
* Note that the core JPEG library does not require <stdio.h>;
|
||||||
|
* only the default error handler and data source/destination modules do.
|
||||||
|
* But we must pull it in because of the references to FILE in jpeglib.h.
|
||||||
|
* You can remove those references if you want to compile without <stdio.h>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_STDDEF_H
|
||||||
|
#include <stddef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEED_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need memory copying and zeroing functions, plus strncpy().
|
||||||
|
* ANSI and System V implementations declare these in <string.h>.
|
||||||
|
* BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
|
||||||
|
* Some systems may declare memset and memcpy in <memory.h>.
|
||||||
|
*
|
||||||
|
* NOTE: we assume the size parameters to these functions are of type size_t.
|
||||||
|
* Change the casts in these macros if not!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef NEED_BSD_STRINGS
|
||||||
|
|
||||||
|
#include <strings.h>
|
||||||
|
#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))
|
||||||
|
#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))
|
||||||
|
|
||||||
|
#else /* not BSD, assume ANSI/SysV string lib */
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
|
||||||
|
#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In ANSI C, and indeed any rational implementation, size_t is also the
|
||||||
|
* type returned by sizeof(). However, it seems there are some irrational
|
||||||
|
* implementations out there, in which sizeof() returns an int even though
|
||||||
|
* size_t is defined as long or unsigned long. To ensure consistent results
|
||||||
|
* we always use this SIZEOF() macro in place of using sizeof() directly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SIZEOF(object) ((size_t) sizeof(object))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The modules that use fread() and fwrite() always invoke them through
|
||||||
|
* these macros. On some systems you may need to twiddle the argument casts.
|
||||||
|
* CAUTION: argument order is different from underlying functions!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define JFREAD(file,buf,sizeofbuf) \
|
||||||
|
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||||
|
#define JFWRITE(file,buf,sizeofbuf) \
|
||||||
|
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
/*
|
||||||
|
* jmemsys.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992-1997, Thomas G. Lane.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This include file defines the interface between the system-independent
|
||||||
|
* and system-dependent portions of the JPEG memory manager. No other
|
||||||
|
* modules need include it. (The system-independent portion is jmemmgr.c;
|
||||||
|
* there are several different versions of the system-dependent portion.)
|
||||||
|
*
|
||||||
|
* This file works as-is for the system-dependent memory managers supplied
|
||||||
|
* in the IJG distribution. You may need to modify it if you write a
|
||||||
|
* custom memory manager. If system-dependent changes are needed in
|
||||||
|
* this file, the best method is to #ifdef them based on a configuration
|
||||||
|
* symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR
|
||||||
|
* and USE_MAC_MEMMGR.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Short forms of external names for systems with brain-damaged linkers. */
|
||||||
|
|
||||||
|
#ifdef NEED_SHORT_EXTERNAL_NAMES
|
||||||
|
#define jpeg_get_small jGetSmall
|
||||||
|
#define jpeg_free_small jFreeSmall
|
||||||
|
#define jpeg_get_large jGetLarge
|
||||||
|
#define jpeg_free_large jFreeLarge
|
||||||
|
#define jpeg_mem_available jMemAvail
|
||||||
|
#define jpeg_open_backing_store jOpenBackStore
|
||||||
|
#define jpeg_mem_init jMemInit
|
||||||
|
#define jpeg_mem_term jMemTerm
|
||||||
|
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These two functions are used to allocate and release small chunks of
|
||||||
|
* memory. (Typically the total amount requested through jpeg_get_small is
|
||||||
|
* no more than 20K or so; this will be requested in chunks of a few K each.)
|
||||||
|
* Behavior should be the same as for the standard library functions malloc
|
||||||
|
* and free; in particular, jpeg_get_small must return NULL on failure.
|
||||||
|
* On most systems, these ARE malloc and free. jpeg_free_small is passed the
|
||||||
|
* size of the object being freed, just in case it's needed.
|
||||||
|
* On an 80x86 machine using small-data memory model, these manage near heap.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject));
|
||||||
|
EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object,
|
||||||
|
size_t sizeofobject));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These two functions are used to allocate and release large chunks of
|
||||||
|
* memory (up to the total free space designated by jpeg_mem_available).
|
||||||
|
* The interface is the same as above, except that on an 80x86 machine,
|
||||||
|
* far pointers are used. On most other machines these are identical to
|
||||||
|
* the jpeg_get/free_small routines; but we keep them separate anyway,
|
||||||
|
* in case a different allocation strategy is desirable for large chunks.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo,
|
||||||
|
size_t sizeofobject));
|
||||||
|
EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,
|
||||||
|
size_t sizeofobject));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
|
||||||
|
* be requested in a single call to jpeg_get_large (and jpeg_get_small for that
|
||||||
|
* matter, but that case should never come into play). This macro is needed
|
||||||
|
* to model the 64Kb-segment-size limit of far addressing on 80x86 machines.
|
||||||
|
* On those machines, we expect that jconfig.h will provide a proper value.
|
||||||
|
* On machines with 32-bit flat address spaces, any large constant may be used.
|
||||||
|
*
|
||||||
|
* NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type
|
||||||
|
* size_t and will be a multiple of sizeof(align_type).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */
|
||||||
|
#define MAX_ALLOC_CHUNK 1000000000L
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This routine computes the total space still available for allocation by
|
||||||
|
* jpeg_get_large. If more space than this is needed, backing store will be
|
||||||
|
* used. NOTE: any memory already allocated must not be counted.
|
||||||
|
*
|
||||||
|
* There is a minimum space requirement, corresponding to the minimum
|
||||||
|
* feasible buffer sizes; jmemmgr.c will request that much space even if
|
||||||
|
* jpeg_mem_available returns zero. The maximum space needed, enough to hold
|
||||||
|
* all working storage in memory, is also passed in case it is useful.
|
||||||
|
* Finally, the total space already allocated is passed. If no better
|
||||||
|
* method is available, cinfo->mem->max_memory_to_use - already_allocated
|
||||||
|
* is often a suitable calculation.
|
||||||
|
*
|
||||||
|
* It is OK for jpeg_mem_available to underestimate the space available
|
||||||
|
* (that'll just lead to more backing-store access than is really necessary).
|
||||||
|
* However, an overestimate will lead to failure. Hence it's wise to subtract
|
||||||
|
* a slop factor from the true available space. 5% should be enough.
|
||||||
|
*
|
||||||
|
* On machines with lots of virtual memory, any large constant may be returned.
|
||||||
|
* Conversely, zero may be returned to always use the minimum amount of memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo,
|
||||||
|
long min_bytes_needed,
|
||||||
|
long max_bytes_needed,
|
||||||
|
long already_allocated));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This structure holds whatever state is needed to access a single
|
||||||
|
* backing-store object. The read/write/close method pointers are called
|
||||||
|
* by jmemmgr.c to manipulate the backing-store object; all other fields
|
||||||
|
* are private to the system-dependent backing store routines.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */
|
||||||
|
|
||||||
|
typedef unsigned short XMSH; /* type of extended-memory handles */
|
||||||
|
typedef unsigned short EMSH; /* type of expanded-memory handles */
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
short file_handle; /* DOS file handle if it's a temp file */
|
||||||
|
XMSH xms_handle; /* handle if it's a chunk of XMS */
|
||||||
|
EMSH ems_handle; /* handle if it's a chunk of EMS */
|
||||||
|
} handle_union;
|
||||||
|
|
||||||
|
#endif /* USE_MSDOS_MEMMGR */
|
||||||
|
|
||||||
|
#ifdef USE_MAC_MEMMGR /* Mac-specific junk */
|
||||||
|
#include <Files.h>
|
||||||
|
#endif /* USE_MAC_MEMMGR */
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct backing_store_struct * backing_store_ptr;
|
||||||
|
|
||||||
|
typedef struct backing_store_struct {
|
||||||
|
/* Methods for reading/writing/closing this backing-store object */
|
||||||
|
JMETHOD(void, read_backing_store, (j_common_ptr cinfo,
|
||||||
|
backing_store_ptr info,
|
||||||
|
void FAR * buffer_address,
|
||||||
|
long file_offset, long byte_count));
|
||||||
|
JMETHOD(void, write_backing_store, (j_common_ptr cinfo,
|
||||||
|
backing_store_ptr info,
|
||||||
|
void FAR * buffer_address,
|
||||||
|
long file_offset, long byte_count));
|
||||||
|
JMETHOD(void, close_backing_store, (j_common_ptr cinfo,
|
||||||
|
backing_store_ptr info));
|
||||||
|
|
||||||
|
/* Private fields for system-dependent backing-store management */
|
||||||
|
#ifdef USE_MSDOS_MEMMGR
|
||||||
|
/* For the MS-DOS manager (jmemdos.c), we need: */
|
||||||
|
handle_union handle; /* reference to backing-store storage object */
|
||||||
|
char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */
|
||||||
|
#else
|
||||||
|
#ifdef USE_MAC_MEMMGR
|
||||||
|
/* For the Mac manager (jmemmac.c), we need: */
|
||||||
|
short temp_file; /* file reference number to temp file */
|
||||||
|
FSSpec tempSpec; /* the FSSpec for the temp file */
|
||||||
|
char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */
|
||||||
|
#else
|
||||||
|
/* For a typical implementation with temp files, we need: */
|
||||||
|
FILE * temp_file; /* stdio reference to temp file */
|
||||||
|
char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
} backing_store_info;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initial opening of a backing-store object. This must fill in the
|
||||||
|
* read/write/close pointers in the object. The read/write routines
|
||||||
|
* may take an error exit if the specified maximum file size is exceeded.
|
||||||
|
* (If jpeg_mem_available always returns a large value, this routine can
|
||||||
|
* just take an error exit.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo,
|
||||||
|
backing_store_ptr info,
|
||||||
|
long total_bytes_needed));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These routines take care of any system-dependent initialization and
|
||||||
|
* cleanup required. jpeg_mem_init will be called before anything is
|
||||||
|
* allocated (and, therefore, nothing in cinfo is of use except the error
|
||||||
|
* manager pointer). It should return a suitable default value for
|
||||||
|
* max_memory_to_use; this may subsequently be overridden by the surrounding
|
||||||
|
* application. (Note that max_memory_to_use is only important if
|
||||||
|
* jpeg_mem_available chooses to consult it ... no one else will.)
|
||||||
|
* jpeg_mem_term may assume that all requested memory has been freed and that
|
||||||
|
* all opened backing-store objects have been closed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo));
|
||||||
|
EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo));
|
||||||
@@ -0,0 +1,369 @@
|
|||||||
|
/*
|
||||||
|
* jmorecfg.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
|
* Modified 1997-2011 by Guido Vollbeding.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file contains additional configuration options that customize the
|
||||||
|
* JPEG software for special applications or support machine-dependent
|
||||||
|
* optimizations. Most users will not need to touch this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define BITS_IN_JSAMPLE as either
|
||||||
|
* 8 for 8-bit sample values (the usual setting)
|
||||||
|
* 12 for 12-bit sample values
|
||||||
|
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
|
||||||
|
* JPEG standard, and the IJG code does not support anything else!
|
||||||
|
* We do not support run-time selection of data precision, sorry.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Maximum number of components (color channels) allowed in JPEG image.
|
||||||
|
* To meet the letter of the JPEG spec, set this to 255. However, darn
|
||||||
|
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
|
||||||
|
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
|
||||||
|
* really short on memory. (Each allowed component costs a hundred or so
|
||||||
|
* bytes of storage, whether actually used in an image or not.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAX_COMPONENTS 10 /* maximum number of image components */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic data types.
|
||||||
|
* You may need to change these if you have a machine with unusual data
|
||||||
|
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
|
||||||
|
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
|
||||||
|
* but it had better be at least 16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Representation of a single sample (pixel element value).
|
||||||
|
* We frequently allocate large arrays of these, so it's important to keep
|
||||||
|
* them small. But if you have memory to burn and access to char or short
|
||||||
|
* arrays is very slow on your hardware, you might want to change these.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if BITS_IN_JSAMPLE == 8
|
||||||
|
/* JSAMPLE should be the smallest type that will hold the values 0..255.
|
||||||
|
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_CHAR
|
||||||
|
|
||||||
|
typedef unsigned char JSAMPLE;
|
||||||
|
#define GETJSAMPLE(value) ((int) (value))
|
||||||
|
|
||||||
|
#else /* not HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
typedef char JSAMPLE;
|
||||||
|
#ifdef CHAR_IS_UNSIGNED
|
||||||
|
#define GETJSAMPLE(value) ((int) (value))
|
||||||
|
#else
|
||||||
|
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
|
||||||
|
#endif /* CHAR_IS_UNSIGNED */
|
||||||
|
|
||||||
|
#endif /* HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
#define MAXJSAMPLE 255
|
||||||
|
#define CENTERJSAMPLE 128
|
||||||
|
|
||||||
|
#endif /* BITS_IN_JSAMPLE == 8 */
|
||||||
|
|
||||||
|
|
||||||
|
#if BITS_IN_JSAMPLE == 12
|
||||||
|
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
|
||||||
|
* On nearly all machines "short" will do nicely.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef short JSAMPLE;
|
||||||
|
#define GETJSAMPLE(value) ((int) (value))
|
||||||
|
|
||||||
|
#define MAXJSAMPLE 4095
|
||||||
|
#define CENTERJSAMPLE 2048
|
||||||
|
|
||||||
|
#endif /* BITS_IN_JSAMPLE == 12 */
|
||||||
|
|
||||||
|
|
||||||
|
/* Representation of a DCT frequency coefficient.
|
||||||
|
* This should be a signed value of at least 16 bits; "short" is usually OK.
|
||||||
|
* Again, we allocate large arrays of these, but you can change to int
|
||||||
|
* if you have memory to burn and "short" is really slow.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef short JCOEF;
|
||||||
|
|
||||||
|
|
||||||
|
/* Compressed datastreams are represented as arrays of JOCTET.
|
||||||
|
* These must be EXACTLY 8 bits wide, at least once they are written to
|
||||||
|
* external storage. Note that when using the stdio data source/destination
|
||||||
|
* managers, this is also the data type passed to fread/fwrite.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_CHAR
|
||||||
|
|
||||||
|
typedef unsigned char JOCTET;
|
||||||
|
#define GETJOCTET(value) (value)
|
||||||
|
|
||||||
|
#else /* not HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
typedef char JOCTET;
|
||||||
|
#ifdef CHAR_IS_UNSIGNED
|
||||||
|
#define GETJOCTET(value) (value)
|
||||||
|
#else
|
||||||
|
#define GETJOCTET(value) ((value) & 0xFF)
|
||||||
|
#endif /* CHAR_IS_UNSIGNED */
|
||||||
|
|
||||||
|
#endif /* HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
|
||||||
|
/* These typedefs are used for various table entries and so forth.
|
||||||
|
* They must be at least as wide as specified; but making them too big
|
||||||
|
* won't cost a huge amount of memory, so we don't provide special
|
||||||
|
* extraction code like we did for JSAMPLE. (In other words, these
|
||||||
|
* typedefs live at a different point on the speed/space tradeoff curve.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* UINT8 must hold at least the values 0..255. */
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_CHAR
|
||||||
|
typedef unsigned char UINT8;
|
||||||
|
#else /* not HAVE_UNSIGNED_CHAR */
|
||||||
|
#ifdef CHAR_IS_UNSIGNED
|
||||||
|
typedef char UINT8;
|
||||||
|
#else /* not CHAR_IS_UNSIGNED */
|
||||||
|
typedef short UINT8;
|
||||||
|
#endif /* CHAR_IS_UNSIGNED */
|
||||||
|
#endif /* HAVE_UNSIGNED_CHAR */
|
||||||
|
|
||||||
|
/* UINT16 must hold at least the values 0..65535. */
|
||||||
|
|
||||||
|
#ifdef HAVE_UNSIGNED_SHORT
|
||||||
|
typedef unsigned short UINT16;
|
||||||
|
#else /* not HAVE_UNSIGNED_SHORT */
|
||||||
|
typedef unsigned int UINT16;
|
||||||
|
#endif /* HAVE_UNSIGNED_SHORT */
|
||||||
|
|
||||||
|
/* INT16 must hold at least the values -32768..32767. */
|
||||||
|
|
||||||
|
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
||||||
|
typedef short INT16;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* INT32 must hold at least signed 32-bit values. */
|
||||||
|
|
||||||
|
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||||
|
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
|
||||||
|
#ifndef _BASETSD_H /* MinGW is slightly different */
|
||||||
|
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
|
||||||
|
typedef long INT32;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Datatype used for image dimensions. The JPEG standard only supports
|
||||||
|
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
||||||
|
* "unsigned int" is sufficient on all machines. However, if you need to
|
||||||
|
* handle larger images and you don't mind deviating from the spec, you
|
||||||
|
* can change this datatype.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef unsigned int JDIMENSION;
|
||||||
|
|
||||||
|
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
|
||||||
|
|
||||||
|
|
||||||
|
/* These macros are used in all function definitions and extern declarations.
|
||||||
|
* You could modify them if you need to change function linkage conventions;
|
||||||
|
* in particular, you'll need to do that to make the library a Windows DLL.
|
||||||
|
* Another application is to make all functions global for use with debuggers
|
||||||
|
* or code profilers that require it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* a function called through method pointers: */
|
||||||
|
#define METHODDEF(type) static type
|
||||||
|
/* a function used only in its module: */
|
||||||
|
#define LOCAL(type) static type
|
||||||
|
/* a function referenced thru EXTERNs: */
|
||||||
|
#define GLOBAL(type) type
|
||||||
|
/* a reference to a GLOBAL function: */
|
||||||
|
#define EXTERN(type) extern type
|
||||||
|
|
||||||
|
|
||||||
|
/* This macro is used to declare a "method", that is, a function pointer.
|
||||||
|
* We want to supply prototype parameters if the compiler can cope.
|
||||||
|
* Note that the arglist parameter must be parenthesized!
|
||||||
|
* Again, you can customize this if you need special linkage keywords.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_PROTOTYPES
|
||||||
|
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
|
||||||
|
#else
|
||||||
|
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Here is the pseudo-keyword for declaring pointers that must be "far"
|
||||||
|
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
|
||||||
|
* by just saying "FAR *" where such a pointer is needed. In a few places
|
||||||
|
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FAR
|
||||||
|
#ifdef NEED_FAR_POINTERS
|
||||||
|
#define FAR far
|
||||||
|
#else
|
||||||
|
#define FAR
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
|
||||||
|
* in standard header files. Or you may have conflicts with application-
|
||||||
|
* specific header files that you want to include together with these files.
|
||||||
|
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HAVE_BOOLEAN
|
||||||
|
typedef int boolean;
|
||||||
|
#endif
|
||||||
|
#ifndef FALSE /* in case these macros already exist */
|
||||||
|
#define FALSE 0 /* values of boolean */
|
||||||
|
#endif
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The remaining options affect code selection within the JPEG library,
|
||||||
|
* but they don't need to be visible to most applications using the library.
|
||||||
|
* To minimize application namespace pollution, the symbols won't be
|
||||||
|
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef JPEG_INTERNALS
|
||||||
|
#define JPEG_INTERNAL_OPTIONS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef JPEG_INTERNAL_OPTIONS
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These defines indicate whether to include various optional functions.
|
||||||
|
* Undefining some of these symbols will produce a smaller but less capable
|
||||||
|
* library. Note that you can leave certain source files out of the
|
||||||
|
* compilation/linking process if you've #undef'd the corresponding symbols.
|
||||||
|
* (You may HAVE to do that if your compiler doesn't like null source files.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Capability options common to encoder and decoder: */
|
||||||
|
|
||||||
|
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
|
||||||
|
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
|
||||||
|
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
|
||||||
|
|
||||||
|
/* Encoder capability options: */
|
||||||
|
|
||||||
|
#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||||
|
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||||
|
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||||
|
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
|
||||||
|
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
|
||||||
|
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
|
||||||
|
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
|
||||||
|
* precision, so jchuff.c normally uses entropy optimization to compute
|
||||||
|
* usable tables for higher precision. If you don't want to do optimization,
|
||||||
|
* you'll have to supply different default Huffman tables.
|
||||||
|
* The exact same statements apply for progressive JPEG: the default tables
|
||||||
|
* don't work for progressive mode. (This may get fixed, however.)
|
||||||
|
*/
|
||||||
|
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
|
||||||
|
|
||||||
|
/* Decoder capability options: */
|
||||||
|
|
||||||
|
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||||
|
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||||
|
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||||
|
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
|
||||||
|
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
|
||||||
|
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
|
||||||
|
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
|
||||||
|
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
|
||||||
|
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
|
||||||
|
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
|
||||||
|
|
||||||
|
/* more capability options later, no doubt */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ordering of RGB data in scanlines passed to or from the application.
|
||||||
|
* If your application wants to deal with data in the order B,G,R, just
|
||||||
|
* change these macros. You can also deal with formats such as R,G,B,X
|
||||||
|
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
|
||||||
|
* the offsets will also change the order in which colormap data is organized.
|
||||||
|
* RESTRICTIONS:
|
||||||
|
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
|
||||||
|
* 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
||||||
|
* is not 3 (they don't understand about dummy color components!). So you
|
||||||
|
* can't use color quantization if you change that value.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RGB_RED 2 /* Offset of Red in an RGB scanline element */
|
||||||
|
#define RGB_GREEN 1 /* Offset of Green */
|
||||||
|
#define RGB_BLUE 0 /* Offset of Blue */
|
||||||
|
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
|
||||||
|
|
||||||
|
|
||||||
|
/* Definitions for speed-related optimizations. */
|
||||||
|
|
||||||
|
|
||||||
|
/* If your compiler supports inline functions, define INLINE
|
||||||
|
* as the inline keyword; otherwise define it as empty.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INLINE
|
||||||
|
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
|
||||||
|
#define INLINE __inline__
|
||||||
|
#endif
|
||||||
|
#ifndef INLINE
|
||||||
|
#define INLINE /* default is to define it as empty */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
|
||||||
|
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
|
||||||
|
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MULTIPLIER
|
||||||
|
#define MULTIPLIER int /* type for fastest integer multiply */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* FAST_FLOAT should be either float or double, whichever is done faster
|
||||||
|
* by your compiler. (Note that this type is only used in the floating point
|
||||||
|
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
|
||||||
|
* Typically, float is faster in ANSI C compilers, while double is faster in
|
||||||
|
* pre-ANSI compilers (because they insist on converting to double anyway).
|
||||||
|
* The code below therefore chooses float if we have ANSI-style prototypes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FAST_FLOAT
|
||||||
|
#ifdef HAVE_PROTOTYPES
|
||||||
|
#define FAST_FLOAT float
|
||||||
|
#else
|
||||||
|
#define FAST_FLOAT double
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* JPEG_INTERNAL_OPTIONS */
|
||||||
@@ -0,0 +1,426 @@
|
|||||||
|
/*
|
||||||
|
* jpegint.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
|
* Modified 1997-2011 by Guido Vollbeding.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file provides common declarations for the various JPEG modules.
|
||||||
|
* These declarations are considered internal to the JPEG library; most
|
||||||
|
* applications using the library shouldn't need to include this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Declarations for both compression & decompression */
|
||||||
|
|
||||||
|
typedef enum { /* Operating modes for buffer controllers */
|
||||||
|
JBUF_PASS_THRU, /* Plain stripwise operation */
|
||||||
|
/* Remaining modes require a full-image buffer to have been created */
|
||||||
|
JBUF_SAVE_SOURCE, /* Run source subobject only, save output */
|
||||||
|
JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */
|
||||||
|
JBUF_SAVE_AND_PASS /* Run both subobjects, save output */
|
||||||
|
} J_BUF_MODE;
|
||||||
|
|
||||||
|
/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
|
||||||
|
#define CSTATE_START 100 /* after create_compress */
|
||||||
|
#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
|
||||||
|
#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */
|
||||||
|
#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */
|
||||||
|
#define DSTATE_START 200 /* after create_decompress */
|
||||||
|
#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
|
||||||
|
#define DSTATE_READY 202 /* found SOS, ready for start_decompress */
|
||||||
|
#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/
|
||||||
|
#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */
|
||||||
|
#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
|
||||||
|
#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */
|
||||||
|
#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
|
||||||
|
#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */
|
||||||
|
#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */
|
||||||
|
#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
|
||||||
|
|
||||||
|
|
||||||
|
/* Declarations for compression modules */
|
||||||
|
|
||||||
|
/* Master control module */
|
||||||
|
struct jpeg_comp_master {
|
||||||
|
JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
|
||||||
|
|
||||||
|
/* State variables made visible to other modules */
|
||||||
|
boolean call_pass_startup; /* True if pass_startup must be called */
|
||||||
|
boolean is_last_pass; /* True during last pass */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Main buffer control (downsampled-data buffer) */
|
||||||
|
struct jpeg_c_main_controller {
|
||||||
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
||||||
|
JMETHOD(void, process_data, (j_compress_ptr cinfo,
|
||||||
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
|
JDIMENSION in_rows_avail));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Compression preprocessing (downsampling input buffer control) */
|
||||||
|
struct jpeg_c_prep_controller {
|
||||||
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
||||||
|
JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
|
||||||
|
JSAMPARRAY input_buf,
|
||||||
|
JDIMENSION *in_row_ctr,
|
||||||
|
JDIMENSION in_rows_avail,
|
||||||
|
JSAMPIMAGE output_buf,
|
||||||
|
JDIMENSION *out_row_group_ctr,
|
||||||
|
JDIMENSION out_row_groups_avail));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Coefficient buffer control */
|
||||||
|
struct jpeg_c_coef_controller {
|
||||||
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
||||||
|
JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
|
||||||
|
JSAMPIMAGE input_buf));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Colorspace conversion */
|
||||||
|
struct jpeg_color_converter {
|
||||||
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, color_convert, (j_compress_ptr cinfo,
|
||||||
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||||
|
JDIMENSION output_row, int num_rows));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Downsampling */
|
||||||
|
struct jpeg_downsampler {
|
||||||
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, downsample, (j_compress_ptr cinfo,
|
||||||
|
JSAMPIMAGE input_buf, JDIMENSION in_row_index,
|
||||||
|
JSAMPIMAGE output_buf,
|
||||||
|
JDIMENSION out_row_group_index));
|
||||||
|
|
||||||
|
boolean need_context_rows; /* TRUE if need rows above & below */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Forward DCT (also controls coefficient quantization) */
|
||||||
|
typedef JMETHOD(void, forward_DCT_ptr,
|
||||||
|
(j_compress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
|
||||||
|
JDIMENSION start_row, JDIMENSION start_col,
|
||||||
|
JDIMENSION num_blocks));
|
||||||
|
|
||||||
|
struct jpeg_forward_dct {
|
||||||
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
||||||
|
/* It is useful to allow each component to have a separate FDCT method. */
|
||||||
|
forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Entropy encoding */
|
||||||
|
struct jpeg_entropy_encoder {
|
||||||
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
|
||||||
|
JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
|
||||||
|
JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Marker writing */
|
||||||
|
struct jpeg_marker_writer {
|
||||||
|
JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
|
||||||
|
JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
|
||||||
|
/* These routines are exported to allow insertion of extra markers */
|
||||||
|
/* Probably only COM and APPn markers should be written this way */
|
||||||
|
JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
|
||||||
|
unsigned int datalen));
|
||||||
|
JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Declarations for decompression modules */
|
||||||
|
|
||||||
|
/* Master control module */
|
||||||
|
struct jpeg_decomp_master {
|
||||||
|
JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
|
||||||
|
|
||||||
|
/* State variables made visible to other modules */
|
||||||
|
boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Input control module */
|
||||||
|
struct jpeg_input_controller {
|
||||||
|
JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
|
||||||
|
|
||||||
|
/* State variables made visible to other modules */
|
||||||
|
boolean has_multiple_scans; /* True if file has multiple scans */
|
||||||
|
boolean eoi_reached; /* True when EOI has been consumed */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Main buffer control (downsampled-data buffer) */
|
||||||
|
struct jpeg_d_main_controller {
|
||||||
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
|
||||||
|
JMETHOD(void, process_data, (j_decompress_ptr cinfo,
|
||||||
|
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||||
|
JDIMENSION out_rows_avail));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Coefficient buffer control */
|
||||||
|
struct jpeg_d_coef_controller {
|
||||||
|
JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
|
||||||
|
JSAMPIMAGE output_buf));
|
||||||
|
/* Pointer to array of coefficient virtual arrays, or NULL if none */
|
||||||
|
jvirt_barray_ptr *coef_arrays;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Decompression postprocessing (color quantization buffer control) */
|
||||||
|
struct jpeg_d_post_controller {
|
||||||
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
|
||||||
|
JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
|
||||||
|
JSAMPIMAGE input_buf,
|
||||||
|
JDIMENSION *in_row_group_ctr,
|
||||||
|
JDIMENSION in_row_groups_avail,
|
||||||
|
JSAMPARRAY output_buf,
|
||||||
|
JDIMENSION *out_row_ctr,
|
||||||
|
JDIMENSION out_rows_avail));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Marker reading & parsing */
|
||||||
|
struct jpeg_marker_reader {
|
||||||
|
JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
|
||||||
|
/* Read markers until SOS or EOI.
|
||||||
|
* Returns same codes as are defined for jpeg_consume_input:
|
||||||
|
* JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
|
||||||
|
*/
|
||||||
|
JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
|
||||||
|
/* Read a restart marker --- exported for use by entropy decoder only */
|
||||||
|
jpeg_marker_parser_method read_restart_marker;
|
||||||
|
|
||||||
|
/* State of marker reader --- nominally internal, but applications
|
||||||
|
* supplying COM or APPn handlers might like to know the state.
|
||||||
|
*/
|
||||||
|
boolean saw_SOI; /* found SOI? */
|
||||||
|
boolean saw_SOF; /* found SOF? */
|
||||||
|
int next_restart_num; /* next restart number expected (0-7) */
|
||||||
|
unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Entropy decoding */
|
||||||
|
struct jpeg_entropy_decoder {
|
||||||
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
|
||||||
|
JBLOCKROW *MCU_data));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Inverse DCT (also performs dequantization) */
|
||||||
|
typedef JMETHOD(void, inverse_DCT_method_ptr,
|
||||||
|
(j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||||
|
JCOEFPTR coef_block,
|
||||||
|
JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||||
|
|
||||||
|
struct jpeg_inverse_dct {
|
||||||
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
||||||
|
/* It is useful to allow each component to have a separate IDCT method. */
|
||||||
|
inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Upsampling (note that upsampler must also call color converter) */
|
||||||
|
struct jpeg_upsampler {
|
||||||
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, upsample, (j_decompress_ptr cinfo,
|
||||||
|
JSAMPIMAGE input_buf,
|
||||||
|
JDIMENSION *in_row_group_ctr,
|
||||||
|
JDIMENSION in_row_groups_avail,
|
||||||
|
JSAMPARRAY output_buf,
|
||||||
|
JDIMENSION *out_row_ctr,
|
||||||
|
JDIMENSION out_rows_avail));
|
||||||
|
|
||||||
|
boolean need_context_rows; /* TRUE if need rows above & below */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Colorspace conversion */
|
||||||
|
struct jpeg_color_deconverter {
|
||||||
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
|
||||||
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||||
|
JSAMPARRAY output_buf, int num_rows));
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Color quantization or color precision reduction */
|
||||||
|
struct jpeg_color_quantizer {
|
||||||
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
|
||||||
|
JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
|
||||||
|
JSAMPARRAY input_buf, JSAMPARRAY output_buf,
|
||||||
|
int num_rows));
|
||||||
|
JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
|
||||||
|
JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Miscellaneous useful macros */
|
||||||
|
|
||||||
|
#undef MAX
|
||||||
|
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||||
|
#undef MIN
|
||||||
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
|
|
||||||
|
/* We assume that right shift corresponds to signed division by 2 with
|
||||||
|
* rounding towards minus infinity. This is correct for typical "arithmetic
|
||||||
|
* shift" instructions that shift in copies of the sign bit. But some
|
||||||
|
* C compilers implement >> with an unsigned shift. For these machines you
|
||||||
|
* must define RIGHT_SHIFT_IS_UNSIGNED.
|
||||||
|
* RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
|
||||||
|
* It is only applied with constant shift counts. SHIFT_TEMPS must be
|
||||||
|
* included in the variables of any routine using RIGHT_SHIFT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
||||||
|
#define SHIFT_TEMPS INT32 shift_temp;
|
||||||
|
#define RIGHT_SHIFT(x,shft) \
|
||||||
|
((shift_temp = (x)) < 0 ? \
|
||||||
|
(shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
|
||||||
|
(shift_temp >> (shft)))
|
||||||
|
#else
|
||||||
|
#define SHIFT_TEMPS
|
||||||
|
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Short forms of external names for systems with brain-damaged linkers. */
|
||||||
|
|
||||||
|
#ifdef NEED_SHORT_EXTERNAL_NAMES
|
||||||
|
#define jinit_compress_master jICompress
|
||||||
|
#define jinit_c_master_control jICMaster
|
||||||
|
#define jinit_c_main_controller jICMainC
|
||||||
|
#define jinit_c_prep_controller jICPrepC
|
||||||
|
#define jinit_c_coef_controller jICCoefC
|
||||||
|
#define jinit_color_converter jICColor
|
||||||
|
#define jinit_downsampler jIDownsampler
|
||||||
|
#define jinit_forward_dct jIFDCT
|
||||||
|
#define jinit_huff_encoder jIHEncoder
|
||||||
|
#define jinit_arith_encoder jIAEncoder
|
||||||
|
#define jinit_marker_writer jIMWriter
|
||||||
|
#define jinit_master_decompress jIDMaster
|
||||||
|
#define jinit_d_main_controller jIDMainC
|
||||||
|
#define jinit_d_coef_controller jIDCoefC
|
||||||
|
#define jinit_d_post_controller jIDPostC
|
||||||
|
#define jinit_input_controller jIInCtlr
|
||||||
|
#define jinit_marker_reader jIMReader
|
||||||
|
#define jinit_huff_decoder jIHDecoder
|
||||||
|
#define jinit_arith_decoder jIADecoder
|
||||||
|
#define jinit_inverse_dct jIIDCT
|
||||||
|
#define jinit_upsampler jIUpsampler
|
||||||
|
#define jinit_color_deconverter jIDColor
|
||||||
|
#define jinit_1pass_quantizer jI1Quant
|
||||||
|
#define jinit_2pass_quantizer jI2Quant
|
||||||
|
#define jinit_merged_upsampler jIMUpsampler
|
||||||
|
#define jinit_memory_mgr jIMemMgr
|
||||||
|
#define jdiv_round_up jDivRound
|
||||||
|
#define jround_up jRound
|
||||||
|
#define jzero_far jZeroFar
|
||||||
|
#define jcopy_sample_rows jCopySamples
|
||||||
|
#define jcopy_block_row jCopyBlocks
|
||||||
|
#define jpeg_zigzag_order jZIGTable
|
||||||
|
#define jpeg_natural_order jZAGTable
|
||||||
|
#define jpeg_natural_order7 jZAG7Table
|
||||||
|
#define jpeg_natural_order6 jZAG6Table
|
||||||
|
#define jpeg_natural_order5 jZAG5Table
|
||||||
|
#define jpeg_natural_order4 jZAG4Table
|
||||||
|
#define jpeg_natural_order3 jZAG3Table
|
||||||
|
#define jpeg_natural_order2 jZAG2Table
|
||||||
|
#define jpeg_aritab jAriTab
|
||||||
|
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
||||||
|
|
||||||
|
|
||||||
|
/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
|
||||||
|
* and coefficient-block arrays. This won't work on 80x86 because the arrays
|
||||||
|
* are FAR and we're assuming a small-pointer memory model. However, some
|
||||||
|
* DOS compilers provide far-pointer versions of memcpy() and memset() even
|
||||||
|
* in the small-model libraries. These will be used if USE_FMEM is defined.
|
||||||
|
* Otherwise, the routines in jutils.c do it the hard way.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NEED_FAR_POINTERS /* normal case, same as regular macro */
|
||||||
|
#define FMEMZERO(target,size) MEMZERO(target,size)
|
||||||
|
#else /* 80x86 case */
|
||||||
|
#ifdef USE_FMEM
|
||||||
|
#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size))
|
||||||
|
#else
|
||||||
|
EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
|
||||||
|
#define FMEMZERO(target,size) jzero_far(target, size)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Compression module initialization routines */
|
||||||
|
EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
|
||||||
|
boolean transcode_only));
|
||||||
|
EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
|
||||||
|
boolean need_full_buffer));
|
||||||
|
EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
|
||||||
|
boolean need_full_buffer));
|
||||||
|
EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
|
||||||
|
boolean need_full_buffer));
|
||||||
|
EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
|
||||||
|
/* Decompression module initialization routines */
|
||||||
|
EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
|
||||||
|
boolean need_full_buffer));
|
||||||
|
EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
|
||||||
|
boolean need_full_buffer));
|
||||||
|
EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
|
||||||
|
boolean need_full_buffer));
|
||||||
|
EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
|
||||||
|
EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
|
||||||
|
/* Memory manager initialization */
|
||||||
|
EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
|
||||||
|
|
||||||
|
/* Utility routines in jutils.c */
|
||||||
|
EXTERN(long) jdiv_round_up JPP((long a, long b));
|
||||||
|
EXTERN(long) jround_up JPP((long a, long b));
|
||||||
|
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
|
||||||
|
JSAMPARRAY output_array, int dest_row,
|
||||||
|
int num_rows, JDIMENSION num_cols));
|
||||||
|
EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
|
||||||
|
JDIMENSION num_blocks));
|
||||||
|
/* Constant tables in jutils.c */
|
||||||
|
#if 0 /* This table is not actually needed in v6a */
|
||||||
|
extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
|
||||||
|
#endif
|
||||||
|
extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
|
||||||
|
extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */
|
||||||
|
extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */
|
||||||
|
extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */
|
||||||
|
extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */
|
||||||
|
extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */
|
||||||
|
extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */
|
||||||
|
|
||||||
|
/* Arithmetic coding probability estimation tables in jaricom.c */
|
||||||
|
extern const INT32 jpeg_aritab[];
|
||||||
|
|
||||||
|
/* Suppress undefined-structure complaints if necessary. */
|
||||||
|
|
||||||
|
#ifdef INCOMPLETE_TYPES_BROKEN
|
||||||
|
#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */
|
||||||
|
struct jvirt_sarray_control { long dummy; };
|
||||||
|
struct jvirt_barray_control { long dummy; };
|
||||||
|
#endif
|
||||||
|
#endif /* INCOMPLETE_TYPES_BROKEN */
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* jversion.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file contains software version identification.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define JVERSION "8d 15-Jan-2012"
|
||||||
|
|
||||||
|
#define JCOPYRIGHT "Copyright (C) 2012, Thomas G. Lane, Guido Vollbeding"
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
/*
|
||||||
|
* transupp.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
|
||||||
|
* This file is part of the Independent JPEG Group's software.
|
||||||
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
|
*
|
||||||
|
* This file contains declarations for image transformation routines and
|
||||||
|
* other utility code used by the jpegtran sample application. These are
|
||||||
|
* NOT part of the core JPEG library. But we keep these routines separate
|
||||||
|
* from jpegtran.c to ease the task of maintaining jpegtran-like programs
|
||||||
|
* that have other user interfaces.
|
||||||
|
*
|
||||||
|
* NOTE: all the routines declared here have very specific requirements
|
||||||
|
* about when they are to be executed during the reading and writing of the
|
||||||
|
* source and destination files. See the comments in transupp.c, or see
|
||||||
|
* jpegtran.c for an example of correct usage.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* If you happen not to want the image transform support, disable it here */
|
||||||
|
#ifndef TRANSFORMS_SUPPORTED
|
||||||
|
#define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Although rotating and flipping data expressed as DCT coefficients is not
|
||||||
|
* hard, there is an asymmetry in the JPEG format specification for images
|
||||||
|
* whose dimensions aren't multiples of the iMCU size. The right and bottom
|
||||||
|
* image edges are padded out to the next iMCU boundary with junk data; but
|
||||||
|
* no padding is possible at the top and left edges. If we were to flip
|
||||||
|
* the whole image including the pad data, then pad garbage would become
|
||||||
|
* visible at the top and/or left, and real pixels would disappear into the
|
||||||
|
* pad margins --- perhaps permanently, since encoders & decoders may not
|
||||||
|
* bother to preserve DCT blocks that appear to be completely outside the
|
||||||
|
* nominal image area. So, we have to exclude any partial iMCUs from the
|
||||||
|
* basic transformation.
|
||||||
|
*
|
||||||
|
* Transpose is the only transformation that can handle partial iMCUs at the
|
||||||
|
* right and bottom edges completely cleanly. flip_h can flip partial iMCUs
|
||||||
|
* at the bottom, but leaves any partial iMCUs at the right edge untouched.
|
||||||
|
* Similarly flip_v leaves any partial iMCUs at the bottom edge untouched.
|
||||||
|
* The other transforms are defined as combinations of these basic transforms
|
||||||
|
* and process edge blocks in a way that preserves the equivalence.
|
||||||
|
*
|
||||||
|
* The "trim" option causes untransformable partial iMCUs to be dropped;
|
||||||
|
* this is not strictly lossless, but it usually gives the best-looking
|
||||||
|
* result for odd-size images. Note that when this option is active,
|
||||||
|
* the expected mathematical equivalences between the transforms may not hold.
|
||||||
|
* (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim
|
||||||
|
* followed by -rot 180 -trim trims both edges.)
|
||||||
|
*
|
||||||
|
* We also offer a lossless-crop option, which discards data outside a given
|
||||||
|
* image region but losslessly preserves what is inside. Like the rotate and
|
||||||
|
* flip transforms, lossless crop is restricted by the JPEG format: the upper
|
||||||
|
* left corner of the selected region must fall on an iMCU boundary. If this
|
||||||
|
* does not hold for the given crop parameters, we silently move the upper left
|
||||||
|
* corner up and/or left to make it so, simultaneously increasing the region
|
||||||
|
* dimensions to keep the lower right crop corner unchanged. (Thus, the
|
||||||
|
* output image covers at least the requested region, but may cover more.)
|
||||||
|
* The adjustment of the region dimensions may be optionally disabled.
|
||||||
|
*
|
||||||
|
* We also provide a lossless-resize option, which is kind of a lossless-crop
|
||||||
|
* operation in the DCT coefficient block domain - it discards higher-order
|
||||||
|
* coefficients and losslessly preserves lower-order coefficients of a
|
||||||
|
* sub-block.
|
||||||
|
*
|
||||||
|
* Rotate/flip transform, resize, and crop can be requested together in a
|
||||||
|
* single invocation. The crop is applied last --- that is, the crop region
|
||||||
|
* is specified in terms of the destination image after transform/resize.
|
||||||
|
*
|
||||||
|
* We also offer a "force to grayscale" option, which simply discards the
|
||||||
|
* chrominance channels of a YCbCr image. This is lossless in the sense that
|
||||||
|
* the luminance channel is preserved exactly. It's not the same kind of
|
||||||
|
* thing as the rotate/flip transformations, but it's convenient to handle it
|
||||||
|
* as part of this package, mainly because the transformation routines have to
|
||||||
|
* be aware of the option to know how many components to work on.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Short forms of external names for systems with brain-damaged linkers. */
|
||||||
|
|
||||||
|
#ifdef NEED_SHORT_EXTERNAL_NAMES
|
||||||
|
#define jtransform_parse_crop_spec jTrParCrop
|
||||||
|
#define jtransform_request_workspace jTrRequest
|
||||||
|
#define jtransform_adjust_parameters jTrAdjust
|
||||||
|
#define jtransform_execute_transform jTrExec
|
||||||
|
#define jtransform_perfect_transform jTrPerfect
|
||||||
|
#define jcopy_markers_setup jCMrkSetup
|
||||||
|
#define jcopy_markers_execute jCMrkExec
|
||||||
|
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Codes for supported types of image transformations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
JXFORM_NONE, /* no transformation */
|
||||||
|
JXFORM_FLIP_H, /* horizontal flip */
|
||||||
|
JXFORM_FLIP_V, /* vertical flip */
|
||||||
|
JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */
|
||||||
|
JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */
|
||||||
|
JXFORM_ROT_90, /* 90-degree clockwise rotation */
|
||||||
|
JXFORM_ROT_180, /* 180-degree rotation */
|
||||||
|
JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */
|
||||||
|
} JXFORM_CODE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Codes for crop parameters, which can individually be unspecified,
|
||||||
|
* positive or negative for xoffset or yoffset,
|
||||||
|
* positive or forced for width or height.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
JCROP_UNSET,
|
||||||
|
JCROP_POS,
|
||||||
|
JCROP_NEG,
|
||||||
|
JCROP_FORCE
|
||||||
|
} JCROP_CODE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Transform parameters struct.
|
||||||
|
* NB: application must not change any elements of this struct after
|
||||||
|
* calling jtransform_request_workspace.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* Options: set by caller */
|
||||||
|
JXFORM_CODE transform; /* image transform operator */
|
||||||
|
boolean perfect; /* if TRUE, fail if partial MCUs are requested */
|
||||||
|
boolean trim; /* if TRUE, trim partial MCUs as needed */
|
||||||
|
boolean force_grayscale; /* if TRUE, convert color image to grayscale */
|
||||||
|
boolean crop; /* if TRUE, crop source image */
|
||||||
|
|
||||||
|
/* Crop parameters: application need not set these unless crop is TRUE.
|
||||||
|
* These can be filled in by jtransform_parse_crop_spec().
|
||||||
|
*/
|
||||||
|
JDIMENSION crop_width; /* Width of selected region */
|
||||||
|
JCROP_CODE crop_width_set; /* (forced disables adjustment) */
|
||||||
|
JDIMENSION crop_height; /* Height of selected region */
|
||||||
|
JCROP_CODE crop_height_set; /* (forced disables adjustment) */
|
||||||
|
JDIMENSION crop_xoffset; /* X offset of selected region */
|
||||||
|
JCROP_CODE crop_xoffset_set; /* (negative measures from right edge) */
|
||||||
|
JDIMENSION crop_yoffset; /* Y offset of selected region */
|
||||||
|
JCROP_CODE crop_yoffset_set; /* (negative measures from bottom edge) */
|
||||||
|
|
||||||
|
/* Internal workspace: caller should not touch these */
|
||||||
|
int num_components; /* # of components in workspace */
|
||||||
|
jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */
|
||||||
|
JDIMENSION output_width; /* cropped destination dimensions */
|
||||||
|
JDIMENSION output_height;
|
||||||
|
JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */
|
||||||
|
JDIMENSION y_crop_offset;
|
||||||
|
int iMCU_sample_width; /* destination iMCU size */
|
||||||
|
int iMCU_sample_height;
|
||||||
|
} jpeg_transform_info;
|
||||||
|
|
||||||
|
|
||||||
|
#if TRANSFORMS_SUPPORTED
|
||||||
|
|
||||||
|
/* Parse a crop specification (written in X11 geometry style) */
|
||||||
|
EXTERN(boolean) jtransform_parse_crop_spec
|
||||||
|
JPP((jpeg_transform_info *info, const char *spec));
|
||||||
|
/* Request any required workspace */
|
||||||
|
EXTERN(boolean) jtransform_request_workspace
|
||||||
|
JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info));
|
||||||
|
/* Adjust output image parameters */
|
||||||
|
EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters
|
||||||
|
JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
|
||||||
|
jvirt_barray_ptr *src_coef_arrays,
|
||||||
|
jpeg_transform_info *info));
|
||||||
|
/* Execute the actual transformation, if any */
|
||||||
|
EXTERN(void) jtransform_execute_transform
|
||||||
|
JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
|
||||||
|
jvirt_barray_ptr *src_coef_arrays,
|
||||||
|
jpeg_transform_info *info));
|
||||||
|
/* Determine whether lossless transformation is perfectly
|
||||||
|
* possible for a specified image and transformation.
|
||||||
|
*/
|
||||||
|
EXTERN(boolean) jtransform_perfect_transform
|
||||||
|
JPP((JDIMENSION image_width, JDIMENSION image_height,
|
||||||
|
int MCU_width, int MCU_height,
|
||||||
|
JXFORM_CODE transform));
|
||||||
|
|
||||||
|
/* jtransform_execute_transform used to be called
|
||||||
|
* jtransform_execute_transformation, but some compilers complain about
|
||||||
|
* routine names that long. This macro is here to avoid breaking any
|
||||||
|
* old source code that uses the original name...
|
||||||
|
*/
|
||||||
|
#define jtransform_execute_transformation jtransform_execute_transform
|
||||||
|
|
||||||
|
#endif /* TRANSFORMS_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Support for copying optional markers from source to destination file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
JCOPYOPT_NONE, /* copy no optional markers */
|
||||||
|
JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */
|
||||||
|
JCOPYOPT_ALL /* copy all optional markers */
|
||||||
|
} JCOPY_OPTION;
|
||||||
|
|
||||||
|
#define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */
|
||||||
|
|
||||||
|
/* Setup decompression object to save desired markers in memory */
|
||||||
|
EXTERN(void) jcopy_markers_setup
|
||||||
|
JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option));
|
||||||
|
/* Copy markers saved in the given source object to the destination object */
|
||||||
|
EXTERN(void) jcopy_markers_execute
|
||||||
|
JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
|
||||||
|
JCOPY_OPTION option));
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,224 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file common/AbstractPartition.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::AbstractPartition class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_ABSTRACTPARTITION_HPP
|
||||||
|
#define TOUCHGFX_ABSTRACTPARTITION_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This type defines an abstract interface to a storage partition for allocating memory slots of
|
||||||
|
* equal size. The "partition" is not aware of the actual types stored in the partition
|
||||||
|
* memory, hence it provides no mechanism for deleting C++ objects when clear()'ed.
|
||||||
|
*/
|
||||||
|
class AbstractPartition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Finalizes an instance of the AbstractPartition class. */
|
||||||
|
virtual ~AbstractPartition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the address of the next available storage slot. The slot size is compared with
|
||||||
|
* the specified size.
|
||||||
|
*
|
||||||
|
* @param size The size.
|
||||||
|
*
|
||||||
|
* @return The address of an empty storage slot which contains minimum 'size' bytes.
|
||||||
|
*
|
||||||
|
* @note Asserts if 'size' is too large, or the storage is depleted.
|
||||||
|
*/
|
||||||
|
virtual void* allocate(uint16_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the address of the specified index.
|
||||||
|
*
|
||||||
|
* @param index Zero-based index of the.
|
||||||
|
* @param size The size.
|
||||||
|
*
|
||||||
|
* @return The address of the appropriate storage slot which contains minimum 'size'
|
||||||
|
* bytes.
|
||||||
|
*
|
||||||
|
* @note Asserts if 'size' is too large.
|
||||||
|
*/
|
||||||
|
virtual void* allocateAt(uint16_t index, uint16_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets allocation count.
|
||||||
|
*
|
||||||
|
* @return The currently allocated storage slots.
|
||||||
|
*/
|
||||||
|
virtual uint16_t getAllocationCount() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines index of previously allocated location. Since the Partition concept is
|
||||||
|
* loosely typed this method shall be used with care. The method does not guarantee that
|
||||||
|
* the found object at the returned index is a valid object. It only tests whether or
|
||||||
|
* not the object is within the bounds of the current partition allocations.
|
||||||
|
*
|
||||||
|
* @param address The location address to lookup.
|
||||||
|
*
|
||||||
|
* @return An uint16_t.
|
||||||
|
*/
|
||||||
|
virtual uint16_t indexOf(const void* address);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the Partition for new allocations. Any objects present in the Partition
|
||||||
|
* shall not be used after invoking this method.
|
||||||
|
*/
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the capacity, i.e. the maximum allocation count.
|
||||||
|
*
|
||||||
|
* @return The maximum allocation count.
|
||||||
|
*/
|
||||||
|
virtual uint16_t capacity() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the address of the next available storage slot. The slot size is determined from
|
||||||
|
* the size of type T.
|
||||||
|
*
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
*
|
||||||
|
* @return The address of an empty storage slot.
|
||||||
|
*
|
||||||
|
* @note Asserts if T is too large, or the storage is depleted.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
void* allocate()
|
||||||
|
{
|
||||||
|
return allocate(static_cast<uint16_t>(sizeof(T)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the address of the specified storage slot. The slot size is determined from the
|
||||||
|
* size of type T.
|
||||||
|
*
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
* @param index Zero-based index of the.
|
||||||
|
*
|
||||||
|
* @return The address of the appropriate storage slot.
|
||||||
|
*
|
||||||
|
* @note Asserts if T is too large.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
void* allocateAt(uint16_t index)
|
||||||
|
{
|
||||||
|
return allocateAt(index, static_cast<uint16_t>(sizeof(T)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the object at the specified index.
|
||||||
|
*
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
* @param index The index into the Partition storage where the returned object is located.
|
||||||
|
*
|
||||||
|
* @return A typed reference to the object at the specified index.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
T& at(const uint16_t index)
|
||||||
|
{
|
||||||
|
return *static_cast<T*>(element(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* const version of at().
|
||||||
|
*
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
* @param index Zero-based index of the.
|
||||||
|
*
|
||||||
|
* @return A T&
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
const T& at(const uint16_t index) const
|
||||||
|
{
|
||||||
|
return *static_cast<const T*>(element(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the specified object could have been previously allocated in the
|
||||||
|
* partition. Since the Partition concept is loosely typed this method shall be used
|
||||||
|
* with care. The method does not guarantee that the found object at the returned index
|
||||||
|
* is a valid object. It only tests whether or not the object is within the bounds of
|
||||||
|
* the current partition allocations.
|
||||||
|
*
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
* @param pT Pointer to the object to look up.
|
||||||
|
*
|
||||||
|
* @return If the object seems to be allocated in the Partition, a Pair object
|
||||||
|
* containing a typed pointer to the object and an index into the Partition
|
||||||
|
* storage is returned. Otherwise, a Pair<0, 0> is returned.
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
Pair<T*, uint16_t> find(const void* pT)
|
||||||
|
{
|
||||||
|
uint16_t index = indexOf(pT);
|
||||||
|
if (0 < getAllocationCount() && index < getAllocationCount())
|
||||||
|
{
|
||||||
|
return Pair<T*, uint16_t>(&at<T>(index), index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Pair<T*, uint16_t>(0, (uint16_t)-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Decreases number of allocations. */
|
||||||
|
void dec()
|
||||||
|
{
|
||||||
|
if (allocations)
|
||||||
|
{
|
||||||
|
allocations--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access to concrete element-size. Used internally.
|
||||||
|
*
|
||||||
|
* @return An uint32_t.
|
||||||
|
*/
|
||||||
|
virtual uint32_t element_size() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Access to stored element. Used internally.
|
||||||
|
*
|
||||||
|
* @param index Zero-based index of the.
|
||||||
|
*
|
||||||
|
* @return null if it fails, else a void*.
|
||||||
|
*/
|
||||||
|
virtual void* element(uint16_t index) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access to stored element, const version.
|
||||||
|
*
|
||||||
|
* @param index Zero-based index of the.
|
||||||
|
*
|
||||||
|
* @return null if it fails, else a void*.
|
||||||
|
*/
|
||||||
|
virtual const void* element(uint16_t index) const = 0;
|
||||||
|
|
||||||
|
/** Initializes a new instance of the AbstractPartition class. */
|
||||||
|
AbstractPartition();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t allocations;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_ABSTRACTPARTITION_HPP
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file common/Meta.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::meta namespace.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_META_HPP
|
||||||
|
#define TOUCHGFX_META_HPP
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Template meta-programming tools are grouped in this namespace
|
||||||
|
*/
|
||||||
|
namespace meta
|
||||||
|
{
|
||||||
|
/** Nil-type, indicates the end of a TypeList. */
|
||||||
|
struct Nil
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TypeList, used for generating compile-time lists of types.
|
||||||
|
*
|
||||||
|
* @tparam First Type of the first.
|
||||||
|
* @tparam Next Type of the next.
|
||||||
|
*/
|
||||||
|
template <typename First, typename Next>
|
||||||
|
struct TypeList
|
||||||
|
{
|
||||||
|
typedef First first; ///< The first element in the TypeList
|
||||||
|
typedef Next next; ///< Remainder of the TypeList
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta-function, selects the "maximum" type, i.e. the largest type.
|
||||||
|
*
|
||||||
|
* @tparam T1 Generic type parameter.
|
||||||
|
* @tparam T2 Generic type parameter.
|
||||||
|
* @tparam choose1 True if sizeof(T1) is larger than sizeof(T2).
|
||||||
|
* @param parameter1 The first parameter.
|
||||||
|
*/
|
||||||
|
template <typename T1, typename T2, bool choose1 = (sizeof(T1) > sizeof(T2))>
|
||||||
|
struct type_max
|
||||||
|
{
|
||||||
|
typedef T1 type; ///< The resulting type (default case: sizeof(T1)>sizeof(T2))
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialization for the case where sizeof(T2) >= sizeof(T1).
|
||||||
|
*
|
||||||
|
* @tparam T1 Generic type parameter.
|
||||||
|
* @tparam T2 Generic type parameter.
|
||||||
|
*/
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
struct type_max<T1, T2, false>
|
||||||
|
{
|
||||||
|
typedef T2 type; ///< The resulting type (default case: sizeof(T2)>=sizeof(T1))
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta-function signature, selects maximum type from TypeList.
|
||||||
|
*
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
struct select_type_maxsize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialization to dive into the list (inherits result from type_max).
|
||||||
|
*
|
||||||
|
* @tparam First Type of the first.
|
||||||
|
* @tparam Next Type of the next.
|
||||||
|
*/
|
||||||
|
template <typename First, typename Next>
|
||||||
|
struct select_type_maxsize<TypeList<First, Next> > : public type_max<First, typename select_type_maxsize<Next>::type>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialization for loop termination (when type Nil encountered).
|
||||||
|
*
|
||||||
|
* @tparam First Type of the first.
|
||||||
|
*/
|
||||||
|
template <typename First>
|
||||||
|
struct select_type_maxsize<TypeList<First, Nil> >
|
||||||
|
{
|
||||||
|
typedef First type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meta-function signature, joins typelist with type (or another typelist).
|
||||||
|
*
|
||||||
|
* @tparam TList Type of the list.
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
*/
|
||||||
|
template <typename TList, typename T>
|
||||||
|
struct list_join;
|
||||||
|
|
||||||
|
/** Specialization for termination. */
|
||||||
|
template <>
|
||||||
|
struct list_join<Nil, Nil>
|
||||||
|
{
|
||||||
|
typedef Nil result;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialization for "end-of-LHS", with RHS as type.
|
||||||
|
*
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
struct list_join<Nil, T>
|
||||||
|
{
|
||||||
|
typedef TypeList<T, Nil> result;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialization for "end-of-LHS", with RHS as a TypeList.
|
||||||
|
*
|
||||||
|
* @tparam First Type of the first.
|
||||||
|
* @tparam Next Type of the next.
|
||||||
|
*/
|
||||||
|
template <typename First, typename Next>
|
||||||
|
struct list_join<Nil, TypeList<First, Next> >
|
||||||
|
{
|
||||||
|
typedef TypeList<First, Next> result;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively joins a typelist (LHS) with a type or a type-list (RHS).
|
||||||
|
*
|
||||||
|
* @tparam First Type of the first.
|
||||||
|
* @tparam Next Type of the next.
|
||||||
|
* @tparam T Generic type parameter.
|
||||||
|
*/
|
||||||
|
template <typename First, typename Next, typename T>
|
||||||
|
struct list_join<TypeList<First, Next>, T>
|
||||||
|
{
|
||||||
|
typedef TypeList<First, typename list_join<Next, T>::result> result;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace meta
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_META_HPP
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file common/Partition.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::Partition class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_PARTITION_HPP
|
||||||
|
#define TOUCHGFX_PARTITION_HPP
|
||||||
|
|
||||||
|
#include <common/AbstractPartition.hpp>
|
||||||
|
#include <common/Meta.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This type provides a concrete Partition of memory-slots capable of holding any of the
|
||||||
|
* specified list of types.
|
||||||
|
*
|
||||||
|
* The Partition is not aware of the types stored in the Partition memory, hence it
|
||||||
|
* provides no mechanism for deleting C++ objects when the Partition is clear()'ed.
|
||||||
|
*
|
||||||
|
* This class implements AbstractPartition.
|
||||||
|
*
|
||||||
|
* @tparam ListOfTypes Type of the list of types.
|
||||||
|
* @tparam NUMBER_OF_ELEMENTS Type of the number of elements.
|
||||||
|
*
|
||||||
|
* @see AbstractPartition
|
||||||
|
*/
|
||||||
|
template <typename ListOfTypes, uint16_t NUMBER_OF_ELEMENTS>
|
||||||
|
class Partition : public AbstractPartition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Provides a generic public type containing the list of supported types. */
|
||||||
|
typedef ListOfTypes SupportedTypesList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile-time generated constants specifying the "element" or "slot" size used by this
|
||||||
|
* partition.
|
||||||
|
*/
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
INTS_PR_ELEMENT = (sizeof(typename meta::select_type_maxsize<SupportedTypesList>::type) + sizeof(int) - 1) / sizeof(int),
|
||||||
|
SIZE_OF_ELEMENT = INTS_PR_ELEMENT * sizeof(int)
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual uint16_t capacity() const
|
||||||
|
{
|
||||||
|
return NUMBER_OF_ELEMENTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint32_t element_size()
|
||||||
|
{
|
||||||
|
return sizeof(stBlocks[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void* element(uint16_t index)
|
||||||
|
{
|
||||||
|
return &stBlocks[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const void* element(uint16_t index) const
|
||||||
|
{
|
||||||
|
return &stBlocks[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** Internal type used for storage, in order to ensure "natural" alignment of elements. */
|
||||||
|
struct Block
|
||||||
|
{
|
||||||
|
int filler[INTS_PR_ELEMENT];
|
||||||
|
};
|
||||||
|
|
||||||
|
Block stBlocks[NUMBER_OF_ELEMENTS]; ///< Actual memory storage
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_PARTITION_HPP
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file common/TouchGFXInit.hpp
|
||||||
|
*
|
||||||
|
* Declares the touch graphics generic initialization function.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_TOUCHGFXINIT_HPP
|
||||||
|
#define TOUCHGFX_TOUCHGFXINIT_HPP
|
||||||
|
|
||||||
|
#include <platform/driver/touch/TouchController.hpp>
|
||||||
|
#include <touchgfx/Application.hpp>
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/Texts.hpp>
|
||||||
|
#include <touchgfx/TypedText.hpp>
|
||||||
|
#include <touchgfx/hal/DMA.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <BitmapDatabase.hpp>
|
||||||
|
#include <fonts/ApplicationFontProvider.hpp>
|
||||||
|
#include <texts/TypedTextDatabase.hpp>
|
||||||
|
#include <gui/common/FrontendHeap.hpp>
|
||||||
|
|
||||||
|
static ApplicationFontProvider fontProvider; ///< The font provider
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The global touchgfx namespace. All TouchGFX framework classes and global functions are placed in this namespace.
|
||||||
|
*/
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
static Texts texts; ///< The texts
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
HAL& getHAL(DMA_Interface& dma, LCD& display, TouchController& tc, int16_t width, int16_t height)
|
||||||
|
{
|
||||||
|
static T hal(dma, display, tc, width, height);
|
||||||
|
return hal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @globalfn
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TouchGFX generic initialize.
|
||||||
|
*
|
||||||
|
* @tparam HALType The class type of the HAL subclass used for this port.
|
||||||
|
* @param [in] dma Reference to the DMA implementation object to use. Can be of
|
||||||
|
* type NoDMA to disable the use of DMA for rendering.
|
||||||
|
* @param [in] display Reference to the LCD renderer implementation (subclass of
|
||||||
|
* LCD). Could be either LCD16bpp for RGB565 UIs, or
|
||||||
|
* LCD1bpp for monochrome UIs or LCD24bpp for 24bit
|
||||||
|
* displays using RGB888 UIs.
|
||||||
|
* @param [in] tc Reference to the touch controller driver (or
|
||||||
|
* NoTouchController to disable touch input).
|
||||||
|
* @param width The \a native display width of the actual display, in pixels.
|
||||||
|
* This value is irrespective of whether the concrete UI
|
||||||
|
* should be portrait or landscape mode. It must match
|
||||||
|
* what the display itself is configured as.
|
||||||
|
* @param height The \a native display height of the actual display, in
|
||||||
|
* pixels. This value is irrespective of whether the
|
||||||
|
* concrete UI should be portrait or landscape mode. It
|
||||||
|
* must match what the display itself is configured as.
|
||||||
|
* @param [in] bitmapCache Optional pointer to starting address of a memory region in
|
||||||
|
* which to place the bitmap cache. Usually in external
|
||||||
|
* RAM. Pass 0 if bitmap caching is not used.
|
||||||
|
* @param bitmapCacheSize Size of bitmap cache in bytes. Pass 0 if bitmap cache is not
|
||||||
|
* used.
|
||||||
|
* @param numberOfDynamicBitmaps (Optional) Number of dynamic bitmaps.
|
||||||
|
*
|
||||||
|
* @return A reference to the allocated (and initialized) HAL object.
|
||||||
|
*/
|
||||||
|
template <class HALType>
|
||||||
|
HAL& touchgfx_generic_init(DMA_Interface& dma, LCD& display, TouchController& tc, int16_t width, int16_t height,
|
||||||
|
uint16_t* bitmapCache, uint32_t bitmapCacheSize, uint32_t numberOfDynamicBitmaps = 0)
|
||||||
|
{
|
||||||
|
HAL& hal = getHAL<HALType>(dma, display, tc, width, height);
|
||||||
|
hal.initialize();
|
||||||
|
|
||||||
|
Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(),
|
||||||
|
BitmapDatabase::getInstanceSize(),
|
||||||
|
bitmapCache,
|
||||||
|
bitmapCacheSize,
|
||||||
|
numberOfDynamicBitmaps);
|
||||||
|
|
||||||
|
TypedText::registerTexts(&texts);
|
||||||
|
Texts::setLanguage(0);
|
||||||
|
|
||||||
|
FontManager::setFontProvider(&fontProvider);
|
||||||
|
|
||||||
|
FrontendHeap::getInstance(); // We need to initialize the frontend heap.
|
||||||
|
|
||||||
|
hal.registerEventListener(*(Application::getInstance()));
|
||||||
|
|
||||||
|
return hal;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_TOUCHGFXINIT_HPP
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file mvp/MVPApplication.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::MVPApplication class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_MVPAPPLICATION_HPP
|
||||||
|
#define TOUCHGFX_MVPAPPLICATION_HPP
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
#include <common/AbstractPartition.hpp>
|
||||||
|
#include <mvp/MVPHeap.hpp>
|
||||||
|
#include <mvp/Presenter.hpp>
|
||||||
|
#include <touchgfx/Application.hpp>
|
||||||
|
#include <touchgfx/Callback.hpp>
|
||||||
|
#include <touchgfx/Screen.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/transitions/Transition.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
class Presenter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A specialization of the TouchGFX Application class that provides the necessary glue for
|
||||||
|
* transitioning between presenter/view pairs.
|
||||||
|
*
|
||||||
|
* It maintains a callback for transitioning and evaluates this at each tick.
|
||||||
|
*
|
||||||
|
* @see Application
|
||||||
|
*/
|
||||||
|
class MVPApplication : public Application
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Initializes a new instance of the MVPApplication class. */
|
||||||
|
MVPApplication()
|
||||||
|
: currentPresenter(0),
|
||||||
|
pendingScreenTransitionCallback(0)
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the pending screen transition.
|
||||||
|
*
|
||||||
|
* Delegates the work to evaluatePendingScreenTransition()
|
||||||
|
*/
|
||||||
|
virtual void handlePendingScreenTransition()
|
||||||
|
{
|
||||||
|
evaluatePendingScreenTransition();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Presenter* currentPresenter; ///< Pointer to the currently active presenter.
|
||||||
|
|
||||||
|
GenericCallback<>* pendingScreenTransitionCallback; ///< Callback for screen transitions. Will be set to something valid when a transition request is made.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates the pending Callback instances. If a callback is valid, it is executed and
|
||||||
|
* a Screen transition is executed.
|
||||||
|
*/
|
||||||
|
void evaluatePendingScreenTransition()
|
||||||
|
{
|
||||||
|
if (pendingScreenTransitionCallback && pendingScreenTransitionCallback->isValid())
|
||||||
|
{
|
||||||
|
pendingScreenTransitionCallback->execute();
|
||||||
|
pendingScreenTransitionCallback = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare screen transition. Private helper function for makeTransition. Do not use.
|
||||||
|
*
|
||||||
|
* @param [in] currentScreen If non-null, the current screen.
|
||||||
|
* @param [in] currentPresenter If non-null, the current presenter.
|
||||||
|
* @param [in] currentTrans If non-null, the current transaction.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static void prepareTransition(Screen** currentScreen, Presenter** currentPresenter, Transition** currentTrans)
|
||||||
|
{
|
||||||
|
Application::getInstance()->clearAllTimerWidgets();
|
||||||
|
|
||||||
|
if (*currentTrans)
|
||||||
|
{
|
||||||
|
(*currentTrans)->tearDown();
|
||||||
|
}
|
||||||
|
if (*currentTrans)
|
||||||
|
{
|
||||||
|
(*currentTrans)->~Transition();
|
||||||
|
}
|
||||||
|
if (*currentScreen)
|
||||||
|
{
|
||||||
|
(*currentScreen)->tearDownScreen();
|
||||||
|
}
|
||||||
|
if (*currentPresenter)
|
||||||
|
{
|
||||||
|
(*currentPresenter)->deactivate();
|
||||||
|
}
|
||||||
|
if (*currentScreen)
|
||||||
|
{
|
||||||
|
(*currentScreen)->~Screen();
|
||||||
|
}
|
||||||
|
if (*currentPresenter)
|
||||||
|
{
|
||||||
|
(*currentPresenter)->~Presenter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalize screen transition. Private helper function for makeTransition. Do not use.
|
||||||
|
*
|
||||||
|
* @param [in] newScreen If non-null, the new screen.
|
||||||
|
* @param [in] newPresenter If non-null, the new presenter.
|
||||||
|
* @param [in] newTransition If non-null, the new transition.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static void finalizeTransition(Screen* newScreen, Presenter* newPresenter, Transition* newTransition)
|
||||||
|
{
|
||||||
|
newScreen->setupScreen();
|
||||||
|
newPresenter->activate();
|
||||||
|
newScreen->bindTransition(*newTransition);
|
||||||
|
newTransition->init();
|
||||||
|
newTransition->invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for effectuating a screen transition (i.e. makes the requested new presenter/view
|
||||||
|
* pair active). Once this function has returned, the new screen has been transitioned
|
||||||
|
* to. Due to the memory allocation strategy of using the same memory area for all
|
||||||
|
* screens, the old view/presenter will no longer exist when this function returns.
|
||||||
|
*
|
||||||
|
* Will properly clean up old screen (tearDownScreen, Presenter::deactivate) and call
|
||||||
|
* setupScreen/activate on new view/presenter pair. Will also make sure the view,
|
||||||
|
* presenter and model are correctly bound to each other.
|
||||||
|
*
|
||||||
|
* @tparam ScreenType Class type for the View.
|
||||||
|
* @tparam PresenterType Class type for the Presenter.
|
||||||
|
* @tparam TransType Class type for the Transition.
|
||||||
|
* @tparam ModelType Class type for the Model.
|
||||||
|
* @param [in] currentScreen Pointer to pointer to the current view.
|
||||||
|
* @param [in] currentPresenter Pointer to pointer to the current presenter.
|
||||||
|
* @param [in] heap Reference to the heap containing the memory storage in which
|
||||||
|
* to allocate.
|
||||||
|
* @param [in] currentTrans Pointer to pointer to the current transition.
|
||||||
|
* @param [in] model Pointer to model.
|
||||||
|
*
|
||||||
|
* @return Pointer to the new Presenter of the requested type. Incidentally it will be the same
|
||||||
|
* value as the old presenter due to memory reuse.
|
||||||
|
*/
|
||||||
|
template <class ScreenType, class PresenterType, class TransType, class ModelType>
|
||||||
|
PresenterType* makeTransition(Screen** currentScreen, Presenter** currentPresenter, MVPHeap& heap, Transition** currentTrans, ModelType* model)
|
||||||
|
{
|
||||||
|
assert(sizeof(ScreenType) <= heap.screenStorage.element_size() && "View allocation error: Check that all views are added to FrontendHeap::ViewTypes");
|
||||||
|
assert(sizeof(PresenterType) <= heap.presenterStorage.element_size() && "Presenter allocation error: Check that all presenters are added to FrontendHeap::PresenterTypes");
|
||||||
|
assert(sizeof(TransType) <= heap.transitionStorage.element_size() && "Transition allocation error: Check that all transitions are added to FrontendHeap::TransitionTypes");
|
||||||
|
|
||||||
|
prepareTransition(currentScreen, currentPresenter, currentTrans);
|
||||||
|
|
||||||
|
TransType* newTransition = new (&heap.transitionStorage.at<TransType>(0)) TransType;
|
||||||
|
ScreenType* newScreen = new (&heap.screenStorage.at<ScreenType>(0)) ScreenType;
|
||||||
|
PresenterType* newPresenter = new (&heap.presenterStorage.at<PresenterType>(0)) PresenterType(*newScreen);
|
||||||
|
*currentTrans = newTransition;
|
||||||
|
*currentPresenter = newPresenter;
|
||||||
|
*currentScreen = newScreen;
|
||||||
|
model->bind(newPresenter);
|
||||||
|
newPresenter->bind(model);
|
||||||
|
newScreen->bind(*newPresenter);
|
||||||
|
|
||||||
|
finalizeTransition((Screen*)newScreen, (Presenter*)newPresenter, (Transition*)newTransition);
|
||||||
|
|
||||||
|
return newPresenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_MVPAPPLICATION_HPP
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file mvp/MVPHeap.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::MVPHeap class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_MVPHEAP_HPP
|
||||||
|
#define TOUCHGFX_MVPHEAP_HPP
|
||||||
|
|
||||||
|
#include "common/AbstractPartition.hpp"
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
class AbstractPartition;
|
||||||
|
class MVPApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic heap class for MVP applications. Serves as a way of obtaining the memory storage
|
||||||
|
* areas for presenters, screens, transitions and the concrete application.
|
||||||
|
*
|
||||||
|
* Subclassed by an application-specific heap which provides the actual storage areas.
|
||||||
|
* This generic interface is used only in makeTransition.
|
||||||
|
*/
|
||||||
|
class MVPHeap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Initializes a new instance of the MVPHeap class.
|
||||||
|
*
|
||||||
|
* @param [in] pres A memory partition containing enough memory to hold the largest
|
||||||
|
* presenter.
|
||||||
|
* @param [in] scr A memory partition containing enough memory to hold the largest view.
|
||||||
|
* @param [in] tra A memory partition containing enough memory to hold the largest
|
||||||
|
* transition.
|
||||||
|
* @param [in] app A reference to the MVPApplication instance.
|
||||||
|
*/
|
||||||
|
MVPHeap(AbstractPartition& pres,
|
||||||
|
AbstractPartition& scr,
|
||||||
|
AbstractPartition& tra,
|
||||||
|
MVPApplication& app)
|
||||||
|
: presenterStorage(pres),
|
||||||
|
screenStorage(scr),
|
||||||
|
transitionStorage(tra),
|
||||||
|
frontendApplication(app)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Finalizes an instance of the MVPHeap class. */
|
||||||
|
virtual ~MVPHeap()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractPartition& presenterStorage; ///< A memory partition containing enough memory to hold the largest presenter.
|
||||||
|
AbstractPartition& screenStorage; ///< A memory partition containing enough memory to hold the largest view.
|
||||||
|
AbstractPartition& transitionStorage; ///< A memory partition containing enough memory to hold the largest transition.
|
||||||
|
MVPApplication& frontendApplication; ///< A reference to the MVPApplication instance.
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_MVPHEAP_HPP
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file mvp/Presenter.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::Presenter class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_PRESENTER_HPP
|
||||||
|
#define TOUCHGFX_PRESENTER_HPP
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Presenter base class that all application-specific presenters should derive from. Only
|
||||||
|
* contains activate and deactivate virtual functions which are called automatically
|
||||||
|
* during screen transition.
|
||||||
|
*/
|
||||||
|
class Presenter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Place initialization code for the Presenter here.
|
||||||
|
*
|
||||||
|
* The activate function is called automatically when a screen transition causes this
|
||||||
|
* Presenter to become active. Place initialization code for the Presenter here.
|
||||||
|
*/
|
||||||
|
virtual void activate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place cleanup code for the Presenter here.
|
||||||
|
*
|
||||||
|
* The deactivate function is called automatically when a screen transition causes this
|
||||||
|
* Presenter to become inactive. Place cleanup code for the Presenter here.
|
||||||
|
*/
|
||||||
|
virtual void deactivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Finalizes an instance of the Presenter class. */
|
||||||
|
virtual ~Presenter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** Initializes a new instance of the Presenter class. */
|
||||||
|
Presenter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_PRESENTER_HPP
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file mvp/View.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::View class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_VIEW_HPP
|
||||||
|
#define TOUCHGFX_VIEW_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Screen.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This is a generic touchgfx::Screen specialization for normal applications. It provides a link
|
||||||
|
* to the Presenter class.
|
||||||
|
*
|
||||||
|
* @tparam T The type of Presenter associated with this view.
|
||||||
|
*
|
||||||
|
* @see Screen
|
||||||
|
*
|
||||||
|
* @note All views in the application must be a subclass of this type.
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
class View : public Screen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
View()
|
||||||
|
: presenter(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binds an instance of a specific Presenter type (subclass) to the View instance. This function
|
||||||
|
* is called automatically when a new presenter/view pair is activated.
|
||||||
|
*
|
||||||
|
* @param [in] newPresenter The specific Presenter to be associated with the View.
|
||||||
|
*/
|
||||||
|
void bind(T& newPresenter)
|
||||||
|
{
|
||||||
|
presenter = &newPresenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
T* presenter; ///< Pointer to the Presenter associated with this view.
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_VIEW_HPP
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/core/MCUInstrumentation.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::MCUInstrumentation interface class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_MCUINSTRUMENTATION_HPP
|
||||||
|
#define TOUCHGFX_MCUINSTRUMENTATION_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/** Interface for instrumenting processors to measure MCU load via measured CPU cycles. */
|
||||||
|
class MCUInstrumentation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Initializes a new instance of the MCUInstrumentation class. */
|
||||||
|
MCUInstrumentation()
|
||||||
|
: cc_consumed(0),
|
||||||
|
cc_in(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initialize. */
|
||||||
|
virtual void init() = 0;
|
||||||
|
|
||||||
|
/** Finalizes an instance of the MCUInstrumentation class. */
|
||||||
|
virtual ~MCUInstrumentation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets elapsed microseconds based on clock frequency.
|
||||||
|
*
|
||||||
|
* @param start Start time.
|
||||||
|
* @param now Current time.
|
||||||
|
* @param clockfrequency Clock frequency of the system expressed in MHz.
|
||||||
|
*
|
||||||
|
* @return Elapsed microseconds start and now.
|
||||||
|
*/
|
||||||
|
virtual unsigned int getElapsedUS(unsigned int start, unsigned int now, unsigned int clockfrequency) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets CPU cycles from register.
|
||||||
|
*
|
||||||
|
* @return CPU cycles.
|
||||||
|
*/
|
||||||
|
virtual unsigned int getCPUCycles(void) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets MCU activity high.
|
||||||
|
*
|
||||||
|
* @param active if True, inactive otherwise.
|
||||||
|
*/
|
||||||
|
virtual void setMCUActive(bool active)
|
||||||
|
{
|
||||||
|
if (active) // Idle task sched out
|
||||||
|
{
|
||||||
|
uint32_t cc_temp = getCPUCycles() - cc_in;
|
||||||
|
cc_consumed = cc_consumed + cc_temp;
|
||||||
|
}
|
||||||
|
else // Idle task sched in
|
||||||
|
{
|
||||||
|
cc_in = getCPUCycles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets number of consumed clock cycles.
|
||||||
|
*
|
||||||
|
* @return clock cycles.
|
||||||
|
*/
|
||||||
|
virtual uint32_t getCCConsumed()
|
||||||
|
{
|
||||||
|
return cc_consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets number of consumed clock cycles.
|
||||||
|
*
|
||||||
|
* @param val number of clock cycles.
|
||||||
|
*/
|
||||||
|
virtual void setCCConsumed(uint32_t val)
|
||||||
|
{
|
||||||
|
cc_consumed = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
volatile uint32_t cc_consumed; ///< Amount of consumed CPU cycles.
|
||||||
|
volatile uint32_t cc_in; ///< Current CPU cycles.
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_MCUINSTRUMENTATION_HPP
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/button/ButtonController.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::ButtonController interface class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_BUTTONCONTROLLER_HPP
|
||||||
|
#define TOUCHGFX_BUTTONCONTROLLER_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/** Interface for sampling external key events. */
|
||||||
|
class ButtonController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Finalizes an instance of the ButtonController class. */
|
||||||
|
virtual ~ButtonController()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes button controller. */
|
||||||
|
virtual void init() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sample external key events.
|
||||||
|
*
|
||||||
|
* @param [out] key Output parameter that will be set to the key value if a keypress was
|
||||||
|
* detected.
|
||||||
|
*
|
||||||
|
* @return True if a keypress was detected and the "key" parameter is set to a value.
|
||||||
|
*/
|
||||||
|
virtual bool sample(uint8_t& key) = 0;
|
||||||
|
|
||||||
|
/** Resets button controller. Does nothing in the default implementation. */
|
||||||
|
virtual void reset()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_BUTTONCONTROLLER_HPP
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/i2c/I2C.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchfgx::I2C interface class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_I2C_HPP
|
||||||
|
#define TOUCHGFX_I2C_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/** Platform independent interface for I2C drivers. */
|
||||||
|
class I2C
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Initializes a new instance of the I2C class. Stores the channel of the I2C bus to be
|
||||||
|
* configured.
|
||||||
|
*
|
||||||
|
* @param ch I2C channel.
|
||||||
|
*/
|
||||||
|
I2C(uint8_t ch)
|
||||||
|
: channel(ch)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Finalizes an instance of the I2C class. */
|
||||||
|
virtual ~I2C()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes the I2C driver. */
|
||||||
|
virtual void init() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the specified register on the device with the specified address.
|
||||||
|
*
|
||||||
|
* @param addr The I2C device address.
|
||||||
|
* @param reg The register.
|
||||||
|
* @param [out] data Pointer to buffer in which to place the result.
|
||||||
|
* @param cnt Size of buffer in bytes.
|
||||||
|
*
|
||||||
|
* @return true on success, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool readRegister(uint8_t addr, uint8_t reg, uint8_t* data, uint32_t cnt) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the specified value in a register.
|
||||||
|
*
|
||||||
|
* @param addr The I2C device address.
|
||||||
|
* @param reg The register.
|
||||||
|
* @param val The new value.
|
||||||
|
*
|
||||||
|
* @return true on success, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool writeRegister(uint8_t addr, uint8_t reg, uint8_t val) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
uint8_t channel; ///< I2c channel is stored in order to initialize and recover a specific I2C channel
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_I2C_HPP
|
||||||
@@ -0,0 +1,963 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD16bpp.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD16bpp class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD16BPP_HPP
|
||||||
|
#define TOUCHGFX_LCD16BPP_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD16DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
struct GlyphNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 16 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD16bpp : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD16bpp();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void drawScaledBitmap(const Bitmap& bitmap, const Rect& blitRect, const Rect& invalidatedArea, RenderingVariant renderVariant, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::RGB565;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return HAL::FRAME_BUFFER_WIDTH * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param red Value of the red part (0-255).
|
||||||
|
* @param green Value of the green part (0-255).
|
||||||
|
* @param blue Value of the blue part (0-255).
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
return ((red << 8) & 0xF800) | ((green << 3) & 0x07E0) | ((blue >> 3) & 0x001F);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return ((color >> 8) & 0xF800) | ((color >> 5) & 0x07E0) | ((color >> 3) & 0x001F);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB565 image format. This allows drawing L8_RGB565
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB565_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_RGB565_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB565();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB565 image format. This allows drawing L8_RGB565
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB565, enableTextureMapperL8_RGB565_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB565_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB565 image format. This allows drawing L8_RGB565
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB565, enableTextureMapperL8_RGB565_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB565_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_RGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888, enableTextureMapperL8_RGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888, enableTextureMapperL8_RGB888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_ARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888, enableTextureMapperL8_ARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888, enableTextureMapperL8_ARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGB565 image format. This allows drawing RGB565
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565_Opaque_BilinearInterpolation,
|
||||||
|
* enableTextureMapperRGB565_Opaque_NearestNeighbor,
|
||||||
|
* enableTextureMapperRGB565_NonOpaque_BilinearInterpolation,
|
||||||
|
* enableTextureMapperRGB565_NonOpaque_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for Opaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_Opaque_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for NonOpaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_NonOpaque_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for Opaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_Opaque_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for NonOpaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_NonOpaque_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
|
||||||
|
* This allows drawing L4, RLE and LZW9 compressed L8 images.
|
||||||
|
*
|
||||||
|
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_All();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the L4 algorithm.
|
||||||
|
* This allows drawing L4 compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_L4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the RLE algorithm.
|
||||||
|
* This allows drawing RLE compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_RLE();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
|
||||||
|
* This allows drawing LZW9 compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_LZW9();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for RGB images compressed with the QOI algorithm.
|
||||||
|
* This allows drawing compressed RGB images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorRGB();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified. If ARGB8888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32 bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyARGB8888(const uint32_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer never performing alpha-blending per pixel as
|
||||||
|
* because it is assumed that all pixels in the bitmap are solid (i.e. alpha for each pixel is
|
||||||
|
* 255).
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32 bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
*/
|
||||||
|
void blitCopyARGB8888Solid(const uint32_t* sourceData, const Rect& source, const Rect& blitRect) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer performing alpha-blending per pixel as specified.
|
||||||
|
* If RGB888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 24 bits RGB888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyRGB888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if indexed format is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if L8_ARGB8888 is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries stored as 32-
|
||||||
|
* bits (ARGB8888) format.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyL8_ARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if L8_RGB565 is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries stored as 16-
|
||||||
|
* bits (RGB565) format. If the source have per pixel alpha
|
||||||
|
* channel, then alpha channel data will be following the clut
|
||||||
|
* entries data.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyL8_RGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if L8_RGB888 is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries stored as 32-
|
||||||
|
* bits (ARGB8888) format.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyL8_RGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified. Always performs a software blend.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 16- bits RGB565 values.
|
||||||
|
* @param alphaData The alpha channel array pointer (points to the beginning of the data)
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyAlphaPerPixel(const uint16_t* sourceData, const uint8_t* alphaData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_NoGA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t expandRgb565(uint16_t c)
|
||||||
|
{
|
||||||
|
return ((c & 0x07E0) << 16) | (c & ~0x07E0);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t compactRgb565(uint32_t c)
|
||||||
|
{
|
||||||
|
return ((c >> 16) & 0x07E0) | (c & ~0x07E0);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t bilinearInterpolate565(uint16_t c00, uint16_t c10, uint16_t c01, uint16_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint32_t a00 = expandRgb565(c00);
|
||||||
|
uint32_t a10 = expandRgb565(c10);
|
||||||
|
uint32_t a01 = expandRgb565(c01);
|
||||||
|
uint32_t a11 = expandRgb565(c11);
|
||||||
|
|
||||||
|
uint8_t xy = (x * y) >> 3;
|
||||||
|
return compactRgb565((a00 * (32 - 2 * y - 2 * x + xy) + a10 * (2 * x - xy) + a01 * (2 * y - xy) + a11 * xy) >> 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t bilinearInterpolate565(uint16_t c00, uint16_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint32_t a00 = expandRgb565(c00);
|
||||||
|
uint32_t a10 = expandRgb565(c10);
|
||||||
|
|
||||||
|
return compactRgb565((a00 * (32 - 2 * x) + a10 * (2 * x)) >> 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint16_t xy10 = 16 * x;
|
||||||
|
uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint16_t xy11 = x * y;
|
||||||
|
uint16_t xy10 = 16 * x - xy11;
|
||||||
|
uint16_t xy01 = 16 * y - xy11;
|
||||||
|
uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint16_t xy10 = 16 * x;
|
||||||
|
uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint32_t c01, uint32_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint16_t xy11 = x * y;
|
||||||
|
uint16_t xy10 = 16 * x - xy11;
|
||||||
|
uint16_t xy01 = 16 * y - xy11;
|
||||||
|
uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10 + (c01 & 0xFF00FF) * xy01 + (c11 & 0xFF00FF) * xy11) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10 + (c01 & 0x00FF00) * xy01 + (c11 & 0x00FF00) * xy11) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div255rb((val & 0xFF00FF) * factor) | div255g((val & 0x00FF00) * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888_FFcheck(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div255_888(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div31rb(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
uint32_t val32 = (val & 0xF81F) * (factor >> 3);
|
||||||
|
return ((val32 + 0x0801 + ((val32 >> 5) & 0xF81F)) >> 5) & 0xF81F;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div31g(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
uint32_t val32 = (val & 0x07E0) * factor;
|
||||||
|
return ((val32 + 0x0020 + (val32 >> 8)) >> 8) & 0x07E0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_565(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div31rb(val, factor) | div31g(val, factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_565_FFcheck(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div31rb(val, factor) | div31g(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase16 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint16_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint16_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* alphaBits, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const alphaBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const alphaBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t a) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint32_t offset, const int16_t bitmapStride, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint32_t offset, const int16_t bitmapStride, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DecompressorL8Base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorRGBBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DecompressorRGBBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_L4 : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t blendPixelRGB565(uint16_t imagePixel, uint16_t fbPixel, int alpha, int ialpha) const;
|
||||||
|
uint16_t blendPixelARGB8888(uint32_t imagePixel, uint16_t fbPixel, int alpha, uint8_t alphapix) const;
|
||||||
|
uint16_t blendPixelRGB888(const uint8_t* imagePixel, uint16_t fbPixel, uint8_t alpha, uint8_t ialpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_RLE : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_LZW9 : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint16_t MAX_DICT_SIZE = 512U;
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
|
||||||
|
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
|
||||||
|
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
|
||||||
|
};
|
||||||
|
|
||||||
|
DecompressorL8Base* decompressorL8_L4;
|
||||||
|
DecompressorL8Base* decompressorL8_RLE;
|
||||||
|
DecompressorL8Base* decompressorL8_LZW9;
|
||||||
|
|
||||||
|
class DecompressorRGB_QOI : public DecompressorRGBBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
static const uint16_t INDEX_TABLE_SIZE = 64U;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
PixelRGB565 indexTable16[INDEX_TABLE_SIZE];
|
||||||
|
PixelARGB8888 indexTable32[INDEX_TABLE_SIZE];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DecompressorRGBBase* decompressorRGB_QOI;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD16BPP_HPP
|
||||||
+992
@@ -0,0 +1,992 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD16bppSerialFlash.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD16bppSerialFlash class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD16BPPSERIALFLASH_HPP
|
||||||
|
#define TOUCHGFX_LCD16BPPSERIALFLASH_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/FlashDataReader.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD16DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 16 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD16bppSerialFlash : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a LCD16bppSerialFlash object. The FlashDataReader object is used to fetch
|
||||||
|
* data from the external flash.
|
||||||
|
*
|
||||||
|
* @param [in] flashReader Reference to a FlashDataReader object.
|
||||||
|
*/
|
||||||
|
LCD16bppSerialFlash(FlashDataReader& flashReader);
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::RGB565;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return HAL::FRAME_BUFFER_WIDTH * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param red Value of the red part (0-255).
|
||||||
|
* @param green Value of the green part (0-255).
|
||||||
|
* @param blue Value of the blue part (0-255).
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
return ((red << 8) & 0xF800) | ((green << 3) & 0x07E0) | ((blue >> 3) & 0x001F);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return ((color >> 8) & 0xF800) | ((color >> 5) & 0x07E0) | ((color >> 3) & 0x001F);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB565 image format. This allows drawing L8_RGB565
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB565_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_RGB565_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB565();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB565 image format. This allows drawing L8_RGB565
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB565, enableTextureMapperL8_RGB565_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB565_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB565 image format. This allows drawing L8_RGB565
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB565, enableTextureMapperL8_RGB565_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB565_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Bilinear Interpolation and NearestNeighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_RGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888, enableTextureMapperL8_RGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888, enableTextureMapperL8_RGB888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_ARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888, enableTextureMapperL8_ARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888, enableTextureMapperL8_ARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGB565 image format. This allows drawing RGB565
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565_Opaque_BilinearInterpolation,
|
||||||
|
* enableTextureMapperRGB565_Opaque_NearestNeighbor,
|
||||||
|
* enableTextureMapperRGB565_NonOpaque_BilinearInterpolation,
|
||||||
|
* enableTextureMapperRGB565_NonOpaque_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for Opaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_Opaque_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for NonOpaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_NonOpaque_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for Opaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_Opaque_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for NonOpaque RGB565 image format. This allows drawing
|
||||||
|
* RGB565 images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB565
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB565_NonOpaque_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
|
||||||
|
* This allows drawing L4, RLE and LZW9 compressed L8 images.
|
||||||
|
*
|
||||||
|
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_All();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the L4 algorithm.
|
||||||
|
* This allows drawing L4 compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_L4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the RLE algorithm.
|
||||||
|
* This allows drawing RLE compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_RLE();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
|
||||||
|
* This allows drawing LZW9 compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_LZW9();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for RGB images compressed with the QOI algorithm.
|
||||||
|
* This allows drawing compressed RGB images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorRGB();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
FlashDataReader& flashReader; ///< Flash reader. Used by routines to read pixel data from the flash.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer performing alpha-blending per pixel as specified.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32 bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
void blitCopyARGB8888(const uint32_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer never performing alpha-blending per pixel as
|
||||||
|
* because it is assumed that all pixels in the bitmap are solid (i.e. alpha for each pixel is
|
||||||
|
* 255).
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32 bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
*/
|
||||||
|
void blitCopyARGB8888Solid(const uint32_t* sourceData, const Rect& source, const Rect& blitRect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer performing alpha-blending per pixel as specified.
|
||||||
|
* If ARGB8888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 24 bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
void blitCopyRGB888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if indexed format is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if L8_ARGB8888 is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries stored as 32-
|
||||||
|
* bits (ARGB8888) format.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
void blitCopyL8_ARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if L8_RGB565 is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries stored as 16-
|
||||||
|
* bits (RGB565) format. If the source have per pixel alpha
|
||||||
|
* channel, then alpha channel data will be following the clut
|
||||||
|
* entries data.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
void blitCopyL8_RGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB565_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB565_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_NoGA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t expandRgb565(uint16_t c)
|
||||||
|
{
|
||||||
|
return ((c & 0x07E0) << 16) | (c & ~0x07E0);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t compactRgb565(uint32_t c)
|
||||||
|
{
|
||||||
|
return ((c >> 16) & 0x07E0) | (c & ~0x07E0);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t bilinearInterpolate565(uint16_t c00, uint16_t c10, uint16_t c01, uint16_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint32_t a00 = expandRgb565(c00);
|
||||||
|
uint32_t a10 = expandRgb565(c10);
|
||||||
|
uint32_t a01 = expandRgb565(c01);
|
||||||
|
uint32_t a11 = expandRgb565(c11);
|
||||||
|
|
||||||
|
uint8_t xy = (x * y) >> 3;
|
||||||
|
return compactRgb565((a00 * (32 - 2 * y - 2 * x + xy) + a10 * (2 * x - xy) + a01 * (2 * y - xy) + a11 * xy) >> 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t bilinearInterpolate565(uint16_t c00, uint16_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint32_t a00 = expandRgb565(c00);
|
||||||
|
uint32_t a10 = expandRgb565(c10);
|
||||||
|
|
||||||
|
return compactRgb565((a00 * (32 - 2 * x) + a10 * (2 * x)) >> 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint16_t xy10 = 16 * x;
|
||||||
|
uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint16_t xy11 = x * y;
|
||||||
|
uint16_t xy10 = 16 * x - xy11;
|
||||||
|
uint16_t xy01 = 16 * y - xy11;
|
||||||
|
uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint16_t xy10 = 16 * x;
|
||||||
|
uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint32_t c01, uint32_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint16_t xy11 = x * y;
|
||||||
|
uint16_t xy10 = 16 * x - xy11;
|
||||||
|
uint16_t xy01 = 16 * y - xy11;
|
||||||
|
uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10 + (c01 & 0xFF00FF) * xy01 + (c11 & 0xFF00FF) * xy11) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10 + (c01 & 0x00FF00) * xy01 + (c11 & 0x00FF00) * xy11) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div255rb((val & 0xFF00FF) * factor) | div255g((val & 0x00FF00) * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888_FFcheck(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div255_888(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div31rb(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
uint32_t val32 = (val & 0xF81F) * (factor >> 3);
|
||||||
|
return ((val32 + 0x0801 + ((val32 >> 5) & 0xF81F)) >> 5) & 0xF81F;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div31g(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
uint32_t val32 = (val & 0x07E0) * factor;
|
||||||
|
return ((val32 + 0x0020 + (val32 >> 8)) >> 8) & 0x07E0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_565(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div31rb(val, factor) | div31g(val, factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_565_FFcheck(uint16_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div31rb(val, factor) | div31g(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase16 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint16_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint16_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB565_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint16_t* const palette16, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* alphaBits, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t* const alphaBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint8_t* const alphaBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB565_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint8_t a) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint32_t offset, const int16_t bitmapWidth, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase16
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint32_t offset, const int16_t bitmapWidth, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FlashDataProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FlashDataProvider(FlashDataReader& _flashReader);
|
||||||
|
|
||||||
|
void initialize(const uint8_t* _sourceData, uint32_t _maxBytesToRead);
|
||||||
|
bool addressIsAddressable(const void* address) const;
|
||||||
|
void increment();
|
||||||
|
|
||||||
|
uint8_t getCurrent() const
|
||||||
|
{
|
||||||
|
return *currentBytePtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void readFromFlash();
|
||||||
|
|
||||||
|
FlashDataReader& flashReader;
|
||||||
|
const uint8_t* sourceData;
|
||||||
|
uint32_t maxBytesToRead;
|
||||||
|
uint32_t bytesToRead;
|
||||||
|
const uint8_t* bufferEnd;
|
||||||
|
const uint8_t* currentBytePtr;
|
||||||
|
bool isAddressable;
|
||||||
|
|
||||||
|
static const uint16_t MAX_BYTES_TO_READ = 64;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DecompressorL8Base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorRGBBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DecompressorRGBBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_L4 : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DecompressorL8_L4(FlashDataReader& _flashReader)
|
||||||
|
: flashReader(_flashReader)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t blendPixelRGB565(uint16_t imagePixel, uint16_t fbPixel, int alpha, int ialpha) const;
|
||||||
|
uint16_t blendPixelARGB8888(uint32_t imagePixel, uint16_t fbPixel, int alpha, uint8_t alphapix) const;
|
||||||
|
FlashDataReader& flashReader;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_RLE : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DecompressorL8_RLE(FlashDataReader& _flashReader)
|
||||||
|
: flashDataProvider(_flashReader)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FlashDataProvider flashDataProvider;
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_LZW9 : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DecompressorL8_LZW9(FlashDataReader& _flashReader)
|
||||||
|
: flashDataProvider(_flashReader)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FlashDataProvider flashDataProvider;
|
||||||
|
static const uint16_t MAX_DICT_SIZE = 512U;
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
|
||||||
|
struct LZW9DictionaryEntry
|
||||||
|
{
|
||||||
|
uint8_t character; // Current character of the entry
|
||||||
|
uint8_t length; // Remaining length of the entry
|
||||||
|
uint16_t prefixIndex; // Index to previous character
|
||||||
|
};
|
||||||
|
|
||||||
|
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
|
||||||
|
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
|
||||||
|
};
|
||||||
|
|
||||||
|
DecompressorL8Base* decompressorL8_L4;
|
||||||
|
DecompressorL8Base* decompressorL8_RLE;
|
||||||
|
DecompressorL8Base* decompressorL8_LZW9;
|
||||||
|
|
||||||
|
class DecompressorRGB_QOI : public DecompressorRGBBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DecompressorRGB_QOI(FlashDataReader& _flashReader)
|
||||||
|
: flashDataProvider(_flashReader)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB565(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FlashDataProvider flashDataProvider;
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
static const uint16_t INDEX_TABLE_SIZE = 64U;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
PixelRGB565 indexTable16[INDEX_TABLE_SIZE];
|
||||||
|
PixelARGB8888 indexTable32[INDEX_TABLE_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
PixelRGB565 uniqueColorsBuffer[INDEX_TABLE_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
DecompressorRGBBase* decompressorRGB_QOI;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD16BPPSERIALFLASH_HPP
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD1bpp.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchfgx::LCD1bpp class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD1BPP_HPP
|
||||||
|
#define TOUCHGFX_LCD1BPP_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/Color.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD1DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
struct GlyphNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 1 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD1bpp : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::BW;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return (HAL::FRAME_BUFFER_WIDTH + 7) / 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param red Value of the red part (0-255).
|
||||||
|
* @param green Value of the green part (0-255).
|
||||||
|
* @param blue Value of the blue part (0-255).
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
// Find the GRAY value (http://en.wikipedia.org/wiki/Luma_%28video%29) rounded to nearest integer
|
||||||
|
return (red * 54 + green * 183 + blue * 19) >> 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return getNativeColorFromRGB(Color::getRed(color), Color::getGreen(color), Color::getBlue(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. Currently texture mapping is not
|
||||||
|
* supported on 1bpp displays, so this function does not do anything. It is merely
|
||||||
|
* included to allow function enableTextureMapperAll() to be called on any subclass of
|
||||||
|
* LCD.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void drawTextureMapScanLine(const DrawingSurface& /*dest*/, const Gradients& /*gradients*/, const Edge* /*leftEdge*/, const Edge* /*rightEdge*/, const TextureSurface& /*texture*/, const Rect& /*absoluteRect*/, const Rect& /*dirtyAreaAbsolute*/, RenderingVariant /*renderVariant*/, uint8_t /*alpha*/, uint16_t /*subDivisionSize*/)
|
||||||
|
{
|
||||||
|
assert(false && "Texture mapping not supported for 1bpp");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill memory efficiently. Try to get 32bit aligned or 16bit aligned and then copy as
|
||||||
|
* quickly as possible.
|
||||||
|
*
|
||||||
|
* @param [out] dst Pointer to memory to fill.
|
||||||
|
* @param color Color to write to memory, either 0 => 0x00000000 or 1 =>
|
||||||
|
* 0xFFFFFFFF.
|
||||||
|
* @param bytesToFill Number of bytes to fill.
|
||||||
|
*/
|
||||||
|
static void fillMemory(void* RESTRICT dst, colortype color, uint16_t bytesToFill);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a run-length encoded2D source-array to the framebuffer if alpha > zero.
|
||||||
|
*
|
||||||
|
* @param _sourceData The source-array pointer (points to the beginning of the data). Data
|
||||||
|
* stored in RLE format, where each byte indicates number of
|
||||||
|
* pixels with certain color, alternating between black and
|
||||||
|
* white. First byte represents black.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending (0 = invisible, otherwise solid).
|
||||||
|
*/
|
||||||
|
virtual void blitCopyRLE(const uint16_t* _sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies a rectangular area from the framebuffer til a givene memory address, which is
|
||||||
|
* typically in the animation storage or a dynamic bitmap.
|
||||||
|
*
|
||||||
|
* @param srcAddress Source address (byte address).
|
||||||
|
* @param srcStride Source stride (number of bytes to advance to next line).
|
||||||
|
* @param srcPixelOffset Source pixel offset (first pixel in first source byte).
|
||||||
|
* @param [in] dstAddress If destination address (byte address).
|
||||||
|
* @param dstStride Destination stride (number of bytes to advance to next line).
|
||||||
|
* @param dstPixelOffset Destination pixel offset (first pixel in destination byte).
|
||||||
|
* @param width The width of area (in pixels).
|
||||||
|
* @param height The height of area (in pixels).
|
||||||
|
*/
|
||||||
|
void copyRect(const uint8_t* srcAddress, int16_t srcStride, uint8_t srcPixelOffset, uint8_t* RESTRICT dstAddress, int16_t dstStride, uint8_t dstPixelOffset, int16_t width, int16_t height) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
class bwRLEdata
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bwRLEdata(const uint8_t* src = 0)
|
||||||
|
: data(src), thisHalfByte(0), nextHalfByte(0), rleByte(0), firstHalfByte(true), color(0), length(0)
|
||||||
|
{
|
||||||
|
init(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(const uint8_t* src)
|
||||||
|
{
|
||||||
|
data = src;
|
||||||
|
rleByte = 0;
|
||||||
|
firstHalfByte = true;
|
||||||
|
color = ~0; // Will be flipped to 0 by first call to getNextLength() below
|
||||||
|
if (src)
|
||||||
|
{
|
||||||
|
// Read two half-bytes ahead
|
||||||
|
thisHalfByte = getNextHalfByte();
|
||||||
|
nextHalfByte = getNextHalfByte();
|
||||||
|
getNextLength();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void skipNext(int32_t skip)
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (length > skip) // Is the current length enough?
|
||||||
|
{
|
||||||
|
length -= skip; // Reduce the length
|
||||||
|
skip = 0; // No more to skip
|
||||||
|
break; // Done!
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skip -= length; // Skip the entire run
|
||||||
|
getNextLength(); // Swap colors and Read length of next run
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t getColor() const
|
||||||
|
{
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t getLength() const
|
||||||
|
{
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void getNextLength()
|
||||||
|
{
|
||||||
|
length = thisHalfByte; // Length is the next byte
|
||||||
|
// Update read ahead buffer
|
||||||
|
thisHalfByte = nextHalfByte;
|
||||||
|
nextHalfByte = getNextHalfByte();
|
||||||
|
color = ~color; // Update the color of next run
|
||||||
|
// If number after 'length' is 0
|
||||||
|
while (thisHalfByte == 0)
|
||||||
|
{
|
||||||
|
length <<= 4; // Multiply length by 16 and
|
||||||
|
length += nextHalfByte; // add the number after 0
|
||||||
|
// We have used the next two half bytes, read two new ones
|
||||||
|
thisHalfByte = getNextHalfByte();
|
||||||
|
nextHalfByte = getNextHalfByte();
|
||||||
|
}
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
getNextLength();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t getNextHalfByte()
|
||||||
|
{
|
||||||
|
assert(data != 0 && "class bwRLEdata not properly initialized");
|
||||||
|
if (firstHalfByte) // Start of new byte, read data from BW_RLE stream
|
||||||
|
{
|
||||||
|
rleByte = *data++;
|
||||||
|
}
|
||||||
|
const uint8_t len = rleByte & 0xF; // Read lower half
|
||||||
|
rleByte >>= 4; // Shift upper half down to make it ready
|
||||||
|
firstHalfByte = !firstHalfByte; // Toggle 'start of byte'
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t* data; // Pointer to compressed data (BW_RLE)
|
||||||
|
uint8_t thisHalfByte; // The next half byte from the input
|
||||||
|
uint8_t nextHalfByte; // The next half byte after 'thisHalfByte'
|
||||||
|
uint8_t rleByte; // Byte read from compressed data
|
||||||
|
bool firstHalfByte; // Are we about to process first half byte of rleByte?
|
||||||
|
uint8_t color; // Current color
|
||||||
|
int32_t length; // Number of pixels with the given color
|
||||||
|
};
|
||||||
|
|
||||||
|
friend class PainterBWBitmap;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD1BPP_HPP
|
||||||
@@ -0,0 +1,705 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD24bpp.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD24bpp class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD24BPP_HPP
|
||||||
|
#define TOUCHGFX_LCD24BPP_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD24DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
struct GlyphNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 16 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD24bpp : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD24bpp();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void drawScaledBitmap(const Bitmap& bitmap, const Rect& blitRect, const Rect& invalidatedArea, RenderingVariant renderVariant, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::RGB888;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return HAL::FRAME_BUFFER_WIDTH * 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_RGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888, enableTextureMapperL8_RGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_RGB888 image format. This allows drawing L8_RGB888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_RGB888, enableTextureMapperL8_RGB888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_RGB888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperL8_ARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888, enableTextureMapperL8_ARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for L8_ARGB8888 image format. This allows drawing
|
||||||
|
* L8_ARGB8888 images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperL8_ARGB8888, enableTextureMapperL8_ARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperL8_ARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGB888 image format. This allows drawing RGB888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperRGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGB888 image format. This allows drawing RGB888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB888, enableTextureMapperRGB888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGB888 image format. This allows drawing RGB888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGB888, enableTextureMapperRGB888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGB888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
|
||||||
|
* This allows drawing L4, RLE and LZW9 compressed L8 images.
|
||||||
|
*
|
||||||
|
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_All();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the L4 algorithm.
|
||||||
|
* This allows drawing L4 compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_L4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the RLE algorithm.
|
||||||
|
* This allows drawing RLE compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_RLE();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
|
||||||
|
* This allows drawing LZW9 compressed L8 images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorL8_LZW9();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the decompressor for RGB images compressed with the QOI algorithm.
|
||||||
|
* This allows drawing compressed RGB images.
|
||||||
|
*/
|
||||||
|
void enableDecompressorRGB();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer. Per pixel alpha is not supported, only
|
||||||
|
* global alpha.
|
||||||
|
*
|
||||||
|
* @param sourceData16 The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 16- bits RGB565 values.
|
||||||
|
* @param source The location and dimension of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyRGB565(const uint16_t* sourceData16, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified if ARGB8888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32- bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyARGB8888(const uint32_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if indexed format is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if L8_ARGB8888 is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries stored as 32-
|
||||||
|
* bits (ARGB8888) format.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyL8_ARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
|
||||||
|
* pixel as specified if L8_RGB888 is not supported by the DMA a software blend is
|
||||||
|
* performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-indexes pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8- bits indexes.
|
||||||
|
* @param clutData The source-clut pointer (points to the beginning of the CLUT color
|
||||||
|
* format and size data followed by colors entries stored as 32-
|
||||||
|
* bits (RGB888) format.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyL8_RGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_RGB888_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB888_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB888_Opaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB888_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGB888_Opaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_NoGA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_NoGA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
return (c00 * (16 - x) + c10 * x) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
const uint16_t xy00 = 16 - x;
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * x) >> 4) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * x) >> 4) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint32_t c01, uint32_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10 + (c01 & 0xFF00FF) * xy01 + (c11 & 0xFF00FF) * xy11) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10 + (c01 & 0x00FF00) * xy01 + (c11 & 0x00FF00) * xy11) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div255rb((val & 0xFF00FF) * factor) | div255g((val & 0x00FF00) * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888_FFcheck(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div255_888(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase24 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const uint8_t* const palette, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const uint8_t* const palette, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_RGB888_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits8, const uint8_t* const palette8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const uint8_t* const palette, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const uint8_t* const palette, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_L8_ARGB8888_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits8, const uint32_t* const palette32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB888_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB888_Opaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB888_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGB888_Opaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits8, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits8, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t a4) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_NoGA : public DrawTextureMapScanLineBase24
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DecompressorL8Base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorRGBBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DecompressorRGBBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_L4 : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void blendPixelRGB888(const uint8_t* imagePixel, uint8_t* const fbPixel, int alpha) const;
|
||||||
|
void blendPixelARGB8888(const uint8_t* imagePixel, uint8_t* const fbPixel, int alpha, uint8_t alphapix) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_RLE : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DecompressorL8_LZW9 : public DecompressorL8Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint16_t MAX_DICT_SIZE = 512U;
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
|
||||||
|
struct LZW9DictionaryEntry
|
||||||
|
{
|
||||||
|
uint8_t character; // Current character of the entry
|
||||||
|
uint8_t length; // Remaining length of the entry
|
||||||
|
uint16_t prefixIndex; // Index to previous character
|
||||||
|
};
|
||||||
|
|
||||||
|
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
|
||||||
|
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
|
||||||
|
};
|
||||||
|
|
||||||
|
DecompressorL8Base* decompressorL8_L4;
|
||||||
|
DecompressorL8Base* decompressorL8_RLE;
|
||||||
|
DecompressorL8Base* decompressorL8_LZW9;
|
||||||
|
|
||||||
|
class DecompressorRGB_QOI : public DecompressorRGBBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void blitCopyARGB8888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
virtual void blitCopyRGB888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint16_t BLOCK_SIZE = 1024U;
|
||||||
|
static const uint16_t INDEX_TABLE_SIZE = 64U;
|
||||||
|
PixelARGB8888 indexTable[INDEX_TABLE_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
DecompressorRGBBase* decompressorRGB_QOI;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD24BPP_HPP
|
||||||
@@ -0,0 +1,368 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD2bpp.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD2bpp class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD2BPP_HPP
|
||||||
|
#define TOUCHGFX_LCD2BPP_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/Color.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD2DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
#define USE_LSB
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 2 bits per pixel gray scale displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD2bpp : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD2bpp();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::GRAY2;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return (HAL::FRAME_BUFFER_WIDTH + 3) / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param red Value of the red part (0-255).
|
||||||
|
* @param green Value of the green part (0-255).
|
||||||
|
* @param blue Value of the blue part (0-255).
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
// Find the GRAY value (http://en.wikipedia.org/wiki/Luma_%28video%29) rounded to nearest integer
|
||||||
|
return (red * 54 + green * 183 + blue * 19) >> 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return getNativeColorFromRGB(Color::getRed(color), Color::getGreen(color), Color::getBlue(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for GRAY2 image format. This allows drawing GRAY2 images
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperGRAY2_BilinearInterpolation,
|
||||||
|
* enableTextureMapperGRAY2_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperGRAY2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for GRAY2 image format. This allows drawing GRAY2 images
|
||||||
|
* using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperGRAY2, enableTextureMapperGRAY2_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperGRAY2_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for GRAY2 image format. This allows drawing GRAY2 images
|
||||||
|
* using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperGRAY2, enableTextureMapperGRAY2_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperGRAY2_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shift value to get the right pixel in a byte.
|
||||||
|
*
|
||||||
|
* @param offset The offset.
|
||||||
|
*
|
||||||
|
* @return The shift value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static int shiftVal(int offset)
|
||||||
|
{
|
||||||
|
#ifdef USE_LSB
|
||||||
|
return (offset & 3) << 1;
|
||||||
|
#else
|
||||||
|
return (3 - (offset & 3)) << 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get pixel from buffer/image.
|
||||||
|
*
|
||||||
|
* @param addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
*
|
||||||
|
* @return The pixel value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getPixel(const uint8_t* addr, int offset)
|
||||||
|
{
|
||||||
|
return (addr[offset >> 2] >> shiftVal(offset)) & 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get pixel from buffer/image.
|
||||||
|
*
|
||||||
|
* @param addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
*
|
||||||
|
* @return The pixel value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getPixel(const uint16_t* addr, int offset)
|
||||||
|
{
|
||||||
|
return getPixel(reinterpret_cast<const uint8_t*>(addr), offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set pixel in buffer.
|
||||||
|
*
|
||||||
|
* @param [in] addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
* @param value The value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static void setPixel(uint8_t* addr, int offset, uint8_t value)
|
||||||
|
{
|
||||||
|
int shift = shiftVal(offset);
|
||||||
|
addr[offset >> 2] = (addr[offset >> 2] & ~(3 << shift)) | ((value & 3) << shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set pixel in buffer.
|
||||||
|
*
|
||||||
|
* @param [in] addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
* @param value The value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static void setPixel(uint16_t* addr, int offset, uint8_t value)
|
||||||
|
{
|
||||||
|
setPixel(reinterpret_cast<uint8_t*>(addr), offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static const uint8_t alphaBlend[16][4][4]; ///< The alpha lookup table to avoid arithmetics when alpha blending
|
||||||
|
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified Performs always a software blend.
|
||||||
|
*
|
||||||
|
* @param sourceData16 The source-array pointer (points to the beginning of the
|
||||||
|
* data). The sourceData must be stored as 2bpp GRAY2 values.
|
||||||
|
* @param sourceAlphaData The alpha channel array pointer (points to the beginning of
|
||||||
|
* the data)
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole
|
||||||
|
* image (255 = solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyAlphaPerPixel(const uint16_t* sourceData16, const uint8_t* sourceAlphaData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies a rectangular area.
|
||||||
|
*
|
||||||
|
* @param srcAddress Source address (byte address).
|
||||||
|
* @param srcStride Source stride (number of bytes to advance to next line).
|
||||||
|
* @param srcPixelOffset Source pixel offset (first pixel in first source byte).
|
||||||
|
* @param [in] dstAddress If destination address (byte address).
|
||||||
|
* @param dstStride Destination stride (number of bytes to advance to next line).
|
||||||
|
* @param dstPixelOffset Destination pixel offset (first pixel in destination byte).
|
||||||
|
* @param width The width of area (in pixels).
|
||||||
|
* @param height The height of area (in pixels).
|
||||||
|
*/
|
||||||
|
void copyRect(const uint8_t* srcAddress, uint16_t srcStride, uint8_t srcPixelOffset, uint8_t* RESTRICT dstAddress, uint16_t dstStride, uint8_t dstPixelOffset, uint16_t width, uint16_t height) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY2_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY2_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY2_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY2_Opaque_BilinearInterpolation_GA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint16_t xy10 = 16 * x;
|
||||||
|
uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint16_t xy11 = x * y;
|
||||||
|
uint16_t xy10 = 16 * x - xy11;
|
||||||
|
uint16_t xy01 = 16 * y - xy11;
|
||||||
|
uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t div255_2(uint16_t value)
|
||||||
|
{
|
||||||
|
return div255(value * 0x55) >> 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase2 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint32_t& destOffset, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint32_t& destOffset, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY2_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY2_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY2_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY2_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destAddress, const uint32_t destOffset, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint32_t offset, const int16_t bitmapStride, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD2BPP_HPP
|
||||||
File diff suppressed because it is too large.
Load diff
+1010
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,393 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD4bpp.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD4bpp class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD4BPP_HPP
|
||||||
|
#define TOUCHGFX_LCD4BPP_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/Color.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD4DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
#define USE_LSB
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 4 bits per pixel grayscale displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD4bpp : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD4bpp();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::GRAY4;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void setDefaultColor(colortype color)
|
||||||
|
{
|
||||||
|
LCD::setDefaultColor(color);
|
||||||
|
defaultColor4 = getNativeColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return (HAL::FRAME_BUFFER_WIDTH + 1) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param red Value of the red part (0-255).
|
||||||
|
* @param green Value of the green part (0-255).
|
||||||
|
* @param blue Value of the blue part (0-255).
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
// Find the GRAY value (http://en.wikipedia.org/wiki/Luma_%28video%29) rounded to nearest integer
|
||||||
|
return (red * 54 + green * 183 + blue * 19) >> 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return getNativeColorFromRGB(Color::getRed(color), Color::getGreen(color), Color::getBlue(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for GRAY4 image format. This allows drawing GRAY4 images
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperGRAY4_BilinearInterpolation,
|
||||||
|
* enableTextureMapperGRAY4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperGRAY4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for GRAY4 image format. This allows drawing GRAY4 images
|
||||||
|
* using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperGRAY4, enableTextureMapperGRAY4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperGRAY4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for GRAY4 image format. This allows drawing GRAY4 images
|
||||||
|
* using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperGRAY4, enableTextureMapperGRAY4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperGRAY4_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get pixel from buffer/image.
|
||||||
|
*
|
||||||
|
* @param addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
*
|
||||||
|
* @return The pixel value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getPixel(const uint8_t* addr, int offset)
|
||||||
|
{
|
||||||
|
uint8_t data = addr[offset / 2];
|
||||||
|
#ifdef USE_LSB
|
||||||
|
return (offset & 1) ? data >> 4 : data & 0xF;
|
||||||
|
#else
|
||||||
|
return (offset & 1) ? data & 0xF : data >> 4;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get pixel from buffer/image.
|
||||||
|
*
|
||||||
|
* @param addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
*
|
||||||
|
* @return The pixel value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getPixel(const uint16_t* addr, int offset)
|
||||||
|
{
|
||||||
|
return getPixel(reinterpret_cast<const uint8_t*>(addr), offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set pixel in buffer.
|
||||||
|
*
|
||||||
|
* @param [in] addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
* @param value The value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static void setPixel(uint8_t* addr, int offset, uint8_t value)
|
||||||
|
{
|
||||||
|
uint8_t data = addr[offset / 2];
|
||||||
|
#ifdef USE_LSB
|
||||||
|
addr[offset / 2] = (offset & 1) ? (data & 0x0F) | (value << 4) : (data & 0xF0) | value;
|
||||||
|
#else
|
||||||
|
addr[offset / 2] = (offset & 1) ? (data & 0xF0) | value : (data & 0x0F) | (value << 4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set pixel in buffer.
|
||||||
|
*
|
||||||
|
* @param [in] addr The address.
|
||||||
|
* @param offset The offset.
|
||||||
|
* @param value The value.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static void setPixel(uint16_t* addr, int offset, uint8_t value)
|
||||||
|
{
|
||||||
|
setPixel(reinterpret_cast<uint8_t*>(addr), offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static uint8_t defaultColor4; ///< Default Color to use when displaying transparency-only elements, e.g. A4 bitmaps
|
||||||
|
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified Performs always a software blend.
|
||||||
|
*
|
||||||
|
* @param sourceData16 The source-array pointer (points to the beginning of the
|
||||||
|
* data). The sourceData must be stored as 4bpp GRAY4 values.
|
||||||
|
* @param sourceAlphaData The alpha channel array pointer (points to the beginning of
|
||||||
|
* the data)
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole
|
||||||
|
* image (255 = solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyAlphaPerPixel(const uint16_t* sourceData16, const uint8_t* sourceAlphaData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies a rectangular area.
|
||||||
|
*
|
||||||
|
* @param srcAddress Source address (byte address).
|
||||||
|
* @param srcStride Source stride (number of bytes to advance to next line).
|
||||||
|
* @param srcPixelOffset Source pixel offset (first pixel in first source byte).
|
||||||
|
* @param [in] dstAddress If destination address (byte address).
|
||||||
|
* @param dstStride Destination stride (number of bytes to advance to next line).
|
||||||
|
* @param dstPixelOffset Destination pixel offset (first pixel in destination byte).
|
||||||
|
* @param width The width of area (in pixels).
|
||||||
|
* @param height The height of area (in pixels).
|
||||||
|
*/
|
||||||
|
void copyRect(const uint8_t* srcAddress, uint16_t srcStride, uint8_t srcPixelOffset, uint8_t* RESTRICT dstAddress, uint16_t dstStride, uint8_t dstPixelOffset, uint16_t width, uint16_t height) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY4_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY4_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY4_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_GRAY4_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
uint16_t xy10 = 16 * x;
|
||||||
|
uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
uint16_t xy11 = x * y;
|
||||||
|
uint16_t xy10 = 16 * x - xy11;
|
||||||
|
uint16_t xy01 = 16 * y - xy11;
|
||||||
|
uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t div255_4(uint16_t value)
|
||||||
|
{
|
||||||
|
return div255(value * 0x11) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase4 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint32_t& destOffset, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint32_t& destOffset, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY4_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase4
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY4_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase4
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY4_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase4
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint8_t* const alphaBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_GRAY4_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase4
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase4
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destAddress, const uint32_t destOffset, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase4
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint16_t* const destAddress, const uint32_t destOffset, const uint16_t* const textureBits, const uint16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD4BPP_HPP
|
||||||
+450
@@ -0,0 +1,450 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD8bpp_ABGR2222.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD8bpp_ABGR2222 class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD8BPP_ABGR2222_HPP
|
||||||
|
#define TOUCHGFX_LCD8BPP_ABGR2222_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD8ABGR2222DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 16 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD8bpp_ABGR2222 : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD8bpp_ABGR2222();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::ABGR2222;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return HAL::FRAME_BUFFER_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets color from RGB.
|
||||||
|
*
|
||||||
|
* @param red The red.
|
||||||
|
* @param green The green.
|
||||||
|
* @param blue The blue.
|
||||||
|
*
|
||||||
|
* @return The color from RGB.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
return 0xC0 | ((blue & 0xC0) >> 2) | ((green & 0xC0) >> 4) | ((red & 0xC0) >> 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return 0xC0 | ((color >> 22) & 0x03) | ((color >> 12) & 0x0C) | ((color >> 2) & 0x30);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets red from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The red from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getRedFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return (color & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets green from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The green from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getGreenFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 2) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets blue from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The blue from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getBlueFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 4) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets alpha from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The alpha from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getAlphaFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 6) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ABGR2222 image format. This allows drawing ABGR2222
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperABGR2222_BilinearInterpolation,
|
||||||
|
* enableTextureMapperABGR2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperABGR2222();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ABGR2222 image format. This allows drawing ABGR2222
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperABGR2222, enableTextureMapperABGR2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperABGR2222_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ABGR2222 image format. This allows drawing ABGR2222
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperABGR2222, enableTextureMapperABGR2222_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperABGR2222_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified if ARGB8888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32- bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyARGB8888(const uint32_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified Performs always a software blend.
|
||||||
|
*
|
||||||
|
* @param sourceData16 The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8-bits ABGR2222 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyAlphaPerPixel(const uint16_t* sourceData16, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ABGR2222_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ABGR2222_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ABGR2222_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ABGR2222_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
const uint16_t xy10 = 16 * x;
|
||||||
|
const uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION uint32_t convertABGR2222toARGB8888(colortype col) const
|
||||||
|
{
|
||||||
|
return (((col & 0xC0) << 18) | ((col & 0x03) << 16) | ((col & 0x0C) << 6) | ((col & 0x30) >> 4)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t convertABGR2222toRGB888(uint8_t val)
|
||||||
|
{
|
||||||
|
return (((val & 0x03) << 16) | ((val & 0x0C) << 6) | ((val & 0x30) >> 4)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t convertRGB888toXBGR2222(uint32_t val)
|
||||||
|
{
|
||||||
|
val &= 0xC0C0C0;
|
||||||
|
return (val >> 2) | (val >> 12) | (val >> 22);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint32_t c01, uint32_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10 + (c01 & 0xFF00FF) * xy01 + (c11 & 0xFF00FF) * xy11) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10 + (c01 & 0x00FF00) * xy01 + (c11 & 0x00FF00) * xy11) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div255rb((val & 0xFF00FF) * factor) | div255g((val & 0x00FF00) * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888_FFcheck(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div255_888(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t alphaBlend(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t alpha, const uint8_t fbr, const uint8_t fbg, const uint8_t fbb, const uint8_t ialpha)
|
||||||
|
{
|
||||||
|
return getNativeColorFromRGB(div255(r * alpha + fbr * ialpha), div255(g * alpha + fbg * ialpha), div255(b * alpha + fbb * ialpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase8 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ABGR2222_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ABGR2222_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ABGR2222_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ABGR2222_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD8BPP_ABGR2222_HPP
|
||||||
+450
@@ -0,0 +1,450 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD8bpp_ARGB2222.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD8bpp_ARGB2222 class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD8BPP_ARGB2222_HPP
|
||||||
|
#define TOUCHGFX_LCD8BPP_ARGB2222_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD8ARGB2222DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 16 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD8bpp_ARGB2222 : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD8bpp_ARGB2222();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::ARGB2222;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return HAL::FRAME_BUFFER_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets color from RGB.
|
||||||
|
*
|
||||||
|
* @param red The red.
|
||||||
|
* @param green The green.
|
||||||
|
* @param blue The blue.
|
||||||
|
*
|
||||||
|
* @return The color from RGB.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
return 0xC0 | ((red & 0xC0) >> 2) | ((green & 0xC0) >> 4) | ((blue & 0xC0) >> 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return 0xC0 | ((color >> 18) & 0x30) | ((color >> 12) & 0x0C) | ((color >> 6) & 0x03);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets red from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The red from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getRedFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 4) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets green from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The green from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getGreenFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 2) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets blue from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The blue from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getBlueFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return (color & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets alpha from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The alpha from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getAlphaFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 6) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB2222 image format. This allows drawing ARGB2222
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB2222_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB2222();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB2222 image format. This allows drawing ARGB2222
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB2222, enableTextureMapperARGB2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB2222_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB2222 image format. This allows drawing ARGB2222
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB2222, enableTextureMapperARGB2222_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB2222_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified if ARGB8888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32- bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyARGB8888(const uint32_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified Performs always a software blend.
|
||||||
|
*
|
||||||
|
* @param sourceData16 The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8-bits ARGB2222 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyAlphaPerPixel(const uint16_t* sourceData16, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB2222_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB2222_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB2222_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB2222_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
const uint16_t xy10 = 16 * x;
|
||||||
|
const uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION uint32_t convertARGB2222toARGB8888(colortype col) const
|
||||||
|
{
|
||||||
|
return (((col & 0xC0) << 18) | ((col & 0x30) << 12) | ((col & 0x0C) << 6) | (col & 0x03)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t convertARGB2222toRGB888(uint8_t val)
|
||||||
|
{
|
||||||
|
return (((val & 0x30) << 12) | ((val & 0x0C) << 6) | (val & 0x03)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t convertRGB888toXRGB2222(uint32_t val)
|
||||||
|
{
|
||||||
|
val &= 0xC0C0C0;
|
||||||
|
return (val >> 6) | (val >> 12) | (val >> 18);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint32_t c01, uint32_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10 + (c01 & 0xFF00FF) * xy01 + (c11 & 0xFF00FF) * xy11) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10 + (c01 & 0x00FF00) * xy01 + (c11 & 0x00FF00) * xy11) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div255rb((val & 0xFF00FF) * factor) | div255g((val & 0x00FF00) * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888_FFcheck(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div255_888(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t alphaBlend(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t alpha, const uint8_t fbr, const uint8_t fbg, const uint8_t fbb, const uint8_t ialpha)
|
||||||
|
{
|
||||||
|
return getNativeColorFromRGB(div255(r * alpha + fbr * ialpha), div255(g * alpha + fbg * ialpha), div255(b * alpha + fbb * ialpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase8 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB2222_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB2222_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB2222_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB2222_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD8BPP_ARGB2222_HPP
|
||||||
+450
@@ -0,0 +1,450 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD8bpp_BGRA2222.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD8bpp_BGRA2222 class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD8BPP_BGRA2222_HPP
|
||||||
|
#define TOUCHGFX_LCD8BPP_BGRA2222_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD8BGRA2222DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 16 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD8bpp_BGRA2222 : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD8bpp_BGRA2222();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::BGRA2222;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return HAL::FRAME_BUFFER_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets color from RGB.
|
||||||
|
*
|
||||||
|
* @param red The red.
|
||||||
|
* @param green The green.
|
||||||
|
* @param blue The blue.
|
||||||
|
*
|
||||||
|
* @return The color from RGB.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
return (blue & 0xC0) | ((green & 0xC0) >> 2) | ((red & 0xC0) >> 4) | 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return ((color >> 20) & 0x0C) | ((color >> 10) & 0x30) | (color & 0xC0) | 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets red from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The red from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getRedFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 2) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets green from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The green from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getGreenFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 4) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets blue from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The blue from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getBlueFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 6) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets alpha from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The alpha from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getAlphaFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return (color & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for BGRA2222 image format. This allows drawing BGRA2222
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperBGRA2222_BilinearInterpolation,
|
||||||
|
* enableTextureMapperBGRA2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperBGRA2222();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for BGRA2222 image format. This allows drawing BGRA2222
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperBGRA2222, enableTextureMapperBGRA2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperBGRA2222_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for BGRA2222 image format. This allows drawing BGRA2222
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperBGRA2222, enableTextureMapperBGRA2222_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperBGRA2222_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified if ARGB8888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32- bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyARGB8888(const uint32_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified Performs always a software blend.
|
||||||
|
*
|
||||||
|
* @param sourceData16 The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8-bits BGRA2222 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyAlphaPerPixel(const uint16_t* sourceData16, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_BGRA2222_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_BGRA2222_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_BGRA2222_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_BGRA2222_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
const uint16_t xy10 = 16 * x;
|
||||||
|
const uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION uint32_t convertBGRA2222toARGB8888(colortype col) const
|
||||||
|
{
|
||||||
|
return (((col & 0x03) << 24) | ((col & 0x0C) << 14) | ((col & 0x30) << 4) | ((col & 0xC0) >> 6)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t convertBGRA2222toRGB888(uint8_t val)
|
||||||
|
{
|
||||||
|
return (((val & 0x0C) << 14) | ((val & 0x30) << 4) | ((val & 0xC0) >> 6)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t convertRGB888toBGRX2222(uint32_t val)
|
||||||
|
{
|
||||||
|
val &= 0xC0C0C0;
|
||||||
|
return (val) | (val >> 10) | (val >> 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint32_t c01, uint32_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10 + (c01 & 0xFF00FF) * xy01 + (c11 & 0xFF00FF) * xy11) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10 + (c01 & 0x00FF00) * xy01 + (c11 & 0x00FF00) * xy11) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div255rb((val & 0xFF00FF) * factor) | div255g((val & 0x00FF00) * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888_FFcheck(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div255_888(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t alphaBlend(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t alpha, const uint8_t fbr, const uint8_t fbg, const uint8_t fbb, const uint8_t ialpha)
|
||||||
|
{
|
||||||
|
return getNativeColorFromRGB(div255(r * alpha + fbr * ialpha), div255(g * alpha + fbg * ialpha), div255(b * alpha + fbb * ialpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase8 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_BGRA2222_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_BGRA2222_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_BGRA2222_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_BGRA2222_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD8BPP_BGRA2222_HPP
|
||||||
+450
@@ -0,0 +1,450 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCD8bpp_RGBA2222.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCD8bppRGBA2222 class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCD8BPP_RGBA2222_HPP
|
||||||
|
#define TOUCHGFX_LCD8BPP_RGBA2222_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD8RGBA2222DebugPrinter.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles on 16 bits per pixel displays.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
class LCD8bpp_RGBA2222 : public LCD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LCD8bpp_RGBA2222();
|
||||||
|
|
||||||
|
virtual void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool hasTransparentPixels);
|
||||||
|
|
||||||
|
virtual uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId);
|
||||||
|
|
||||||
|
virtual Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight);
|
||||||
|
|
||||||
|
virtual void copyAreaFromTFTToClientBuffer(const Rect& region);
|
||||||
|
|
||||||
|
virtual void fillRect(const Rect& rect, colortype color, uint8_t alpha = 255);
|
||||||
|
|
||||||
|
virtual void fillBuffer(uint8_t* const destination, uint16_t pixelStride, const Rect& rect, const colortype color, const uint8_t alpha);
|
||||||
|
|
||||||
|
virtual uint8_t bitDepth() const
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Bitmap::BitmapFormat framebufferFormat() const
|
||||||
|
{
|
||||||
|
return Bitmap::RGBA2222;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t framebufferStride() const
|
||||||
|
{
|
||||||
|
return getFramebufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer stride in bytes. The distance (in bytes) from the start of one
|
||||||
|
* framebuffer row, to the next.
|
||||||
|
*
|
||||||
|
* @return The number of bytes in one framebuffer row.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint16_t getFramebufferStride()
|
||||||
|
{
|
||||||
|
assert(HAL::FRAME_BUFFER_WIDTH > 0 && "HAL has not been initialized yet");
|
||||||
|
return HAL::FRAME_BUFFER_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets color from RGB.
|
||||||
|
*
|
||||||
|
* @param red The red.
|
||||||
|
* @param green The green.
|
||||||
|
* @param blue The blue.
|
||||||
|
*
|
||||||
|
* @return The color from RGB.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColorFromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
|
{
|
||||||
|
return (red & 0xC0) | ((green & 0xC0) >> 2) | ((blue & 0xC0) >> 4) | 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a color representation to be used on the LCD, based on 24 bit RGB values.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The color representation depending on LCD color format.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getNativeColor(colortype color)
|
||||||
|
{
|
||||||
|
return ((color >> 16) & 0xC0) | ((color >> 10) & 0x30) | ((color >> 4) & 0x0C) | 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets red from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The red from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getRedFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 6) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets green from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The green from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getGreenFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 4) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets blue from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The blue from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getBlueFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return ((color >> 2) & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets alpha from color.
|
||||||
|
*
|
||||||
|
* @param color The color.
|
||||||
|
*
|
||||||
|
* @return The alpha from color.
|
||||||
|
*/
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t getAlphaFromNativeColor(uint8_t color)
|
||||||
|
{
|
||||||
|
return (color & 0x03) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for all image formats. This allows drawing any image
|
||||||
|
* using Bilinear Interpolation and Nearest Neighbor algorithms, but might use a lot of
|
||||||
|
* memory for the drawing algorithms.
|
||||||
|
*/
|
||||||
|
void enableTextureMapperAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGBA2222 image format. This allows drawing RGBA2222
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGBA2222_BilinearInterpolation,
|
||||||
|
* enableTextureMapperRGBA2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGBA2222();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGBA2222 image format. This allows drawing RGBA2222
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGBA2222, enableTextureMapperRGBA2222_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGBA2222_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for RGBA2222 image format. This allows drawing RGBA2222
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperRGBA2222, enableTextureMapperRGBA2222_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperRGBA2222_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888_BilinearInterpolation,
|
||||||
|
* enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for ARGB8888 image format. This allows drawing ARGB8888
|
||||||
|
* images using Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperARGB8888, enableTextureMapperARGB8888_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperARGB8888_NearestNeighbor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation and Nearest Neighbor algorithms.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4_BilinearInterpolation, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Bilinear Interpolation algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_NearestNeighbor
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_BilinearInterpolation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the texture mappers for A4 image format. This allows drawing A4 images using
|
||||||
|
* Nearest Neighbor algorithm.
|
||||||
|
*
|
||||||
|
* @see enableTextureMapperA4, enableTextureMapperA4_BilinearInterpolation
|
||||||
|
*/
|
||||||
|
void enableTextureMapperA4_NearestNeighbor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next pixel.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next pixel.
|
||||||
|
*/
|
||||||
|
static int nextPixel(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out how much to advance in the display buffer to get to the next line.
|
||||||
|
*
|
||||||
|
* @param rotatedDisplay Is the display running in portrait mode?
|
||||||
|
* @param textRotation Rotation to perform.
|
||||||
|
*
|
||||||
|
* @return How much to advance to get to the next line.
|
||||||
|
*/
|
||||||
|
static int nextLine(bool rotatedDisplay, TextRotation textRotation);
|
||||||
|
|
||||||
|
virtual void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified if ARGB8888 is not supported by the DMA a software blend is performed.
|
||||||
|
*
|
||||||
|
* @param sourceData The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 32- bits ARGB8888 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyARGB8888(const uint32_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit a 2D source-array to the framebuffer performing alpha-blending per pixel as
|
||||||
|
* specified Performs always a software blend.
|
||||||
|
*
|
||||||
|
* @param sourceData16 The source-array pointer (points to the beginning of the data). The
|
||||||
|
* sourceData must be stored as 8-bit RGBA2222 values.
|
||||||
|
* @param source The location and dimensions of the source.
|
||||||
|
* @param blitRect A rectangle describing what region is to be drawn.
|
||||||
|
* @param alpha The alpha value to use for blending applied to the whole image (255 =
|
||||||
|
* solid, no blending)
|
||||||
|
*/
|
||||||
|
static void blitCopyAlphaPerPixel(const uint16_t* sourceData16, const Rect& source, const Rect& blitRect, uint8_t alpha);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGBA2222_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGBA2222_Opaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGBA2222_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_RGBA2222_Opaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_NearestNeighbor_GA;
|
||||||
|
DrawTextureMapScanLineBase* textureMapper_A4_BilinearInterpolation_GA;
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t x)
|
||||||
|
{
|
||||||
|
assert(x < 16);
|
||||||
|
const uint16_t xy10 = 16 * x;
|
||||||
|
const uint16_t xy00 = 256 - xy10;
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t bilinearInterpolate8(uint8_t c00, uint8_t c10, uint8_t c01, uint8_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return (c00 * xy00 + c10 * xy10 + c01 * xy01 + c11 * xy11) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION uint32_t convertRGBA2222toARGB8888(colortype col) const
|
||||||
|
{
|
||||||
|
return (((col & 0x03) << 24) | ((col & 0xC0) << 10) | ((col & 0x30) << 4) | ((col & 0x0C) >> 2)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t convertRGBA2222toRGB888(uint8_t val)
|
||||||
|
{
|
||||||
|
return (((val & 0xC0) << 10) | ((val & 0x30) << 4) | ((val & 0x0C) >> 2)) * 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t convertRGB888toRGBX2222(uint32_t val)
|
||||||
|
{
|
||||||
|
val &= 0xC0C0C0;
|
||||||
|
return (val >> 4) | (val >> 10) | (val >> 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t bilinearInterpolate888(uint32_t c00, uint32_t c10, uint32_t c01, uint32_t c11, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
assert(x < 16 && y < 16);
|
||||||
|
const uint16_t xy11 = x * y;
|
||||||
|
const uint16_t xy10 = 16 * x - xy11;
|
||||||
|
const uint16_t xy01 = 16 * y - xy11;
|
||||||
|
const uint16_t xy00 = 256 - (xy11 + xy10 + xy01);
|
||||||
|
|
||||||
|
return ((((c00 & 0xFF00FF) * xy00 + (c10 & 0xFF00FF) * xy10 + (c01 & 0xFF00FF) * xy01 + (c11 & 0xFF00FF) * xy11) >> 8) & 0xFF00FF) |
|
||||||
|
((((c00 & 0x00FF00) * xy00 + (c10 & 0x00FF00) * xy10 + (c01 & 0x00FF00) * xy01 + (c11 & 0x00FF00) * xy11) >> 8) & 0x00FF00);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return div255rb((val & 0xFF00FF) * factor) | div255g((val & 0x00FF00) * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint32_t div255_888_FFcheck(uint32_t val, uint8_t factor)
|
||||||
|
{
|
||||||
|
return factor < 0xFF ? div255_888(val, factor) : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_FUNCTION static uint8_t alphaBlend(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t alpha, const uint8_t fbr, const uint8_t fbg, const uint8_t fbb, const uint8_t ialpha)
|
||||||
|
{
|
||||||
|
return getNativeColorFromRGB(div255(r * alpha + fbr * ialpha), div255(g * alpha + fbg * ialpha), div255(b * alpha + fbb * ialpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawTextureMapScanLineBase8 : public DrawTextureMapScanLineBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckNearestNeighbor(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
FORCE_INLINE_FUNCTION bool overrunCheckBilinearInterpolation(uint8_t*& destBits, int& pixelsToDraw, fixed16_16& U, fixed16_16& V, fixed16_16 deltaU, fixed16_16 deltaV, const int16_t maxWidth, const int16_t maxHeight) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGBA2222_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGBA2222_Opaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGBA2222_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_RGBA2222_Opaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint8_t* const textureBits, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_ARGB8888_NonOpaque_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint32_t* const textureBits32, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_NearestNeighbor_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint8_t a4, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TextureMapper_A4_BilinearInterpolation_GA : public DrawTextureMapScanLineBase8
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void drawTextureMapScanLineSubdivisions(int subdivisions, const int widthModLength, int pixelsToDraw, const int affineLength, float oneOverZRight, float UOverZRight, float VOverZRight, fixed16_16 U, fixed16_16 V, fixed16_16 deltaU, fixed16_16 deltaV, float ULeft, float VLeft, float URight, float VRight, float ZRight, const DrawingSurface& dest, const int destX, const int destY, const TextureSurface& texture, uint8_t alpha, const float dOneOverZdXAff, const float dUOverZdXAff, const float dVOverZdXAff);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
void writePixelOnEdge(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac, const uint8_t alpha) const;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCD8BPP_RGBA2222_HPP
|
||||||
+890
@@ -0,0 +1,890 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/lcd/LCDDMA2D3_CMDList.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::LCDDMA2D3_CMDList class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_LCDDMA2D3_CMDLIST_HPP
|
||||||
|
#define TOUCHGFX_LCDDMA2D3_CMDLIST_HPP
|
||||||
|
|
||||||
|
#include <platform/driver/lcd/LCD16bpp.hpp>
|
||||||
|
#include <platform/driver/lcd/LCD24bpp.hpp>
|
||||||
|
#include <platform/driver/lcd/LCD32bpp.hpp>
|
||||||
|
#include <touchgfx/Bitmap.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/transforms/DisplayTransformation.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
struct GlyphNode;
|
||||||
|
|
||||||
|
namespace DMA2DV3
|
||||||
|
{
|
||||||
|
enum DMA2DV3_ColorMode
|
||||||
|
{
|
||||||
|
COLOR_MODE_ARGB8888 = 0x0,
|
||||||
|
COLOR_MODE_RGB888 = 0x1,
|
||||||
|
COLOR_MODE_RGB565 = 0x2,
|
||||||
|
COLOR_MODE_A8 = 0x9,
|
||||||
|
COLOR_MODE_A4 = 0xA,
|
||||||
|
COLOR_MODE_A2 = 0xC,
|
||||||
|
COLOR_MODE_A1 = 0xD,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Struct giving the format of an L8 image header. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const uint8_t format; ///< The format of the color palette (565/888/8888).
|
||||||
|
const uint8_t compression; ///< The compression used for the image.
|
||||||
|
const uint16_t size; ///< The number of colors in the palette.
|
||||||
|
const uint32_t data[1]; ///< First pixels.
|
||||||
|
} clutData_t;
|
||||||
|
|
||||||
|
void addFillRectCmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, uint32_t width, uint32_t height, colortype color, uint8_t alpha);
|
||||||
|
void addBlitCopyRGB565CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, uint32_t sourceStride, const Rect& blitRect, uint8_t alpha);
|
||||||
|
void addBlitCopyRGB888CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, uint32_t sourceStride, const Rect& blitRect, uint8_t alpha);
|
||||||
|
void addBlitCopyARGB8888CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, uint32_t sourceStride, const Rect& blitRect, uint8_t alpha);
|
||||||
|
void addBlitFitRGB565CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, const Rect& blitRect, uint32_t sourceWidth, uint32_t sourceHeight, const Rect& invalidatedArea, uint8_t alpha);
|
||||||
|
void addBlitFitRGB888CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, const Rect& blitRect, uint32_t sourceWidth, uint32_t sourceHeight, const Rect& invalidatedArea, uint8_t alpha);
|
||||||
|
void addBlitFitARGB8888CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, const Rect& blitRect, uint32_t sourceWidth, uint32_t sourceHeight, const Rect& invalidatedArea, uint8_t alpha);
|
||||||
|
void addBlitCopyL8CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, uint32_t sourceStride, const Rect& blitRect, Bitmap::ClutFormat clutFormat, uint8_t alpha);
|
||||||
|
void addBlitFitL8CmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, const Rect& blitRect, uint32_t sourceWidth, uint32_t sourceHeight, const Rect& invalidatedArea, Bitmap::ClutFormat clutFormat, uint8_t alpha);
|
||||||
|
void addBlitCopyGlyphCmdList(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, uint32_t sourceFormat, uint32_t sourceStride, uint32_t width, uint32_t height, int preSkip, int trailSkip, colortype color, uint8_t alpha);
|
||||||
|
void addBlitCopyGlyphCmdListRotatedDestination(uint8_t* const wbuf, uint32_t stride, uint32_t dst_format, const uint8_t* const sourceData, uint32_t sourceFormat, uint32_t glyphStride, uint32_t glyphWidth, uint32_t glyphHeight, int preSkip, int trailSkip, colortype color, uint8_t alpha);
|
||||||
|
void addLoadCLUTCmdList(const uint32_t* const clut, uint32_t entries, Bitmap::ClutFormat clutFormat);
|
||||||
|
} //namespace DMA2DV3
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
|
||||||
|
* rectangles in a 16/24/32 bit framebuffer using DMA2DV3 command lists.
|
||||||
|
*
|
||||||
|
* The LCD_TYPE template argument is the corresponding "normal" LCD class name:
|
||||||
|
* LCD16bpp, LCD24bpp, LCD32bpp.
|
||||||
|
* The FORMAT argument is values from DMA2DV3_ColorMode. Must be in the range [0:2].
|
||||||
|
* The BYTES_PR_PIXEL is 2/3/4 correspondingly.
|
||||||
|
*
|
||||||
|
* @see LCD
|
||||||
|
*
|
||||||
|
* @note All coordinates are expected to be in absolute coordinates!
|
||||||
|
*/
|
||||||
|
template <class LCD_TYPE, int FORMAT, int BYTES_PR_PIXEL>
|
||||||
|
class LCDDMA2D3_CMDList : public LCD_TYPE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Initializes members and super class. */
|
||||||
|
LCDDMA2D3_CMDList()
|
||||||
|
: LCD_TYPE(), clientFrameBuffer(0), clientFrameBufferWidth(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a filled rectangle in the framebuffer in the specified color and opacity. By
|
||||||
|
* default the rectangle will be drawn as a solid box. The rectangle can be drawn with
|
||||||
|
* transparency by specifying alpha from 0=invisible to 255=solid.
|
||||||
|
*
|
||||||
|
* @param rect The rectangle to draw in absolute display coordinates.
|
||||||
|
* @param color The rectangle color.
|
||||||
|
* @param alpha (Optional) The rectangle opacity, from 0=invisible to 255=solid.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void fillRect(const Rect& rect, colortype color, uint8_t alpha)
|
||||||
|
{
|
||||||
|
if (alpha == 0 || rect.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect transformedRect = rect;
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedRect);
|
||||||
|
|
||||||
|
uint8_t* wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (transformedRect.x + clientFrameBufferWidth * transformedRect.y);
|
||||||
|
|
||||||
|
if (FORMAT == DMA2DV3::COLOR_MODE_RGB565 && alpha == 255)
|
||||||
|
{
|
||||||
|
if ((clientFrameBufferWidth & 1) == 0 && (transformedRect.width & 1) == 0 && (reinterpret_cast<uintptr_t>(wbuf) & 3) == 0)
|
||||||
|
{
|
||||||
|
const uint16_t color16 = ((color >> 8) & 0xF800) | ((color >> 5) & 0x07E0) | ((color >> 3) & 0x001F);
|
||||||
|
// Use optimized fill
|
||||||
|
color = color16 << 16 | color16;
|
||||||
|
DMA2DV3::addFillRectCmdList(wbuf, clientFrameBufferWidth / 2, DMA2DV3::COLOR_MODE_ARGB8888, transformedRect.width / 2, transformedRect.height, color, alpha);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DMA2DV3::addFillRectCmdList(wbuf, clientFrameBufferWidth, FORMAT, transformedRect.width, transformedRect.height, color, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws all (or a part) of a \a bitmap. The coordinates of the corner of the bitmap is
|
||||||
|
* given in (\a x, \a y) and \a rect describes which part of the \a bitmap should be
|
||||||
|
* drawn. The bitmap can be drawn as it is or more or less transparent depending on the
|
||||||
|
* value of \a alpha. The value of \a alpha is independent of the transparency of the
|
||||||
|
* individual pixels of the given \a bitmap.
|
||||||
|
*
|
||||||
|
* @param bitmap The bitmap to draw.
|
||||||
|
* @param x The absolute x coordinate to place (0, 0) of the bitmap on the screen.
|
||||||
|
* @param y The absolute y coordinate to place (0, 0) of the bitmap on the screen.
|
||||||
|
* @param rect A rectangle describing what region of the bitmap is to be drawn.
|
||||||
|
* @param alpha (Optional) Alpha value ranging from 0=invisible to
|
||||||
|
* 255=solid. Default is 255 (solid).
|
||||||
|
* @param useOptimized (Optional) If false, do not attempt to substitute (parts of) this
|
||||||
|
* bitmap with faster fillrects.
|
||||||
|
*/
|
||||||
|
void drawPartialBitmap(const Bitmap& bitmap, int16_t x, int16_t y, const Rect& rect, uint8_t alpha = 255, bool useOptimized = true)
|
||||||
|
{
|
||||||
|
if (!alpha)
|
||||||
|
{
|
||||||
|
// nothing to draw - 100% transparent
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Rect source(x, y, bitmap.getWidth(), bitmap.getHeight());
|
||||||
|
const uint8_t* bitmapData = bitmap.getData();
|
||||||
|
switch (bitmap.getFormat())
|
||||||
|
{
|
||||||
|
case Bitmap::ARGB8888:
|
||||||
|
blitCopyARGB8888(bitmapData, source, rect, alpha);
|
||||||
|
break;
|
||||||
|
case Bitmap::RGB888:
|
||||||
|
blitCopyRGB888(bitmapData, source, rect, alpha);
|
||||||
|
break;
|
||||||
|
case Bitmap::L8:
|
||||||
|
blitCopyL8(bitmapData, bitmap.getExtraData(), source, rect, alpha);
|
||||||
|
break;
|
||||||
|
case Bitmap::RGB565:
|
||||||
|
if (bitmap.hasTransparentPixels())
|
||||||
|
{
|
||||||
|
assert(0 && "LCDDMA2D3_CMDList: RGB565 with transparent pixels are not supported!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
blitCopyRGB565(bitmapData, source, rect, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Bitmap::BW:
|
||||||
|
case Bitmap::BW_RLE:
|
||||||
|
case Bitmap::GRAY2:
|
||||||
|
case Bitmap::GRAY4:
|
||||||
|
case Bitmap::ABGR2222:
|
||||||
|
case Bitmap::ARGB2222:
|
||||||
|
case Bitmap::BGRA2222:
|
||||||
|
case Bitmap::RGBA2222:
|
||||||
|
case Bitmap::A4:
|
||||||
|
case Bitmap::CUSTOM:
|
||||||
|
assert(false && "LCDDMA2D3_CMDList: Unsupported bitmap format in LCDDMA2DV3::blitCopy!");
|
||||||
|
break;
|
||||||
|
case Bitmap::COMPRESSED_RGB565:
|
||||||
|
case Bitmap::COMPRESSED_RGB888:
|
||||||
|
case Bitmap::COMPRESSED_ARGB8888:
|
||||||
|
// Call super class for support for compressed images
|
||||||
|
LCD_TYPE::drawPartialBitmap(bitmap, x, y, rect, alpha, useOptimized);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws all (or a part) of a \a bitmap, scaled to fit desired rect.
|
||||||
|
*
|
||||||
|
* @param bitmap The bitmap to draw.
|
||||||
|
* @param blitRect The destination area to draw the bitmap in, in absolute coordinates.
|
||||||
|
* @param invalidatedArea The subarea of the destination area that should be redrawn, in
|
||||||
|
* relative coordinates to the destination area.
|
||||||
|
* @param renderVariant The rendering variant to use for the scaling operation.
|
||||||
|
* @param alpha Optional alpha value ranging from 0=invisible to 255=solid.
|
||||||
|
*/
|
||||||
|
void drawScaledBitmap(const Bitmap& bitmap, const Rect& blitRect, const Rect& invalidatedArea, RenderingVariant renderVariant, uint8_t alpha = 255)
|
||||||
|
{
|
||||||
|
// Use optimized scaling function in cases where it is faster.
|
||||||
|
// Otherwise, use fallback software implementation.
|
||||||
|
if (blitRect.width <= bitmap.getWidth() && blitRect.height <= bitmap.getHeight())
|
||||||
|
{
|
||||||
|
Rect transformedBlitRect = blitRect;
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedBlitRect);
|
||||||
|
Rect transformedInvalidatedArea = invalidatedArea;
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedInvalidatedArea, blitRect);
|
||||||
|
|
||||||
|
const uint32_t srcW = HAL::DISPLAY_ROTATION == rotate90 ? bitmap.getHeight() : bitmap.getWidth();
|
||||||
|
const uint32_t srcH = HAL::DISPLAY_ROTATION == rotate90 ? bitmap.getWidth() : bitmap.getHeight();
|
||||||
|
const uint8_t* sourceData = bitmap.getData();
|
||||||
|
uint8_t* dst = clientFrameBuffer + (transformedInvalidatedArea.x + transformedBlitRect.x + HAL::FRAME_BUFFER_WIDTH * (transformedBlitRect.y + transformedInvalidatedArea.y)) * BYTES_PR_PIXEL;
|
||||||
|
|
||||||
|
switch (renderVariant)
|
||||||
|
{
|
||||||
|
case (((int)Bitmap::RGB565 << RenderingVariant_FormatShift) | RenderingVariant_NoAlpha | RenderingVariant_NearestNeighbor):
|
||||||
|
DMA2DV3::addBlitFitRGB565CmdList((uint8_t*)dst, HAL::FRAME_BUFFER_WIDTH, FORMAT, sourceData, transformedBlitRect, srcW, srcH, transformedInvalidatedArea, alpha);
|
||||||
|
return;
|
||||||
|
case (((int)Bitmap::RGB888 << RenderingVariant_FormatShift) | RenderingVariant_NoAlpha | RenderingVariant_NearestNeighbor):
|
||||||
|
DMA2DV3::addBlitFitRGB888CmdList((uint8_t*)dst, HAL::FRAME_BUFFER_WIDTH, FORMAT, sourceData, transformedBlitRect, srcW, srcH, transformedInvalidatedArea, alpha);
|
||||||
|
return;
|
||||||
|
case (((int)Bitmap::ARGB8888 << RenderingVariant_FormatShift) | RenderingVariant_NoAlpha | RenderingVariant_NearestNeighbor):
|
||||||
|
case (((int)Bitmap::ARGB8888 << RenderingVariant_FormatShift) | RenderingVariant_Alpha | RenderingVariant_NearestNeighbor):
|
||||||
|
DMA2DV3::addBlitFitARGB8888CmdList((uint8_t*)dst, HAL::FRAME_BUFFER_WIDTH, FORMAT, sourceData, transformedBlitRect, srcW, srcH, transformedInvalidatedArea, alpha);
|
||||||
|
return;
|
||||||
|
case (((int)Bitmap::L8 << RenderingVariant_FormatShift) | RenderingVariant_NoAlpha | RenderingVariant_NearestNeighbor):
|
||||||
|
case (((int)Bitmap::L8 << RenderingVariant_FormatShift) | RenderingVariant_Alpha | RenderingVariant_NearestNeighbor):
|
||||||
|
{
|
||||||
|
const DMA2DV3::clutData_t* const palette = reinterpret_cast<const DMA2DV3::clutData_t*>(bitmap.getExtraData());
|
||||||
|
|
||||||
|
const Bitmap::Compression compressionAlgorithm = static_cast<Bitmap::Compression>(palette->compression);
|
||||||
|
|
||||||
|
if (compressionAlgorithm != Bitmap::COMPRESSION_L8_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load palette
|
||||||
|
DMA2DV3::addLoadCLUTCmdList(palette->data, palette->size, static_cast<Bitmap::ClutFormat>(palette->format));
|
||||||
|
|
||||||
|
// Draw Image
|
||||||
|
DMA2DV3::addBlitFitL8CmdList((uint8_t*)dst, HAL::FRAME_BUFFER_WIDTH, FORMAT, sourceData, transformedBlitRect, srcW, srcH, transformedInvalidatedArea, static_cast<Bitmap::ClutFormat>(palette->format), alpha);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LCD_TYPE::drawScaledBitmap(bitmap, blitRect, invalidatedArea, renderVariant, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits (directly copies) a block of data to the framebuffer, performing alpha blending
|
||||||
|
* as specified.
|
||||||
|
*
|
||||||
|
* @param sourceData The source array pointer (points to the beginning of the
|
||||||
|
* data). The sourceData must be stored in the same format as the framebuffer.
|
||||||
|
* @param source The position and dimensions of the source. The x and y of this
|
||||||
|
* rect should both be 0.
|
||||||
|
* @param blitRect A rectangle describing what region of the \a sourceData is to
|
||||||
|
* be copied to the framebuffer.
|
||||||
|
* @param alpha The alpha value to use for blending ranging from 0=invisible
|
||||||
|
* to 255=solid=no blending.
|
||||||
|
*/
|
||||||
|
void blitCopy(const uint16_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha, bool /* hasTransparentPixels */)
|
||||||
|
{
|
||||||
|
if (!alpha)
|
||||||
|
{
|
||||||
|
// nothing to draw - 100% transparent
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (FORMAT)
|
||||||
|
{
|
||||||
|
case DMA2DV3::COLOR_MODE_ARGB8888:
|
||||||
|
blitCopyARGB8888(reinterpret_cast<const uint8_t*>(sourceData), source, blitRect, alpha);
|
||||||
|
break;
|
||||||
|
case DMA2DV3::COLOR_MODE_RGB888:
|
||||||
|
blitCopyRGB888(reinterpret_cast<const uint8_t*>(sourceData), source, blitRect, alpha);
|
||||||
|
break;
|
||||||
|
case DMA2DV3::COLOR_MODE_RGB565:
|
||||||
|
blitCopyRGB565(reinterpret_cast<const uint8_t*>(sourceData), source, blitRect, alpha);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blits (directly copies) a block of data to the framebuffer, performing alpha blending
|
||||||
|
* as specified.
|
||||||
|
*
|
||||||
|
* If the display does not support the specified sourceFormat, an assert will be
|
||||||
|
* raised.
|
||||||
|
*
|
||||||
|
* @param sourceData The source array pointer (points to the beginning of the
|
||||||
|
* data). The sourceData must be stored in a format
|
||||||
|
* suitable for the selected display.
|
||||||
|
* @param sourceFormat The bitmap format used in the source data.
|
||||||
|
* @param source The position and dimensions of the source. The x and y of this
|
||||||
|
* rect should both be 0.
|
||||||
|
* @param blitRect A rectangle describing what region of the sourceData is to
|
||||||
|
* be copied to the framebuffer.
|
||||||
|
* @param alpha The alpha value to use for blending ranging from 0=invisible
|
||||||
|
* to 255=solid=no blending.
|
||||||
|
*/
|
||||||
|
void blitCopy(const uint8_t* sourceData, Bitmap::BitmapFormat sourceFormat, const Rect& source, const Rect& blitRect, uint8_t alpha, bool /* hasTransparentPixels */)
|
||||||
|
{
|
||||||
|
switch (sourceFormat)
|
||||||
|
{
|
||||||
|
case Bitmap::RGB565:
|
||||||
|
blitCopyRGB565(sourceData, source, blitRect, alpha);
|
||||||
|
break;
|
||||||
|
case Bitmap::ARGB8888:
|
||||||
|
blitCopyARGB8888(sourceData, source, blitRect, alpha);
|
||||||
|
break;
|
||||||
|
case Bitmap::RGB888:
|
||||||
|
blitCopyRGB888(sourceData, source, blitRect, alpha);
|
||||||
|
break;
|
||||||
|
case Bitmap::GRAY2:
|
||||||
|
case Bitmap::GRAY4:
|
||||||
|
case Bitmap::BW:
|
||||||
|
case Bitmap::BW_RLE:
|
||||||
|
case Bitmap::ARGB2222:
|
||||||
|
case Bitmap::ABGR2222:
|
||||||
|
case Bitmap::RGBA2222:
|
||||||
|
case Bitmap::BGRA2222:
|
||||||
|
case Bitmap::L8:
|
||||||
|
case Bitmap::A4:
|
||||||
|
case Bitmap::CUSTOM:
|
||||||
|
case Bitmap::COMPRESSED_RGB565:
|
||||||
|
case Bitmap::COMPRESSED_RGB888:
|
||||||
|
case Bitmap::COMPRESSED_ARGB8888:
|
||||||
|
assert(false && "LCDDMA2D3_CMDList: Unsupported bitmap format in LCD16::blitCopy!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private version of draw-glyph with explicit destination buffer pointer argument. For
|
||||||
|
* all parameters (except the buffer pointer) see the public function drawString().
|
||||||
|
*
|
||||||
|
* @param [out] wbuf16 The destination (frame) buffer to draw to.
|
||||||
|
* @param widgetArea The canvas to draw the glyph inside.
|
||||||
|
* @param x Horizontal offset to start drawing the glyph.
|
||||||
|
* @param y Vertical offset to start drawing the glyph.
|
||||||
|
* @param offsetX Horizontal offset in the glyph to start drawing from.
|
||||||
|
* @param offsetY Vertical offset in the glyph to start drawing from.
|
||||||
|
* @param invalidatedArea The area to draw inside.
|
||||||
|
* @param glyph Specifications of the glyph to draw.
|
||||||
|
* @param glyphData Data containing the actual glyph (dense format)
|
||||||
|
* @param byteAlignRow Each row of glyph data starts in a new byte.
|
||||||
|
* @param color The color of the glyph.
|
||||||
|
* @param bitsPerPixel Bit depth of the glyph.
|
||||||
|
* @param alpha The transparency of the glyph.
|
||||||
|
* @param rotation Rotation to do before drawing the glyph.
|
||||||
|
*/
|
||||||
|
void drawGlyph(uint16_t* wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect& invalidatedArea, const GlyphNode* glyph, const uint8_t* glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation)
|
||||||
|
{
|
||||||
|
// Rotated text uses implementation in super class
|
||||||
|
if (rotation != TEXT_ROTATE_0)
|
||||||
|
{
|
||||||
|
LCD_TYPE::drawGlyph(wbuf16, widgetArea, x, y, offsetX, offsetY, invalidatedArea, glyph, glyphData, byteAlignRow, color, bitsPerPixel, alpha, rotation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int glyph_width = (int)glyph->width();
|
||||||
|
const int glyph_height = (int)glyph->height();
|
||||||
|
|
||||||
|
if (!glyph_width || !glyph_height)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offsetX)
|
||||||
|
{
|
||||||
|
offsetX -= glyph->left;
|
||||||
|
if ((int16_t)offsetX < 0)
|
||||||
|
{
|
||||||
|
// Account for special case where glyph starts before 0, causing offsetX to become negative.
|
||||||
|
x -= offsetX;
|
||||||
|
offsetX = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += glyph->left;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invalidatedArea.x > x)
|
||||||
|
{
|
||||||
|
offsetX += invalidatedArea.x - x;
|
||||||
|
x = invalidatedArea.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!byteAlignRow && bitsPerPixel != 8)
|
||||||
|
{
|
||||||
|
assert(0 && "LCDDMA2D3_CMDList::drawGlyph only supports byteAligned font formats!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int16_t maxX = invalidatedArea.right();
|
||||||
|
const int16_t maxY = invalidatedArea.bottom();
|
||||||
|
|
||||||
|
// Calculate display coordinates
|
||||||
|
int16_t real_x = widgetArea.x + x;
|
||||||
|
int16_t real_y = widgetArea.y + y;
|
||||||
|
|
||||||
|
const bool rotatedDisplay = HAL::DISPLAY_ROTATION == rotate90;
|
||||||
|
if (rotatedDisplay)
|
||||||
|
{
|
||||||
|
const int glyphHeightToDraw = MIN(glyph_height - offsetY, maxY - y); // width or columns in fb!
|
||||||
|
if (glyphHeightToDraw <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(real_x, real_y);
|
||||||
|
|
||||||
|
switch (bitsPerPixel)
|
||||||
|
{
|
||||||
|
case 8:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = glyph_width;
|
||||||
|
const int glyphColumns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (glyphColumns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * (real_y - (glyphColumns - 1)));
|
||||||
|
const uint8_t* const srcData = glyphData + glyph_stride * offsetY + offsetX;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdListRotatedDestination(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A8, glyph_stride, glyphColumns, glyphHeightToDraw, 0, 0, color, alpha);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = ((glyph_width + 1) & ~1);
|
||||||
|
|
||||||
|
// Whole width of letter? Fast path
|
||||||
|
if ((offsetX == 0) && (maxX >= x + glyph_stride))
|
||||||
|
{
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * (real_y - (glyph_stride - 1)));
|
||||||
|
const uint8_t* srcData = glyphData + (glyph_stride / 2) * offsetY;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdListRotatedDestination(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A4, glyph_stride, glyph_stride, glyphHeightToDraw, 0, 0, color, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Even start and end?
|
||||||
|
const int glyphColumns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (glyphColumns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * (real_y - (glyphColumns - 1)));
|
||||||
|
const uint8_t* const srcData = glyphData + (glyph_stride / 2) * offsetY + offsetX / 2;
|
||||||
|
const int preSkip = offsetX & 1;
|
||||||
|
const int colsInLastByte = (offsetX + glyphColumns) & 1;
|
||||||
|
const int trailSkip = (colsInLastByte > 0) ? 2 - colsInLastByte : 0; // Skip on trail if last column is not 2*N
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdListRotatedDestination(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A4, glyph_stride, glyphColumns, glyphHeightToDraw, preSkip, trailSkip, color, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = ((glyph_width + 3) & ~3);
|
||||||
|
|
||||||
|
// Whole width of letter? Fast path
|
||||||
|
if ((offsetX == 0) && (maxX >= x + glyph_stride))
|
||||||
|
{
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * (real_y - (glyph_stride - 1)));
|
||||||
|
const uint8_t* srcData = glyphData + (glyph_stride / 4) * offsetY;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdListRotatedDestination(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A2, glyph_stride, glyph_stride, glyphHeightToDraw, 0, 0, color, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Even start and end?
|
||||||
|
const int glyphColumns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (glyphColumns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * (real_y - (glyphColumns - 1)));
|
||||||
|
const uint8_t* const srcData = glyphData + (glyph_stride / 4) * offsetY + offsetX / 4;
|
||||||
|
const int preSkip = offsetX & 3;
|
||||||
|
const int colsInLastByte = (offsetX + glyphColumns) & 3;
|
||||||
|
const int trailSkip = (colsInLastByte > 0) ? 4 - colsInLastByte : 0; // Skip on trail if last column is not 4*N
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdListRotatedDestination(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A2, glyph_stride, glyphColumns, glyphHeightToDraw, preSkip, trailSkip, color, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = ((glyph_width + 7) & ~7);
|
||||||
|
|
||||||
|
// Whole width of letter? Fast path
|
||||||
|
if ((offsetX == 0) && (maxX >= x + glyph_stride))
|
||||||
|
{
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * (real_y - (glyph_stride - 1)));
|
||||||
|
const uint8_t* srcData = glyphData + (glyph_stride / 8) * offsetY;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdListRotatedDestination(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A1, glyph_stride, glyph_stride, glyphHeightToDraw, 0, 0, color, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Even start and end?
|
||||||
|
const int glyphColumns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (glyphColumns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * (real_y - (glyphColumns - 1)));
|
||||||
|
const uint8_t* const srcData = glyphData + (glyph_stride / 8) * offsetY + offsetX / 8;
|
||||||
|
const int preSkip = offsetX & 7;
|
||||||
|
const int colsInLastByte = (offsetX + glyphColumns) & 7;
|
||||||
|
const int trailSkip = (colsInLastByte > 0) ? 8 - colsInLastByte : 0; // Skip on trail if last column is not 8*N
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdListRotatedDestination(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A1, glyph_stride, glyphColumns, glyphHeightToDraw, preSkip, trailSkip, color, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* !rotatedDisplay */
|
||||||
|
{
|
||||||
|
uint8_t* const wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (real_x + clientFrameBufferWidth * real_y);
|
||||||
|
const int glyphLinesToDraw = MIN(glyph_height - offsetY, maxY - y);
|
||||||
|
if (glyphLinesToDraw <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (bitsPerPixel)
|
||||||
|
{
|
||||||
|
case 8:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = glyph_width;
|
||||||
|
const int columns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (columns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uint8_t* const srcData = glyphData + glyph_stride * offsetY + offsetX;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdList(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A8, glyph_stride, columns, glyphLinesToDraw, 0, 0, color, alpha);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = ((glyph_width + 1) & ~1);
|
||||||
|
// Whole letter? Fast path
|
||||||
|
if ((offsetX == 0) && (maxX >= x + glyph_width))
|
||||||
|
{
|
||||||
|
const uint8_t* srcData = glyphData + (glyph_stride / 2) * offsetY;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdList(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A4, glyph_stride, glyph_stride, glyphLinesToDraw, 0, 0, color, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Even start and end?
|
||||||
|
const int columns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (columns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uint8_t* const srcData = glyphData + (glyph_stride / 2) * offsetY + offsetX / 2;
|
||||||
|
const int preSkip = offsetX & 1;
|
||||||
|
const int colsInLastByte = (offsetX + columns) & 1;
|
||||||
|
const int trailSkip = (colsInLastByte > 0) ? 2 - colsInLastByte : 0; // Skip on trail if last column is not 2*N
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdList(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A4, glyph_stride, columns, glyphLinesToDraw, preSkip, trailSkip, color, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = ((glyph_width + 3) & ~3);
|
||||||
|
// Whole letter? Fast path
|
||||||
|
if ((offsetX == 0) && (maxX >= x + glyph_width))
|
||||||
|
{
|
||||||
|
const uint8_t* srcData = glyphData + (glyph_stride / 4) * offsetY;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdList(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A2, glyph_stride, glyph_stride, glyphLinesToDraw, 0, 0, color, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Even start and end?
|
||||||
|
const int columns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (columns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uint8_t* const srcData = glyphData + (glyph_stride / 4) * offsetY + offsetX / 4;
|
||||||
|
const int preSkip = offsetX & 0x3;
|
||||||
|
const int colsInLastByte = (offsetX + columns) & 3;
|
||||||
|
const int trailSkip = (colsInLastByte > 0) ? 4 - colsInLastByte : 0; // Skip on trail if last column is not 4*N
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdList(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A2, glyph_stride, columns, glyphLinesToDraw, preSkip, trailSkip, color, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
const uint16_t glyph_stride = ((glyph_width + 7) & ~7);
|
||||||
|
// Whole letter? Fast path
|
||||||
|
if ((offsetX == 0) && (maxX >= x + glyph_width))
|
||||||
|
{
|
||||||
|
const uint8_t* srcData = glyphData + (glyph_stride / 8) * offsetY;
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdList(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A1, glyph_stride, glyph_stride, glyphLinesToDraw, 0, 0, color, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Even start and end?
|
||||||
|
const int columns = MIN(glyph_width, maxX - (x - offsetX)) - offsetX;
|
||||||
|
if (columns == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uint8_t* const srcData = glyphData + (glyph_stride / 8) * offsetY + offsetX / 8;
|
||||||
|
const int preSkip = offsetX & 0x7;
|
||||||
|
const int colsInLastByte = (offsetX + columns) & 7;
|
||||||
|
const int trailSkip = (colsInLastByte > 0) ? 8 - colsInLastByte : 0; // Skip on trail if last column is not 8*N
|
||||||
|
DMA2DV3::addBlitCopyGlyphCmdList(wbuf, clientFrameBufferWidth, FORMAT, srcData, DMA2DV3::COLOR_MODE_A1, glyph_stride, columns, glyphLinesToDraw, preSkip, trailSkip, color, alpha);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies part of the framebuffer to the data section of a bitmap. The bitmap must be a
|
||||||
|
* dynamic bitmap or animation storage (BITMAP_ANIMATION_STORAGE). The two regions given
|
||||||
|
* are the visible region and the absolute region on screen. This is used to copy only a
|
||||||
|
* part of the framebuffer. This might be the case if a SnapshotWidget is placed inside
|
||||||
|
* a Container where parts of the SnapshowWidget is outside the area defined by the
|
||||||
|
* Container. The visible region must be completely inside the absolute region.
|
||||||
|
*
|
||||||
|
* @param visRegion The visible region.
|
||||||
|
* @param absRegion The absolute region.
|
||||||
|
* @param bitmapId Identifier for the bitmap.
|
||||||
|
*
|
||||||
|
* @return Null if it fails, else a pointer to the data in the given bitmap.
|
||||||
|
*
|
||||||
|
* @see blitCopy, copyFrameBufferRegionToMemory(const Rect&, const Rect&, uint8_t*, int16_t, int16_t)
|
||||||
|
*
|
||||||
|
* @note There is only one instance of animation storage. The content of the bitmap data
|
||||||
|
* /animation storage outside the given region is left untouched.
|
||||||
|
*/
|
||||||
|
uint16_t* copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, const BitmapId bitmapId)
|
||||||
|
{
|
||||||
|
assert((HAL::getInstance()->getFrameRefreshStrategy() != HAL::REFRESH_STRATEGY_PARTIAL_FRAMEBUFFER) && "Copy framebuffer region to memory is not supported in Partial Framebuffer mode!");
|
||||||
|
const Bitmap bmp(bitmapId);
|
||||||
|
assert((bmp.getFormat() == LCD_TYPE::framebufferFormat()) && "The given bitmap has an invalid format");
|
||||||
|
uint8_t* bmp_data = const_cast<uint8_t*>(bmp.getData());
|
||||||
|
assert((bmp_data != 0) && "No memory allocated for the given Bitmap");
|
||||||
|
copyFrameBufferRegionToMemory(visRegion, absRegion, bmp_data, bmp.getWidth(), bmp.getHeight());
|
||||||
|
return (uint16_t*)bmp_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies part of the framebuffer to memory. The memory is assumed to have the same format as
|
||||||
|
* the framebuffer. The two regions given are the visible region and the absolute region on
|
||||||
|
* screen. This is used to copy only a part of the framebuffer. This might be the case if a
|
||||||
|
* SnapshotWidget is placed inside a Container where parts of the SnapshowWidget is outside the
|
||||||
|
* area defined by the Container. The visible region must be completely inside the absolute
|
||||||
|
* region.
|
||||||
|
*
|
||||||
|
* @param visRegion The visible region.
|
||||||
|
* @param absRegion The absolute region.
|
||||||
|
* @param [in,out] dst Destination memory in same format as the framebuffer.
|
||||||
|
* @param dstWidth Width of the destination.
|
||||||
|
* @param dstHeight Height of the destination.
|
||||||
|
*
|
||||||
|
* @return The rect that was actually copied to the destination buffer.
|
||||||
|
*
|
||||||
|
* @see blitCopy, copyFrameBufferRegionToMemory(const Rect&, const Rect&, const BitmapId)
|
||||||
|
*
|
||||||
|
* @note There is only one instance of animation storage. The content of the bitmap data
|
||||||
|
* /animation storage outside the given region is left untouched.
|
||||||
|
*/
|
||||||
|
Rect copyFrameBufferRegionToMemory(const Rect& visRegion, const Rect& absRegion, uint8_t* dst, int16_t dstWidth, int16_t dstHeight)
|
||||||
|
{
|
||||||
|
assert((HAL::getInstance()->getFrameRefreshStrategy() != HAL::REFRESH_STRATEGY_PARTIAL_FRAMEBUFFER) && "Copy framebuffer region to memory is not supported in Partial Framebuffer mode!");
|
||||||
|
assert((dst != (void*)0) && "A correct destination memory pointer must be provided!");
|
||||||
|
// Get the rectangle inside visRegion, absRegion and the bitmap region. Also limit to the display
|
||||||
|
Rect srcRect(absRegion.x, absRegion.y, dstWidth, dstHeight); // Bitmap position on display
|
||||||
|
srcRect &= absRegion;
|
||||||
|
srcRect &= visRegion;
|
||||||
|
srcRect.restrictTo(HAL::DISPLAY_WIDTH, HAL::DISPLAY_HEIGHT); // Limit to frame buffer
|
||||||
|
if (srcRect.isEmpty())
|
||||||
|
{
|
||||||
|
return Rect();
|
||||||
|
}
|
||||||
|
// The solidRect inside the bitmap is relative to the absRegion
|
||||||
|
Rect solidRect(srcRect);
|
||||||
|
solidRect.x -= absRegion.x;
|
||||||
|
solidRect.y -= absRegion.y;
|
||||||
|
// Transform the solidRect to framebuffer coordinated. This is the area that must be copied to the destination
|
||||||
|
Rect dstRect(solidRect);
|
||||||
|
Rect bitmapRect(0, 0, dstWidth, dstHeight);
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(dstRect, bitmapRect);
|
||||||
|
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(srcRect); // Get the rect in the frame buffer
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(bitmapRect); // Only used for correct width and height
|
||||||
|
|
||||||
|
const int16_t dstStride = bitmapRect.width; // Pixels
|
||||||
|
const int srcStride = LCD_TYPE::framebufferStride(); // Bytes
|
||||||
|
|
||||||
|
dst = dst + BYTES_PR_PIXEL * (dstRect.x + dstRect.y * dstStride);
|
||||||
|
uint8_t* src = reinterpret_cast<uint8_t*>(HAL::getInstance()->getTFTFrameBuffer()) + BYTES_PR_PIXEL * srcRect.x + srcRect.y * srcStride;
|
||||||
|
|
||||||
|
switch (FORMAT)
|
||||||
|
{
|
||||||
|
case DMA2DV3::COLOR_MODE_ARGB8888:
|
||||||
|
DMA2DV3::addBlitCopyARGB8888CmdList(dst, dstStride, FORMAT, src, clientFrameBufferWidth, srcRect, 255);
|
||||||
|
break;
|
||||||
|
case DMA2DV3::COLOR_MODE_RGB888:
|
||||||
|
DMA2DV3::addBlitCopyRGB888CmdList(dst, dstStride, FORMAT, src, clientFrameBufferWidth, srcRect, 255);
|
||||||
|
break;
|
||||||
|
case DMA2DV3::COLOR_MODE_RGB565:
|
||||||
|
DMA2DV3::addBlitCopyRGB565CmdList(dst, dstStride, FORMAT, src, clientFrameBufferWidth, srcRect, 255);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return solidRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies part of the displayed framebuffer to current framebuffer.
|
||||||
|
* The region given is the absolute region on screen.
|
||||||
|
*
|
||||||
|
* @param region A rectangle describing what region of the displayed framebuffer
|
||||||
|
* is to be copied to the framebuffer.
|
||||||
|
*
|
||||||
|
* @note The copy is performed only when double buffering is enabled. Otherwise the given
|
||||||
|
* region in current framebuffer is left untouched.
|
||||||
|
*/
|
||||||
|
void copyAreaFromTFTToClientBuffer(const Rect& region)
|
||||||
|
{
|
||||||
|
Rect transformedSource;
|
||||||
|
transformedSource.x = 0;
|
||||||
|
transformedSource.y = 0;
|
||||||
|
transformedSource.width = HAL::DISPLAY_ROTATION == rotate0 ? HAL::FRAME_BUFFER_WIDTH : HAL::FRAME_BUFFER_HEIGHT;
|
||||||
|
transformedSource.height = HAL::DISPLAY_ROTATION == rotate0 ? HAL::FRAME_BUFFER_HEIGHT : HAL::FRAME_BUFFER_WIDTH;
|
||||||
|
Rect transformedBlitRect = region;
|
||||||
|
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedBlitRect, transformedSource);
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedSource);
|
||||||
|
|
||||||
|
// Transform to absolute coordinates
|
||||||
|
transformedBlitRect.x += transformedSource.x;
|
||||||
|
transformedBlitRect.y += transformedSource.y;
|
||||||
|
|
||||||
|
uint8_t* dst = clientFrameBuffer + BYTES_PR_PIXEL * (transformedBlitRect.x + clientFrameBufferWidth * transformedBlitRect.y);
|
||||||
|
uint8_t* src = reinterpret_cast<uint8_t*>(HAL::getInstance()->getTFTFrameBuffer()) + (dst - clientFrameBuffer);
|
||||||
|
|
||||||
|
switch (FORMAT)
|
||||||
|
{
|
||||||
|
case DMA2DV3::COLOR_MODE_ARGB8888:
|
||||||
|
DMA2DV3::addBlitCopyARGB8888CmdList((uint8_t*)dst, clientFrameBufferWidth, FORMAT, src, clientFrameBufferWidth, transformedBlitRect, 255);
|
||||||
|
break;
|
||||||
|
case DMA2DV3::COLOR_MODE_RGB888:
|
||||||
|
DMA2DV3::addBlitCopyRGB888CmdList((uint8_t*)dst, clientFrameBufferWidth, FORMAT, src, clientFrameBufferWidth, transformedBlitRect, 255);
|
||||||
|
break;
|
||||||
|
case DMA2DV3::COLOR_MODE_RGB565:
|
||||||
|
DMA2DV3::addBlitCopyRGB565CmdList((uint8_t*)dst, clientFrameBufferWidth, FORMAT, src, clientFrameBufferWidth, transformedBlitRect, 255);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current framebuffer address and width.
|
||||||
|
*
|
||||||
|
* @param buffer Address of the framebuffer.
|
||||||
|
* @param width Width of the framebuffer in pixels.
|
||||||
|
*/
|
||||||
|
void setFrameBuffer(uint8_t* const buffer, uint32_t width)
|
||||||
|
{
|
||||||
|
clientFrameBuffer = buffer;
|
||||||
|
clientFrameBufferWidth = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t* clientFrameBuffer; // Address
|
||||||
|
uint32_t clientFrameBufferWidth; // Pixels
|
||||||
|
|
||||||
|
void blitCopyARGB8888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha)
|
||||||
|
{
|
||||||
|
Rect transformedSource = source;
|
||||||
|
Rect transformedBlitRect = blitRect;
|
||||||
|
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedSource);
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedBlitRect, source);
|
||||||
|
|
||||||
|
// Move to blit rect in source data
|
||||||
|
sourceData += (transformedBlitRect.x + transformedSource.width * transformedBlitRect.y) * 4;
|
||||||
|
|
||||||
|
// Transform to absolute coordinates
|
||||||
|
transformedBlitRect.x += transformedSource.x;
|
||||||
|
transformedBlitRect.y += transformedSource.y;
|
||||||
|
|
||||||
|
uint8_t* wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (transformedBlitRect.x + clientFrameBufferWidth * transformedBlitRect.y);
|
||||||
|
DMA2DV3::addBlitCopyARGB8888CmdList(wbuf, clientFrameBufferWidth, FORMAT, sourceData, transformedSource.width, transformedBlitRect, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
void blitCopyRGB888(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha)
|
||||||
|
{
|
||||||
|
Rect transformedSource = source;
|
||||||
|
Rect transformedBlitRect = blitRect;
|
||||||
|
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedSource);
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedBlitRect, source);
|
||||||
|
|
||||||
|
// Move to blit rect in source data
|
||||||
|
sourceData += (transformedBlitRect.x + transformedSource.width * transformedBlitRect.y) * 3;
|
||||||
|
|
||||||
|
// Transform to absolute coordinates
|
||||||
|
transformedBlitRect.x += transformedSource.x;
|
||||||
|
transformedBlitRect.y += transformedSource.y;
|
||||||
|
|
||||||
|
uint8_t* wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (transformedBlitRect.x + clientFrameBufferWidth * transformedBlitRect.y);
|
||||||
|
DMA2DV3::addBlitCopyRGB888CmdList(wbuf, clientFrameBufferWidth, FORMAT, sourceData, transformedSource.width, transformedBlitRect, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
void blitCopyRGB565(const uint8_t* sourceData, const Rect& source, const Rect& blitRect, uint8_t alpha)
|
||||||
|
{
|
||||||
|
Rect transformedSource = source;
|
||||||
|
Rect transformedBlitRect = blitRect;
|
||||||
|
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedSource);
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedBlitRect, source);
|
||||||
|
|
||||||
|
// Move to blit rect in source data
|
||||||
|
sourceData += (transformedBlitRect.x + transformedSource.width * transformedBlitRect.y) * 2;
|
||||||
|
|
||||||
|
// Transform to absolute coordinates
|
||||||
|
transformedBlitRect.x += transformedSource.x;
|
||||||
|
transformedBlitRect.y += transformedSource.y;
|
||||||
|
|
||||||
|
uint8_t* wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (transformedBlitRect.x + clientFrameBufferWidth * transformedBlitRect.y);
|
||||||
|
DMA2DV3::addBlitCopyRGB565CmdList(wbuf, clientFrameBufferWidth, FORMAT, sourceData, transformedSource.width, transformedBlitRect, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha)
|
||||||
|
{
|
||||||
|
if (!alpha)
|
||||||
|
{
|
||||||
|
// nothing to draw - 100% transparent
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DMA2DV3::clutData_t* const palette = reinterpret_cast<const DMA2DV3::clutData_t*>(clutData);
|
||||||
|
|
||||||
|
const Bitmap::Compression compressionAlgorithm = static_cast<Bitmap::Compression>(palette->compression);
|
||||||
|
|
||||||
|
if (compressionAlgorithm != Bitmap::COMPRESSION_L8_NONE)
|
||||||
|
{
|
||||||
|
LCD_TYPE::blitCopyL8(sourceData, clutData, source, blitRect, alpha);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load palette
|
||||||
|
DMA2DV3::addLoadCLUTCmdList(palette->data, palette->size, static_cast<Bitmap::ClutFormat>(palette->format));
|
||||||
|
|
||||||
|
// Draw image
|
||||||
|
Rect transformedSource = source;
|
||||||
|
Rect transformedBlitRect = blitRect;
|
||||||
|
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedSource);
|
||||||
|
DisplayTransformation::transformDisplayToFrameBuffer(transformedBlitRect, source);
|
||||||
|
|
||||||
|
// Move to blit rect in source data
|
||||||
|
sourceData += transformedBlitRect.x + transformedSource.width * transformedBlitRect.y;
|
||||||
|
|
||||||
|
// Transform to absolute coordinates
|
||||||
|
transformedBlitRect.x += transformedSource.x;
|
||||||
|
transformedBlitRect.y += transformedSource.y;
|
||||||
|
|
||||||
|
uint8_t* wbuf = clientFrameBuffer + BYTES_PR_PIXEL * (transformedBlitRect.x + clientFrameBufferWidth * transformedBlitRect.y);
|
||||||
|
DMA2DV3::addBlitCopyL8CmdList(wbuf, clientFrameBufferWidth, FORMAT, sourceData, transformedSource.width, transformedBlitRect, static_cast<Bitmap::ClutFormat>(palette->format), alpha);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef LCDDMA2D3_CMDList<LCD16bpp, DMA2DV3::COLOR_MODE_RGB565, 2> LCDDMA2D3_CMDList_16bpp; ///< Short name for LCDDMA2D3_CMDList on RGB565 framebuffer.
|
||||||
|
typedef LCDDMA2D3_CMDList<LCD24bpp, DMA2DV3::COLOR_MODE_RGB888, 3> LCDDMA2D3_CMDList_24bpp; ///< Short name for LCDDMA2D3_CMDList on RGB565 framebuffer.
|
||||||
|
typedef LCDDMA2D3_CMDList<LCD32bpp, DMA2DV3::COLOR_MODE_ARGB8888, 4> LCDDMA2D3_CMDList_32bpp; ///< Short name for LCDDMA2D3_CMDList on RGB565 framebuffer.
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_LCDDMA2D3_CMDLIST_HPP
|
||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/touch/I2CTouchController.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::I2CTouchController interface class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_I2CTOUCHCONTROLLER_HPP
|
||||||
|
#define TOUCHGFX_I2CTOUCHCONTROLLER_HPP
|
||||||
|
|
||||||
|
#include <platform/driver/i2c/I2C.hpp>
|
||||||
|
#include <platform/driver/touch/TouchController.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Specific I2C-enabled type of Touch Controller.
|
||||||
|
*
|
||||||
|
* @see TouchController
|
||||||
|
*/
|
||||||
|
class I2CTouchController : public TouchController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor. Initializes I2C driver.
|
||||||
|
*
|
||||||
|
* @param [in] i2c I2C driver.
|
||||||
|
*/
|
||||||
|
I2CTouchController(I2C& i2c)
|
||||||
|
: i2c(i2c)
|
||||||
|
{
|
||||||
|
i2c.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~I2CTouchController()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void init() = 0;
|
||||||
|
|
||||||
|
virtual bool sampleTouch(int32_t& x, int32_t& y) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
I2C& i2c; ///< I2C driver
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_I2CTOUCHCONTROLLER_HPP
|
||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/touch/NoTouchController.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::NoTouchController class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_NOTOUCHCONTROLLER_HPP
|
||||||
|
#define TOUCHGFX_NOTOUCHCONTROLLER_HPP
|
||||||
|
|
||||||
|
#include <platform/driver/touch/TouchController.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Empty TouchController implementation which does nothing. Use this if your display does not
|
||||||
|
* have touch input capabilities.
|
||||||
|
*/
|
||||||
|
class NoTouchController : public TouchController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool sampleTouch(int32_t& x, int32_t& y)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_NOTOUCHCONTROLLER_HPP
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/touch/SDL2TouchController.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::SDL2TouchController class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_SDL2TOUCHCONTROLLER_HPP
|
||||||
|
#define TOUCHGFX_SDL2TOUCHCONTROLLER_HPP
|
||||||
|
|
||||||
|
#include <platform/driver/touch/TouchController.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* TouchController for the simulator.
|
||||||
|
*
|
||||||
|
* @see TouchController
|
||||||
|
*/
|
||||||
|
class SDL2TouchController : public TouchController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
|
||||||
|
virtual bool sampleTouch(int32_t& x, int32_t& y);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_SDL2TOUCHCONTROLLER_HPP
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/touch/SDLTouchController.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::SDLTouchController class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_SDLTOUCHCONTROLLER_HPP
|
||||||
|
#define TOUCHGFX_SDLTOUCHCONTROLLER_HPP
|
||||||
|
|
||||||
|
#include <platform/driver/touch/TouchController.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* TouchController for the simulator.
|
||||||
|
*
|
||||||
|
* @see TouchController
|
||||||
|
*
|
||||||
|
* @deprecated Use SDL2TouchController
|
||||||
|
*/
|
||||||
|
class SDLTouchController : public TouchController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
|
||||||
|
virtual bool sampleTouch(int32_t& x, int32_t& y);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_SDLTOUCHCONTROLLER_HPP
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/driver/touch/TouchController.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::TouchController interface class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_TOUCHCONTROLLER_HPP
|
||||||
|
#define TOUCHGFX_TOUCHCONTROLLER_HPP
|
||||||
|
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/** Basic Touch Controller interface. */
|
||||||
|
class TouchController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Finalizes an instance of the TouchController class. */
|
||||||
|
virtual ~TouchController()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes touch controller. */
|
||||||
|
virtual void init() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the touch screen is being touched, and if so, what coordinates.
|
||||||
|
*
|
||||||
|
* @param [out] x The x position of the touch.
|
||||||
|
* @param [out] y The y position of the touch.
|
||||||
|
*
|
||||||
|
* @return True if a touch has been detected, otherwise false.
|
||||||
|
*/
|
||||||
|
virtual bool sampleTouch(int32_t& x, int32_t& y) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_TOUCHCONTROLLER_HPP
|
||||||
+512
@@ -0,0 +1,512 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2018(-2026) STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of the TouchGFX 4.26.1 distribution.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file platform/hal/simulator/sdl2/HALSDL2.hpp
|
||||||
|
*
|
||||||
|
* Declares the touchgfx::HALSDL2 class.
|
||||||
|
*/
|
||||||
|
#ifndef TOUCHGFX_HALSDL2_HPP
|
||||||
|
#define TOUCHGFX_HALSDL2_HPP
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <platform/driver/touch/TouchController.hpp>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Types.hpp>
|
||||||
|
#include <touchgfx/lcd/LCD.hpp>
|
||||||
|
#include <SDL2/SDL_render.h>
|
||||||
|
#include <SDL2/SDL_video.h>
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
/** Simulator enable stdio. */
|
||||||
|
void simulator_enable_stdio();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simulator printf.
|
||||||
|
*
|
||||||
|
* @param format Describes the format to use.
|
||||||
|
* @param pArg The argument list.
|
||||||
|
*/
|
||||||
|
void simulator_printf(const char* format, va_list pArg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL implementation for the TouchGFX simulator. This particular simulator HAL implementation
|
||||||
|
* uses SDL2 to show the content of the framebuffer in a window.
|
||||||
|
*
|
||||||
|
* @see HAL
|
||||||
|
*/
|
||||||
|
class HALSDL2 : public HAL
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Initializes a new instance of the HALSDL2 class.
|
||||||
|
*
|
||||||
|
* @param [in] dma Reference to DMA interface.
|
||||||
|
* @param [in] lcd Reference to the LCD.
|
||||||
|
* @param [in] touchCtrl Reference to Touch Controller driver.
|
||||||
|
* @param width Width of the display.
|
||||||
|
* @param height Height of the display.
|
||||||
|
*/
|
||||||
|
HALSDL2(DMA_Interface& dma, LCD& lcd, TouchController& touchCtrl, uint16_t width, uint16_t height)
|
||||||
|
: HAL(dma, lcd, touchCtrl, width, height),
|
||||||
|
portraitSkin(),
|
||||||
|
landscapeSkin(),
|
||||||
|
currentSkin(0),
|
||||||
|
isSkinActive(true),
|
||||||
|
isWindowBorderless(false),
|
||||||
|
isWindowVisible(true),
|
||||||
|
isConsoleVisible(true),
|
||||||
|
printFile(0),
|
||||||
|
windowDrag(false)
|
||||||
|
{
|
||||||
|
setVsyncInterval(30.f); // Simulate 20Hz per default for backward compatibility
|
||||||
|
updateCurrentSkin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main event loop. Will wait for VSYNC signal, and then process next frame. Call this
|
||||||
|
* function from your GUI task.
|
||||||
|
*
|
||||||
|
* @note This function never returns!
|
||||||
|
*/
|
||||||
|
virtual void taskEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sample key event from keyboard.
|
||||||
|
*
|
||||||
|
* @param [out] key Output parameter that will be set to the key value if a key press was
|
||||||
|
* detected.
|
||||||
|
*
|
||||||
|
* @return True if a key press was detected and the "key" parameter is set to a value.
|
||||||
|
*/
|
||||||
|
virtual bool sampleKey(uint8_t& key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called whenever the framework has performed a complete draw.
|
||||||
|
*
|
||||||
|
* On some platforms, a local framebuffer needs to be pushed to the display through a
|
||||||
|
* SPI channel or similar. Implement that functionality here. This function is called
|
||||||
|
* whenever the framework has performed a complete draw.
|
||||||
|
*/
|
||||||
|
virtual void flushFrameBuffer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called whenever the framework has performed a partial draw.
|
||||||
|
*
|
||||||
|
* @param rect The area of the screen that has been drawn, expressed in absolute coordinates.
|
||||||
|
*/
|
||||||
|
virtual void flushFrameBuffer(const Rect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets vsync interval for simulating same tick speed as the real hardware. Due to
|
||||||
|
* limitations in the granularity of SDL, the generated ticks in the simulator might not
|
||||||
|
* occur at the exact time, but accumulated over several ticks, the precision is very
|
||||||
|
* good.
|
||||||
|
*
|
||||||
|
* @param ms The milliseconds between ticks.
|
||||||
|
*
|
||||||
|
* @note That you can also use HAL::setFrameRateCompensation() in the simulator. The effect of
|
||||||
|
* this can easily be demonstrated by dragging the console output window of the
|
||||||
|
* simulator (when running from Visual Studio) as this will pause the SDL and
|
||||||
|
* generate a lot of ticks when the console window is released. Beware that
|
||||||
|
* since the missed vsyncs are accumulated in an 8 bit counter, only up to 255
|
||||||
|
* ticks may be missed, so at VsyncInterval = 16.6667, dragging the windows for
|
||||||
|
* more than 255 * 16.6667ms = 4250ms
|
||||||
|
* = 4.25s will not generate all the ticks that were actually missed. This
|
||||||
|
* situation is, however, not very realistic, as normally just a couple of
|
||||||
|
* vsyncs are skipped.
|
||||||
|
*/
|
||||||
|
void setVsyncInterval(float ms);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Samples the position of the mouse cursor.
|
||||||
|
*
|
||||||
|
* @param [out] x The x coordinate.
|
||||||
|
* @param [out] y The y coordinate.
|
||||||
|
*
|
||||||
|
* @return True if touch detected, false otherwise.
|
||||||
|
*/
|
||||||
|
bool doSampleTouch(int32_t& x, int32_t& y) const;
|
||||||
|
|
||||||
|
virtual void setFrameBufferSize(uint16_t width, uint16_t height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes SDL.
|
||||||
|
*
|
||||||
|
* @param argcount Number of arguments.
|
||||||
|
* @param [in] args Arguments.
|
||||||
|
*
|
||||||
|
* @return True if init went well, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool sdl_init(int argcount, char** args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets window title.
|
||||||
|
*
|
||||||
|
* Sets window title of the TouchGFX simulator.
|
||||||
|
*
|
||||||
|
* @param title The title, if null the original "TouchGFX simulator" will be used.
|
||||||
|
*
|
||||||
|
* @see getWindowTitle
|
||||||
|
*/
|
||||||
|
static void setWindowTitle(const char* title);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets window title.
|
||||||
|
*
|
||||||
|
* @return null "TouchGFX simulator" unless set to something else using setWindowTitle().
|
||||||
|
*
|
||||||
|
* @see setWindowTitle
|
||||||
|
*/
|
||||||
|
static const char* getWindowTitle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a skin for a given display orientation that will be rendered in the simulator
|
||||||
|
* window with the the TouchGFX framebuffer placed inside the bitmap at the given
|
||||||
|
* coordinates. Different bitmaps can be loaded in landscape and portrait mode. If the
|
||||||
|
* provided bitmap cannot be loaded, the TouchGFX framebuffer will be displayed as
|
||||||
|
* normal. If the png files contain areas with alpha
|
||||||
|
* < 255, this will be used to create a shaped window.
|
||||||
|
*
|
||||||
|
* @param orientation The orientation.
|
||||||
|
* @param x The x coordinate.
|
||||||
|
* @param y The y coordinate.
|
||||||
|
*
|
||||||
|
* @note The skins must be named "portrait.png" and "landscape.png" and placed inside the
|
||||||
|
* "simulator/" folder. The build process of the simulator will automatically
|
||||||
|
* copy the skins to the folder where the executable simulator is generated.
|
||||||
|
* @note When as skin is set, the entire framebuffer is rendered through SDL whenever there is
|
||||||
|
* a change. Without a skin, only the areas with changes is rendered through SDL.
|
||||||
|
*/
|
||||||
|
void loadSkin(DisplayOrientation orientation, int x, int y);
|
||||||
|
|
||||||
|
/** Saves a screenshot to the default folder and default filename. */
|
||||||
|
void saveScreenshot();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy the next N screenshots to disk. On each screen update, the new screen is saved
|
||||||
|
* to disk.
|
||||||
|
*
|
||||||
|
* @param n Number of screenshots to save. These are added to any ongoing amount of
|
||||||
|
* screenshots in queue.
|
||||||
|
*/
|
||||||
|
virtual void saveNextScreenshots(int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a screenshot.
|
||||||
|
*
|
||||||
|
* @param [in] folder Folder name to place the screenshot in.
|
||||||
|
* @param [in] filename Filename to save the screenshot to.
|
||||||
|
*/
|
||||||
|
virtual void saveScreenshot(char* folder, char* filename);
|
||||||
|
|
||||||
|
/** Copies the screenshot to clipboard. */
|
||||||
|
virtual void copyScreenshotToClipboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flash invalidated areas on/off. The area that needs to be redrawn is flashed in grey to help
|
||||||
|
* identify performance bottle necks.
|
||||||
|
*
|
||||||
|
* @param flash (Optional) True to flash the screen when updating.
|
||||||
|
*/
|
||||||
|
virtual void setFlashInvalidatedAreas(bool flash = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single stepping enable/disable. When single stepping is enabled, F10 will execute one
|
||||||
|
* tick and F9 will disable single stepping.
|
||||||
|
*
|
||||||
|
* @param singleStepping (Optional) True to pause the simulation and start single stepping.
|
||||||
|
*
|
||||||
|
* @see isSingleStepping
|
||||||
|
*/
|
||||||
|
static void setSingleStepping(bool singleStepping = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is single stepping.
|
||||||
|
*
|
||||||
|
* @return True if single stepping, false if not.
|
||||||
|
*
|
||||||
|
* @see setSingleStepping
|
||||||
|
*/
|
||||||
|
static bool isSingleStepping();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single step a number of steps. Only works if single stepping is already enabled.
|
||||||
|
*
|
||||||
|
* @param steps (Optional) The steps Default is 1 step.
|
||||||
|
*
|
||||||
|
* @see setSingleStepping, isSingleStepping
|
||||||
|
*/
|
||||||
|
static void singleStep(uint16_t steps = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Terminate the application as quickly as possible
|
||||||
|
*/
|
||||||
|
static void stopApplication();
|
||||||
|
|
||||||
|
#ifndef __linux__
|
||||||
|
/**
|
||||||
|
* Gets the argc and argv for a Windows program.
|
||||||
|
*
|
||||||
|
* @param [in,out] argc Pointer to where to store number of arguments.
|
||||||
|
*
|
||||||
|
* @return The argv list of arguments.
|
||||||
|
*/
|
||||||
|
static char** getArgv(int* argc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scale framebuffer to 24bpp. The format of the framebuffer (src) is given in parameter
|
||||||
|
* format. The result is placed in the pre-allocated memory pointed to by parameter dst.
|
||||||
|
* If the framebuffer is in format Bitmap::RGB888, parameter dst is not used and the
|
||||||
|
* parameter src is simply returned.
|
||||||
|
*
|
||||||
|
* @param [in] src The framebuffer.
|
||||||
|
* @param format Describes the format of the framebuffer (lcd().framebufferFormat()).
|
||||||
|
*
|
||||||
|
* @return Null if it fails, else a pointer to an uint8_t.
|
||||||
|
*/
|
||||||
|
static uint8_t* scaleTo24bpp(uint16_t* src, Bitmap::BitmapFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotates a framebuffer if the display is rotated.
|
||||||
|
*
|
||||||
|
* @param [in] src The framebuffer.
|
||||||
|
*
|
||||||
|
* @return Null if it fails, else a pointer to an uint8_t.
|
||||||
|
*/
|
||||||
|
static uint8_t* doRotate(uint8_t* src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change visibility of window (hidden vs. shown) as well as (due to
|
||||||
|
* backward compatibility) the visibility of the console window.
|
||||||
|
*
|
||||||
|
* @param visible Should the window be visible?
|
||||||
|
* @param redrawWindow (Optional) Should the window be redrawn? Default is true.
|
||||||
|
*
|
||||||
|
* @see getWindowVisible, setConsoleVisible
|
||||||
|
*/
|
||||||
|
void setWindowVisible(bool visible, bool redrawWindow = true)
|
||||||
|
{
|
||||||
|
isWindowVisible = visible;
|
||||||
|
isConsoleVisible = visible;
|
||||||
|
if (redrawWindow)
|
||||||
|
{
|
||||||
|
recreateWindow();
|
||||||
|
simulator_enable_stdio();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the window visible?
|
||||||
|
*
|
||||||
|
* @return True if it is visible, false if it is hidden.
|
||||||
|
*
|
||||||
|
* @see setWindowVisible, getConsoleVisible
|
||||||
|
*/
|
||||||
|
bool getWindowVisible() const
|
||||||
|
{
|
||||||
|
return isWindowVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change visibility of console window (hidden vs. shown).
|
||||||
|
*
|
||||||
|
* @param visible Should the window be visible?
|
||||||
|
* @param redrawWindow (Optional) Should the window be redrawn? Default is true.
|
||||||
|
*
|
||||||
|
* @see setWindowVisible, getConsoleVisible
|
||||||
|
*/
|
||||||
|
void setConsoleVisible(bool visible, bool redrawWindow = true)
|
||||||
|
{
|
||||||
|
isConsoleVisible = visible;
|
||||||
|
if (redrawWindow)
|
||||||
|
{
|
||||||
|
recreateWindow();
|
||||||
|
touchgfx::simulator_enable_stdio();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is console window visible?
|
||||||
|
*
|
||||||
|
* @return True if it is visible, false if it is hidden.
|
||||||
|
*
|
||||||
|
* @see setConsoleVisible, getWindowVisible
|
||||||
|
*/
|
||||||
|
bool getConsoleVisible() const
|
||||||
|
{
|
||||||
|
return isConsoleVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Also write touchgfx_printf() to a file. The file will be generated (no appended to).
|
||||||
|
*
|
||||||
|
* @param filename The name of the file to write to (or null to stop writing to a file).
|
||||||
|
*
|
||||||
|
* @return True if the operation succeeds, false otherwise.
|
||||||
|
*/
|
||||||
|
bool printToFile(const char* filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get file handle to output file (if set).
|
||||||
|
*
|
||||||
|
* @return A file handle to the file where output is copied to.
|
||||||
|
*
|
||||||
|
* @see printToFile
|
||||||
|
*/
|
||||||
|
FILE* getPrintFile() const
|
||||||
|
{
|
||||||
|
return printFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate name of file placed next to the simulator.
|
||||||
|
*
|
||||||
|
* @param [in] buffer If the buffer to fill with the local filename. Must be at least
|
||||||
|
* 300+length of filename parameter.
|
||||||
|
* @param buffer_size The size of the buffer in bytes.
|
||||||
|
* @param [in] filename The filename relative to the simulator executable.
|
||||||
|
*
|
||||||
|
* @return The filled buffer.
|
||||||
|
*/
|
||||||
|
char* localFileName(char* buffer, size_t buffer_size, const char* filename);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Gets TFT framebuffer.
|
||||||
|
*
|
||||||
|
* @return null if it fails, else the TFT framebuffer.
|
||||||
|
*/
|
||||||
|
virtual uint16_t* getTFTFrameBuffer() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets TFT framebuffer.
|
||||||
|
*
|
||||||
|
* @param [in] addr The address of the TFT framebuffer.
|
||||||
|
*/
|
||||||
|
void setTFTFrameBuffer(uint16_t* addr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update framebuffer using an SDL Surface.
|
||||||
|
*
|
||||||
|
* @param _rectToUpdate Area to update.
|
||||||
|
* @param [in] frameBuffer Target framebuffer.
|
||||||
|
*/
|
||||||
|
virtual void renderLCD_FrameBufferToMemory(const Rect& _rectToUpdate, uint8_t* frameBuffer);
|
||||||
|
|
||||||
|
/** Disables the DMA and LCD interrupts. */
|
||||||
|
virtual void disableInterrupts()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Enables the DMA and LCD interrupts. */
|
||||||
|
virtual void enableInterrupts()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configures LCD interrupt. */
|
||||||
|
virtual void configureLCDInterrupt()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Enables the LCD interrupt. */
|
||||||
|
virtual void enableLCDControllerInterrupt()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the interrupts relevant for TouchGFX. This primarily entails setting the
|
||||||
|
* interrupt priorities for the DMA and LCD interrupts.
|
||||||
|
*/
|
||||||
|
virtual void configureInterrupts()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Perform the actual display orientation change. */
|
||||||
|
void performDisplayOrientationChange();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void recreateWindow(bool updateContent = true);
|
||||||
|
void pushTouch(bool down) const;
|
||||||
|
bool popTouch() const;
|
||||||
|
static void updateTitle();
|
||||||
|
void alphaChannelCheck(SDL_Surface* surface, bool& isOpaque, bool& hasSemiTransparency);
|
||||||
|
void updateCurrentSkin();
|
||||||
|
int getCurrentSkinX() const;
|
||||||
|
int getCurrentSkinY() const;
|
||||||
|
|
||||||
|
static bool debugInfoEnabled;
|
||||||
|
|
||||||
|
float msBetweenTicks;
|
||||||
|
float msPassed;
|
||||||
|
|
||||||
|
static uint16_t icon[];
|
||||||
|
static const char* customTitle;
|
||||||
|
|
||||||
|
class SkinInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SDL_Surface* surface;
|
||||||
|
bool isOpaque;
|
||||||
|
bool hasSemiTransparency;
|
||||||
|
int offsetX;
|
||||||
|
int offsetY;
|
||||||
|
|
||||||
|
SkinInfo()
|
||||||
|
: surface(0), isOpaque(true), hasSemiTransparency(false), offsetX(0), offsetY(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~SkinInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
char programPath[300];
|
||||||
|
SkinInfo portraitSkin;
|
||||||
|
SkinInfo landscapeSkin;
|
||||||
|
SkinInfo* currentSkin;
|
||||||
|
bool isSkinActive;
|
||||||
|
bool isWindowBorderless;
|
||||||
|
bool isWindowVisible;
|
||||||
|
bool isConsoleVisible;
|
||||||
|
FILE* printFile;
|
||||||
|
static bool flashInvalidatedRect;
|
||||||
|
|
||||||
|
bool windowDrag;
|
||||||
|
int windowDragX;
|
||||||
|
int windowDragY;
|
||||||
|
|
||||||
|
static int32_t _xMouse;
|
||||||
|
static int32_t _yMouse;
|
||||||
|
static int32_t _x;
|
||||||
|
static int32_t _y;
|
||||||
|
static bool isWindowBeingDragged;
|
||||||
|
static int initialWindowX;
|
||||||
|
static int initialWindowY;
|
||||||
|
static int initialMouseX;
|
||||||
|
static int initialMouseY;
|
||||||
|
static bool _lastTouch;
|
||||||
|
static bool _touches[5];
|
||||||
|
static int _numTouches;
|
||||||
|
|
||||||
|
static uint8_t keyPressed;
|
||||||
|
|
||||||
|
static bool singleSteppingEnabled;
|
||||||
|
static uint16_t singleSteppingSteps;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace touchgfx
|
||||||
|
|
||||||
|
#endif // TOUCHGFX_HALSDL2_HPP
|
||||||
Vendored
+132
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL.h
|
||||||
|
*
|
||||||
|
* Main include header for the SDL library
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _SDL_H
|
||||||
|
#define _SDL_H
|
||||||
|
|
||||||
|
#include "SDL_main.h"
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
|
#include "SDL_assert.h"
|
||||||
|
#include "SDL_atomic.h"
|
||||||
|
#include "SDL_audio.h"
|
||||||
|
#include "SDL_clipboard.h"
|
||||||
|
#include "SDL_cpuinfo.h"
|
||||||
|
#include "SDL_endian.h"
|
||||||
|
#include "SDL_error.h"
|
||||||
|
#include "SDL_events.h"
|
||||||
|
#include "SDL_filesystem.h"
|
||||||
|
#include "SDL_joystick.h"
|
||||||
|
#include "SDL_gamecontroller.h"
|
||||||
|
#include "SDL_haptic.h"
|
||||||
|
#include "SDL_hints.h"
|
||||||
|
#include "SDL_loadso.h"
|
||||||
|
#include "SDL_log.h"
|
||||||
|
#include "SDL_messagebox.h"
|
||||||
|
#include "SDL_mutex.h"
|
||||||
|
#include "SDL_power.h"
|
||||||
|
#include "SDL_render.h"
|
||||||
|
#include "SDL_rwops.h"
|
||||||
|
#include "SDL_system.h"
|
||||||
|
#include "SDL_thread.h"
|
||||||
|
#include "SDL_timer.h"
|
||||||
|
#include "SDL_version.h"
|
||||||
|
#include "SDL_video.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name SDL_INIT_*
|
||||||
|
*
|
||||||
|
* These are the flags which may be passed to SDL_Init(). You should
|
||||||
|
* specify the subsystems which you will be using in your application.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
#define SDL_INIT_TIMER 0x00000001
|
||||||
|
#define SDL_INIT_AUDIO 0x00000010
|
||||||
|
#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
|
||||||
|
#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
|
||||||
|
#define SDL_INIT_HAPTIC 0x00001000
|
||||||
|
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
|
||||||
|
#define SDL_INIT_EVENTS 0x00004000
|
||||||
|
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< compatibility; this flag is ignored. */
|
||||||
|
#define SDL_INIT_EVERYTHING ( \
|
||||||
|
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
|
||||||
|
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
|
||||||
|
)
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function initializes the subsystems specified by \c flags
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function initializes specific SDL subsystems
|
||||||
|
*
|
||||||
|
* Subsystem initialization is ref-counted, you must call
|
||||||
|
* SDL_QuitSubSystem for each SDL_InitSubSystem to correctly
|
||||||
|
* shutdown a subsystem manually (or call SDL_Quit to force shutdown).
|
||||||
|
* If a subsystem is already loaded then this call will
|
||||||
|
* increase the ref-count and return.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function cleans up specific SDL subsystems
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns a mask of the specified subsystems which have
|
||||||
|
* previously been initialized.
|
||||||
|
*
|
||||||
|
* If \c flags is 0, it returns a mask of all initialized subsystems.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function cleans up all initialized subsystems. You should
|
||||||
|
* call it upon all exit conditions.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _SDL_H */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
Appli/Middlewares/ST/touchgfx/framework/include/platform/hal/simulator/sdl2/vendor/SDL2/SDL_assert.h
Vendored
+289
@@ -0,0 +1,289 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_assert_h
|
||||||
|
#define _SDL_assert_h
|
||||||
|
|
||||||
|
#include "SDL_config.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SDL_ASSERT_LEVEL
|
||||||
|
#ifdef SDL_DEFAULT_ASSERT_LEVEL
|
||||||
|
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
|
||||||
|
#elif defined(_DEBUG) || defined(DEBUG) || \
|
||||||
|
(defined(__GNUC__) && !defined(__OPTIMIZE__))
|
||||||
|
#define SDL_ASSERT_LEVEL 2
|
||||||
|
#else
|
||||||
|
#define SDL_ASSERT_LEVEL 1
|
||||||
|
#endif
|
||||||
|
#endif /* SDL_ASSERT_LEVEL */
|
||||||
|
|
||||||
|
/*
|
||||||
|
These are macros and not first class functions so that the debugger breaks
|
||||||
|
on the assertion line and not in some random guts of SDL, and so each
|
||||||
|
assert can have unique static variables associated with it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
/* Don't include intrin.h here because it contains C++ code */
|
||||||
|
extern void __cdecl __debugbreak(void);
|
||||||
|
#define SDL_TriggerBreakpoint() __debugbreak()
|
||||||
|
#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
|
||||||
|
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
|
||||||
|
#elif defined(HAVE_SIGNAL_H)
|
||||||
|
#include <signal.h>
|
||||||
|
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
|
||||||
|
#else
|
||||||
|
/* How do we trigger breakpoints on this platform? */
|
||||||
|
#define SDL_TriggerBreakpoint()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
|
||||||
|
# define SDL_FUNCTION __func__
|
||||||
|
#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
|
||||||
|
# define SDL_FUNCTION __FUNCTION__
|
||||||
|
#else
|
||||||
|
# define SDL_FUNCTION "???"
|
||||||
|
#endif
|
||||||
|
#define SDL_FILE __FILE__
|
||||||
|
#define SDL_LINE __LINE__
|
||||||
|
|
||||||
|
/*
|
||||||
|
sizeof (x) makes the compiler still parse the expression even without
|
||||||
|
assertions enabled, so the code is always checked at compile time, but
|
||||||
|
doesn't actually generate code for it, so there are no side effects or
|
||||||
|
expensive checks at run time, just the constant size of what x WOULD be,
|
||||||
|
which presumably gets optimized out as unused.
|
||||||
|
This also solves the problem of...
|
||||||
|
|
||||||
|
int somevalue = blah();
|
||||||
|
SDL_assert(somevalue == 1);
|
||||||
|
|
||||||
|
...which would cause compiles to complain that somevalue is unused if we
|
||||||
|
disable assertions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
|
||||||
|
this condition isn't constant. And looks like an owl's face! */
|
||||||
|
#ifdef _MSC_VER /* stupid /W4 warnings. */
|
||||||
|
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
|
||||||
|
#else
|
||||||
|
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SDL_disabled_assert(condition) \
|
||||||
|
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
|
||||||
|
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
|
||||||
|
SDL_ASSERTION_ABORT, /**< Terminate the program. */
|
||||||
|
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
|
||||||
|
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
|
||||||
|
} SDL_AssertState;
|
||||||
|
|
||||||
|
typedef struct SDL_AssertData
|
||||||
|
{
|
||||||
|
int always_ignore;
|
||||||
|
unsigned int trigger_count;
|
||||||
|
const char *condition;
|
||||||
|
const char *filename;
|
||||||
|
int linenum;
|
||||||
|
const char *function;
|
||||||
|
const struct SDL_AssertData *next;
|
||||||
|
} SDL_AssertData;
|
||||||
|
|
||||||
|
#if (SDL_ASSERT_LEVEL > 0)
|
||||||
|
|
||||||
|
/* Never call this directly. Use the SDL_assert* macros. */
|
||||||
|
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
|
||||||
|
const char *,
|
||||||
|
const char *, int)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#if __has_feature(attribute_analyzer_noreturn)
|
||||||
|
/* this tells Clang's static analysis that we're a custom assert function,
|
||||||
|
and that the analyzer should assume the condition was always true past this
|
||||||
|
SDL_assert test. */
|
||||||
|
__attribute__((analyzer_noreturn))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
/* the do {} while(0) avoids dangling else problems:
|
||||||
|
if (x) SDL_assert(y); else blah();
|
||||||
|
... without the do/while, the "else" could attach to this macro's "if".
|
||||||
|
We try to handle just the minimum we need here in a macro...the loop,
|
||||||
|
the static vars, and break points. The heavy lifting is handled in
|
||||||
|
SDL_ReportAssertion(), in SDL_assert.c.
|
||||||
|
*/
|
||||||
|
#define SDL_enabled_assert(condition) \
|
||||||
|
do { \
|
||||||
|
while ( !(condition) ) { \
|
||||||
|
static struct SDL_AssertData sdl_assert_data = { \
|
||||||
|
0, 0, #condition, 0, 0, 0, 0 \
|
||||||
|
}; \
|
||||||
|
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
|
||||||
|
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
|
||||||
|
continue; /* go again. */ \
|
||||||
|
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
|
||||||
|
SDL_TriggerBreakpoint(); \
|
||||||
|
} \
|
||||||
|
break; /* not retrying. */ \
|
||||||
|
} \
|
||||||
|
} while (SDL_NULL_WHILE_LOOP_CONDITION)
|
||||||
|
|
||||||
|
#endif /* enabled assertions support code */
|
||||||
|
|
||||||
|
/* Enable various levels of assertions. */
|
||||||
|
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
|
||||||
|
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||||
|
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
|
||||||
|
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||||
|
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
|
||||||
|
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||||
|
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||||
|
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||||
|
#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
|
||||||
|
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||||
|
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||||
|
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||||
|
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
|
||||||
|
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||||
|
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||||
|
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
|
||||||
|
#else
|
||||||
|
# error Unknown assertion level.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* this assertion is never disabled at any level. */
|
||||||
|
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
|
||||||
|
|
||||||
|
|
||||||
|
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
|
||||||
|
const SDL_AssertData* data, void* userdata);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set an application-defined assertion handler.
|
||||||
|
*
|
||||||
|
* This allows an app to show its own assertion UI and/or force the
|
||||||
|
* response to an assertion failure. If the app doesn't provide this, SDL
|
||||||
|
* will try to do the right thing, popping up a system-specific GUI dialog,
|
||||||
|
* and probably minimizing any fullscreen windows.
|
||||||
|
*
|
||||||
|
* This callback may fire from any thread, but it runs wrapped in a mutex, so
|
||||||
|
* it will only fire from one thread at a time.
|
||||||
|
*
|
||||||
|
* Setting the callback to NULL restores SDL's original internal handler.
|
||||||
|
*
|
||||||
|
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
|
||||||
|
*
|
||||||
|
* \return SDL_AssertState value of how to handle the assertion failure.
|
||||||
|
*
|
||||||
|
* \param handler Callback function, called when an assertion fails.
|
||||||
|
* \param userdata A pointer passed to the callback as-is.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
||||||
|
SDL_AssertionHandler handler,
|
||||||
|
void *userdata);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the default assertion handler.
|
||||||
|
*
|
||||||
|
* This returns the function pointer that is called by default when an
|
||||||
|
* assertion is triggered. This is an internal function provided by SDL,
|
||||||
|
* that is used for assertions when SDL_SetAssertionHandler() hasn't been
|
||||||
|
* used to provide a different function.
|
||||||
|
*
|
||||||
|
* \return The default SDL_AssertionHandler that is called when an assert triggers.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the current assertion handler.
|
||||||
|
*
|
||||||
|
* This returns the function pointer that is called when an assertion is
|
||||||
|
* triggered. This is either the value last passed to
|
||||||
|
* SDL_SetAssertionHandler(), or if no application-specified function is
|
||||||
|
* set, is equivalent to calling SDL_GetDefaultAssertionHandler().
|
||||||
|
*
|
||||||
|
* \param puserdata Pointer to a void*, which will store the "userdata"
|
||||||
|
* pointer that was passed to SDL_SetAssertionHandler().
|
||||||
|
* This value will always be NULL for the default handler.
|
||||||
|
* If you don't care about this data, it is safe to pass
|
||||||
|
* a NULL pointer to this function to ignore it.
|
||||||
|
* \return The SDL_AssertionHandler that is called when an assert triggers.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get a list of all assertion failures.
|
||||||
|
*
|
||||||
|
* Get all assertions triggered since last call to SDL_ResetAssertionReport(),
|
||||||
|
* or the start of the program.
|
||||||
|
*
|
||||||
|
* The proper way to examine this data looks something like this:
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* const SDL_AssertData *item = SDL_GetAssertionReport();
|
||||||
|
* while (item) {
|
||||||
|
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
|
||||||
|
* item->condition, item->function, item->filename,
|
||||||
|
* item->linenum, item->trigger_count,
|
||||||
|
* item->always_ignore ? "yes" : "no");
|
||||||
|
* item = item->next;
|
||||||
|
* }
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* \return List of all assertions.
|
||||||
|
* \sa SDL_ResetAssertionReport
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Reset the list of all assertion failures.
|
||||||
|
*
|
||||||
|
* Reset list of all assertions triggered.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetAssertionReport
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* these had wrong naming conventions until 2.0.4. Please update your app! */
|
||||||
|
#define SDL_assert_state SDL_AssertState
|
||||||
|
#define SDL_assert_data SDL_AssertData
|
||||||
|
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _SDL_assert_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
Appli/Middlewares/ST/touchgfx/framework/include/platform/hal/simulator/sdl2/vendor/SDL2/SDL_atomic.h
Vendored
+268
@@ -0,0 +1,268 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_atomic.h
|
||||||
|
*
|
||||||
|
* Atomic operations.
|
||||||
|
*
|
||||||
|
* IMPORTANT:
|
||||||
|
* If you are not an expert in concurrent lockless programming, you should
|
||||||
|
* only be using the atomic lock and reference counting functions in this
|
||||||
|
* file. In all other cases you should be protecting your data structures
|
||||||
|
* with full mutexes.
|
||||||
|
*
|
||||||
|
* The list of "safe" functions to use are:
|
||||||
|
* SDL_AtomicLock()
|
||||||
|
* SDL_AtomicUnlock()
|
||||||
|
* SDL_AtomicIncRef()
|
||||||
|
* SDL_AtomicDecRef()
|
||||||
|
*
|
||||||
|
* Seriously, here be dragons!
|
||||||
|
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
*
|
||||||
|
* You can find out a little more about lockless programming and the
|
||||||
|
* subtle issues that can arise here:
|
||||||
|
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
|
||||||
|
*
|
||||||
|
* There's also lots of good information here:
|
||||||
|
* http://www.1024cores.net/home/lock-free-algorithms
|
||||||
|
* http://preshing.com/
|
||||||
|
*
|
||||||
|
* These operations may or may not actually be implemented using
|
||||||
|
* processor specific atomic operations. When possible they are
|
||||||
|
* implemented as true processor specific atomic operations. When that
|
||||||
|
* is not possible the are implemented using locks that *do* use the
|
||||||
|
* available atomic operations.
|
||||||
|
*
|
||||||
|
* All of the atomic operations that modify memory are full memory barriers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_atomic_h_
|
||||||
|
#define _SDL_atomic_h_
|
||||||
|
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name SDL AtomicLock
|
||||||
|
*
|
||||||
|
* The atomic locks are efficient spinlocks using CPU instructions,
|
||||||
|
* but are vulnerable to starvation and can spin forever if a thread
|
||||||
|
* holding a lock has been terminated. For this reason you should
|
||||||
|
* minimize the code executed inside an atomic lock and never do
|
||||||
|
* expensive things like API or system calls while holding them.
|
||||||
|
*
|
||||||
|
* The atomic locks are not safe to lock recursively.
|
||||||
|
*
|
||||||
|
* Porting Note:
|
||||||
|
* The spin lock functions and type are required and can not be
|
||||||
|
* emulated because they are used in the atomic emulation code.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
|
||||||
|
typedef int SDL_SpinLock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Try to lock a spin lock by setting it to a non-zero value.
|
||||||
|
*
|
||||||
|
* \param lock Points to the lock.
|
||||||
|
*
|
||||||
|
* \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Lock a spin lock by setting it to a non-zero value.
|
||||||
|
*
|
||||||
|
* \param lock Points to the lock.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Unlock a spin lock by setting it to 0. Always returns immediately
|
||||||
|
*
|
||||||
|
* \param lock Points to the lock.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
|
||||||
|
|
||||||
|
/* @} *//* SDL AtomicLock */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The compiler barrier prevents the compiler from reordering
|
||||||
|
* reads and writes to globally visible variables across the call.
|
||||||
|
*/
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||||
|
void _ReadWriteBarrier(void);
|
||||||
|
#pragma intrinsic(_ReadWriteBarrier)
|
||||||
|
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
||||||
|
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
||||||
|
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
|
||||||
|
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
||||||
|
#else
|
||||||
|
#define SDL_CompilerBarrier() \
|
||||||
|
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memory barriers are designed to prevent reads and writes from being
|
||||||
|
* reordered by the compiler and being seen out of order on multi-core CPUs.
|
||||||
|
*
|
||||||
|
* A typical pattern would be for thread A to write some data and a flag,
|
||||||
|
* and for thread B to read the flag and get the data. In this case you
|
||||||
|
* would insert a release barrier between writing the data and the flag,
|
||||||
|
* guaranteeing that the data write completes no later than the flag is
|
||||||
|
* written, and you would insert an acquire barrier between reading the
|
||||||
|
* flag and reading the data, to ensure that all the reads associated
|
||||||
|
* with the flag have completed.
|
||||||
|
*
|
||||||
|
* In this pattern you should always see a release barrier paired with
|
||||||
|
* an acquire barrier and you should gate the data reads/writes with a
|
||||||
|
* single flag variable.
|
||||||
|
*
|
||||||
|
* For more information on these semantics, take a look at the blog post:
|
||||||
|
* http://preshing.com/20120913/acquire-and-release-semantics
|
||||||
|
*/
|
||||||
|
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||||
|
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||||
|
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||||
|
#elif defined(__GNUC__) && defined(__arm__)
|
||||||
|
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
|
||||||
|
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||||
|
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||||
|
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
|
||||||
|
#ifdef __thumb__
|
||||||
|
/* The mcr instruction isn't available in thumb mode, use real functions */
|
||||||
|
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
|
||||||
|
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
|
||||||
|
#else
|
||||||
|
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||||
|
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||||
|
#endif /* __thumb__ */
|
||||||
|
#else
|
||||||
|
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
|
||||||
|
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
|
||||||
|
#endif /* __GNUC__ && __arm__ */
|
||||||
|
#else
|
||||||
|
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
||||||
|
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
|
||||||
|
#include <mbarrier.h>
|
||||||
|
#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
|
||||||
|
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
|
||||||
|
#else
|
||||||
|
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
|
||||||
|
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
|
||||||
|
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A type representing an atomic integer value. It is a struct
|
||||||
|
* so people don't accidentally use numeric operations on it.
|
||||||
|
*/
|
||||||
|
typedef struct { int value; } SDL_atomic_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set an atomic variable to a new value if it is currently an old value.
|
||||||
|
*
|
||||||
|
* \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \note If you don't know what this function is for, you shouldn't use it!
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set an atomic variable to a value.
|
||||||
|
*
|
||||||
|
* \return The previous value of the atomic variable.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the value of an atomic variable
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Add to an atomic variable.
|
||||||
|
*
|
||||||
|
* \return The previous value of the atomic variable.
|
||||||
|
*
|
||||||
|
* \note This same style can be used for any number operation
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Increment an atomic variable used as a reference count.
|
||||||
|
*/
|
||||||
|
#ifndef SDL_AtomicIncRef
|
||||||
|
#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Decrement an atomic variable used as a reference count.
|
||||||
|
*
|
||||||
|
* \return SDL_TRUE if the variable reached zero after decrementing,
|
||||||
|
* SDL_FALSE otherwise
|
||||||
|
*/
|
||||||
|
#ifndef SDL_AtomicDecRef
|
||||||
|
#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set a pointer to a new value if it is currently an old value.
|
||||||
|
*
|
||||||
|
* \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \note If you don't know what this function is for, you shouldn't use it!
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set a pointer to a value atomically.
|
||||||
|
*
|
||||||
|
* \return The previous value of the pointer.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the value of a pointer atomically.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _SDL_atomic_h_ */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
Vendored
+605
@@ -0,0 +1,605 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_audio.h
|
||||||
|
*
|
||||||
|
* Access to the raw audio mixing buffer for the SDL library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_audio_h
|
||||||
|
#define _SDL_audio_h
|
||||||
|
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
|
#include "SDL_error.h"
|
||||||
|
#include "SDL_endian.h"
|
||||||
|
#include "SDL_mutex.h"
|
||||||
|
#include "SDL_thread.h"
|
||||||
|
#include "SDL_rwops.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Audio format flags.
|
||||||
|
*
|
||||||
|
* These are what the 16 bits in SDL_AudioFormat currently mean...
|
||||||
|
* (Unspecified bits are always zero).
|
||||||
|
*
|
||||||
|
* \verbatim
|
||||||
|
++-----------------------sample is signed if set
|
||||||
|
||
|
||||||
|
|| ++-----------sample is bigendian if set
|
||||||
|
|| ||
|
||||||
|
|| || ++---sample is float if set
|
||||||
|
|| || ||
|
||||||
|
|| || || +---sample bit size---+
|
||||||
|
|| || || | |
|
||||||
|
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
|
||||||
|
\endverbatim
|
||||||
|
*
|
||||||
|
* There are macros in SDL 2.0 and later to query these bits.
|
||||||
|
*/
|
||||||
|
typedef Uint16 SDL_AudioFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Audio flags
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
|
||||||
|
#define SDL_AUDIO_MASK_BITSIZE (0xFF)
|
||||||
|
#define SDL_AUDIO_MASK_DATATYPE (1<<8)
|
||||||
|
#define SDL_AUDIO_MASK_ENDIAN (1<<12)
|
||||||
|
#define SDL_AUDIO_MASK_SIGNED (1<<15)
|
||||||
|
#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
|
||||||
|
#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
|
||||||
|
#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
|
||||||
|
#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
|
||||||
|
#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
|
||||||
|
#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
|
||||||
|
#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Audio format flags
|
||||||
|
*
|
||||||
|
* Defaults to LSB byte order.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
|
||||||
|
#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
|
||||||
|
#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
|
||||||
|
#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
|
||||||
|
#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
|
||||||
|
#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
|
||||||
|
#define AUDIO_U16 AUDIO_U16LSB
|
||||||
|
#define AUDIO_S16 AUDIO_S16LSB
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name int32 support
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
|
||||||
|
#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
|
||||||
|
#define AUDIO_S32 AUDIO_S32LSB
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name float32 support
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
|
||||||
|
#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
|
||||||
|
#define AUDIO_F32 AUDIO_F32LSB
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Native audio byte ordering
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
|
#define AUDIO_U16SYS AUDIO_U16LSB
|
||||||
|
#define AUDIO_S16SYS AUDIO_S16LSB
|
||||||
|
#define AUDIO_S32SYS AUDIO_S32LSB
|
||||||
|
#define AUDIO_F32SYS AUDIO_F32LSB
|
||||||
|
#else
|
||||||
|
#define AUDIO_U16SYS AUDIO_U16MSB
|
||||||
|
#define AUDIO_S16SYS AUDIO_S16MSB
|
||||||
|
#define AUDIO_S32SYS AUDIO_S32MSB
|
||||||
|
#define AUDIO_F32SYS AUDIO_F32MSB
|
||||||
|
#endif
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Allow change flags
|
||||||
|
*
|
||||||
|
* Which audio format changes are allowed when opening a device.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
|
||||||
|
#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
|
||||||
|
#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
|
||||||
|
#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/* @} *//* Audio flags */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called when the audio device needs more data.
|
||||||
|
*
|
||||||
|
* \param userdata An application-specific parameter saved in
|
||||||
|
* the SDL_AudioSpec structure
|
||||||
|
* \param stream A pointer to the audio data buffer.
|
||||||
|
* \param len The length of that buffer in bytes.
|
||||||
|
*
|
||||||
|
* Once the callback returns, the buffer will no longer be valid.
|
||||||
|
* Stereo samples are stored in a LRLRLR ordering.
|
||||||
|
*
|
||||||
|
* You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
|
||||||
|
* you like. Just open your audio device with a NULL callback.
|
||||||
|
*/
|
||||||
|
typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
|
||||||
|
int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calculated values in this structure are calculated by SDL_OpenAudio().
|
||||||
|
*/
|
||||||
|
typedef struct SDL_AudioSpec
|
||||||
|
{
|
||||||
|
int freq; /**< DSP frequency -- samples per second */
|
||||||
|
SDL_AudioFormat format; /**< Audio data format */
|
||||||
|
Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
|
||||||
|
Uint8 silence; /**< Audio buffer silence value (calculated) */
|
||||||
|
Uint16 samples; /**< Audio buffer size in samples (power of 2) */
|
||||||
|
Uint16 padding; /**< Necessary for some compile environments */
|
||||||
|
Uint32 size; /**< Audio buffer size in bytes (calculated) */
|
||||||
|
SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
|
||||||
|
void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */
|
||||||
|
} SDL_AudioSpec;
|
||||||
|
|
||||||
|
|
||||||
|
struct SDL_AudioCVT;
|
||||||
|
typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
|
||||||
|
SDL_AudioFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A structure to hold a set of audio conversion filters and buffers.
|
||||||
|
*/
|
||||||
|
#ifdef __GNUC__
|
||||||
|
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
|
||||||
|
pad it out to 88 bytes to guarantee ABI compatibility between compilers.
|
||||||
|
vvv
|
||||||
|
The next time we rev the ABI, make sure to size the ints and add padding.
|
||||||
|
*/
|
||||||
|
#define SDL_AUDIOCVT_PACKED __attribute__((packed))
|
||||||
|
#else
|
||||||
|
#define SDL_AUDIOCVT_PACKED
|
||||||
|
#endif
|
||||||
|
/* */
|
||||||
|
typedef struct SDL_AudioCVT
|
||||||
|
{
|
||||||
|
int needed; /**< Set to 1 if conversion possible */
|
||||||
|
SDL_AudioFormat src_format; /**< Source audio format */
|
||||||
|
SDL_AudioFormat dst_format; /**< Target audio format */
|
||||||
|
double rate_incr; /**< Rate conversion increment */
|
||||||
|
Uint8 *buf; /**< Buffer to hold entire audio data */
|
||||||
|
int len; /**< Length of original audio buffer */
|
||||||
|
int len_cvt; /**< Length of converted audio buffer */
|
||||||
|
int len_mult; /**< buffer must be len*len_mult big */
|
||||||
|
double len_ratio; /**< Given len, final size is len*len_ratio */
|
||||||
|
SDL_AudioFilter filters[10]; /**< Filter list */
|
||||||
|
int filter_index; /**< Current audio conversion function */
|
||||||
|
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
|
||||||
|
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Driver discovery functions
|
||||||
|
*
|
||||||
|
* These functions return the list of built in audio drivers, in the
|
||||||
|
* order that they are normally initialized by default.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
|
||||||
|
extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Initialization and cleanup
|
||||||
|
*
|
||||||
|
* \internal These functions are used internally, and should not be used unless
|
||||||
|
* you have a specific need to specify the audio driver you want to
|
||||||
|
* use. You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
||||||
|
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns the name of the current audio driver, or NULL
|
||||||
|
* if no driver has been initialized.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function opens the audio device with the desired parameters, and
|
||||||
|
* returns 0 if successful, placing the actual hardware parameters in the
|
||||||
|
* structure pointed to by \c obtained. If \c obtained is NULL, the audio
|
||||||
|
* data passed to the callback function will be guaranteed to be in the
|
||||||
|
* requested format, and will be automatically converted to the hardware
|
||||||
|
* audio format if necessary. This function returns -1 if it failed
|
||||||
|
* to open the audio device, or couldn't set up the audio thread.
|
||||||
|
*
|
||||||
|
* When filling in the desired audio spec structure,
|
||||||
|
* - \c desired->freq should be the desired audio frequency in samples-per-
|
||||||
|
* second.
|
||||||
|
* - \c desired->format should be the desired audio format.
|
||||||
|
* - \c desired->samples is the desired size of the audio buffer, in
|
||||||
|
* samples. This number should be a power of two, and may be adjusted by
|
||||||
|
* the audio driver to a value more suitable for the hardware. Good values
|
||||||
|
* seem to range between 512 and 8096 inclusive, depending on the
|
||||||
|
* application and CPU speed. Smaller values yield faster response time,
|
||||||
|
* but can lead to underflow if the application is doing heavy processing
|
||||||
|
* and cannot fill the audio buffer in time. A stereo sample consists of
|
||||||
|
* both right and left channels in LR ordering.
|
||||||
|
* Note that the number of samples is directly related to time by the
|
||||||
|
* following formula: \code ms = (samples*1000)/freq \endcode
|
||||||
|
* - \c desired->size is the size in bytes of the audio buffer, and is
|
||||||
|
* calculated by SDL_OpenAudio().
|
||||||
|
* - \c desired->silence is the value used to set the buffer to silence,
|
||||||
|
* and is calculated by SDL_OpenAudio().
|
||||||
|
* - \c desired->callback should be set to a function that will be called
|
||||||
|
* when the audio device is ready for more data. It is passed a pointer
|
||||||
|
* to the audio buffer, and the length in bytes of the audio buffer.
|
||||||
|
* This function usually runs in a separate thread, and so you should
|
||||||
|
* protect data structures that it accesses by calling SDL_LockAudio()
|
||||||
|
* and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL
|
||||||
|
* pointer here, and call SDL_QueueAudio() with some frequency, to queue
|
||||||
|
* more audio samples to be played.
|
||||||
|
* - \c desired->userdata is passed as the first parameter to your callback
|
||||||
|
* function. If you passed a NULL callback, this value is ignored.
|
||||||
|
*
|
||||||
|
* The audio device starts out playing silence when it's opened, and should
|
||||||
|
* be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
|
||||||
|
* for your audio callback function to be called. Since the audio driver
|
||||||
|
* may modify the requested size of the audio buffer, you should allocate
|
||||||
|
* any local mixing buffers after you open the audio device.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
|
||||||
|
SDL_AudioSpec * obtained);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SDL Audio Device IDs.
|
||||||
|
*
|
||||||
|
* A successful call to SDL_OpenAudio() is always device id 1, and legacy
|
||||||
|
* SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
|
||||||
|
* always returns devices >= 2 on success. The legacy calls are good both
|
||||||
|
* for backwards compatibility and when you don't care about multiple,
|
||||||
|
* specific, or capture devices.
|
||||||
|
*/
|
||||||
|
typedef Uint32 SDL_AudioDeviceID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of available devices exposed by the current driver.
|
||||||
|
* Only valid after a successfully initializing the audio subsystem.
|
||||||
|
* Returns -1 if an explicit list of devices can't be determined; this is
|
||||||
|
* not an error. For example, if SDL is set up to talk to a remote audio
|
||||||
|
* server, it can't list every one available on the Internet, but it will
|
||||||
|
* still allow a specific host to be specified to SDL_OpenAudioDevice().
|
||||||
|
*
|
||||||
|
* In many common cases, when this function returns a value <= 0, it can still
|
||||||
|
* successfully open the default device (NULL for first argument of
|
||||||
|
* SDL_OpenAudioDevice()).
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the human-readable name of a specific audio device.
|
||||||
|
* Must be a value between 0 and (number of audio devices-1).
|
||||||
|
* Only valid after a successfully initializing the audio subsystem.
|
||||||
|
* The values returned by this function reflect the latest call to
|
||||||
|
* SDL_GetNumAudioDevices(); recall that function to redetect available
|
||||||
|
* hardware.
|
||||||
|
*
|
||||||
|
* The string returned by this function is UTF-8 encoded, read-only, and
|
||||||
|
* managed internally. You are not to free it. If you need to keep the
|
||||||
|
* string for any length of time, you should make your own copy of it, as it
|
||||||
|
* will be invalid next time any of several other SDL functions is called.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
|
||||||
|
int iscapture);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a specific audio device. Passing in a device name of NULL requests
|
||||||
|
* the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
|
||||||
|
*
|
||||||
|
* The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
|
||||||
|
* some drivers allow arbitrary and driver-specific strings, such as a
|
||||||
|
* hostname/IP address for a remote audio server, or a filename in the
|
||||||
|
* diskaudio driver.
|
||||||
|
*
|
||||||
|
* \return 0 on error, a valid device ID that is >= 2 on success.
|
||||||
|
*
|
||||||
|
* SDL_OpenAudio(), unlike this function, always acts on device ID 1.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
|
||||||
|
*device,
|
||||||
|
int iscapture,
|
||||||
|
const
|
||||||
|
SDL_AudioSpec *
|
||||||
|
desired,
|
||||||
|
SDL_AudioSpec *
|
||||||
|
obtained,
|
||||||
|
int
|
||||||
|
allowed_changes);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Audio state
|
||||||
|
*
|
||||||
|
* Get the current audio state.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SDL_AUDIO_STOPPED = 0,
|
||||||
|
SDL_AUDIO_PLAYING,
|
||||||
|
SDL_AUDIO_PAUSED
|
||||||
|
} SDL_AudioStatus;
|
||||||
|
extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
|
||||||
|
|
||||||
|
extern DECLSPEC SDL_AudioStatus SDLCALL
|
||||||
|
SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
|
||||||
|
/* @} *//* Audio State */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Pause audio functions
|
||||||
|
*
|
||||||
|
* These functions pause and unpause the audio callback processing.
|
||||||
|
* They should be called with a parameter of 0 after opening the audio
|
||||||
|
* device to start playing sound. This is so you can safely initialize
|
||||||
|
* data for your callback function after opening the audio device.
|
||||||
|
* Silence will be written to the audio device during the pause.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
||||||
|
extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
|
||||||
|
int pause_on);
|
||||||
|
/* @} *//* Pause audio functions */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function loads a WAVE from the data source, automatically freeing
|
||||||
|
* that source if \c freesrc is non-zero. For example, to load a WAVE file,
|
||||||
|
* you could do:
|
||||||
|
* \code
|
||||||
|
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* If this function succeeds, it returns the given SDL_AudioSpec,
|
||||||
|
* filled with the audio data format of the wave data, and sets
|
||||||
|
* \c *audio_buf to a malloc()'d buffer containing the audio data,
|
||||||
|
* and sets \c *audio_len to the length of that audio buffer, in bytes.
|
||||||
|
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
||||||
|
* done with it.
|
||||||
|
*
|
||||||
|
* This function returns NULL and sets the SDL error message if the
|
||||||
|
* wave file cannot be opened, uses an unknown data format, or is
|
||||||
|
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
|
||||||
|
int freesrc,
|
||||||
|
SDL_AudioSpec * spec,
|
||||||
|
Uint8 ** audio_buf,
|
||||||
|
Uint32 * audio_len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a WAV from a file.
|
||||||
|
* Compatibility convenience function.
|
||||||
|
*/
|
||||||
|
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
||||||
|
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function takes a source format and rate and a destination format
|
||||||
|
* and rate, and initializes the \c cvt structure with information needed
|
||||||
|
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
||||||
|
* to the other.
|
||||||
|
*
|
||||||
|
* \return -1 if the format conversion is not supported, 0 if there's
|
||||||
|
* no conversion needed, or 1 if the audio filter is set up.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
||||||
|
SDL_AudioFormat src_format,
|
||||||
|
Uint8 src_channels,
|
||||||
|
int src_rate,
|
||||||
|
SDL_AudioFormat dst_format,
|
||||||
|
Uint8 dst_channels,
|
||||||
|
int dst_rate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
|
||||||
|
* created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
|
||||||
|
* audio data in the source format, this function will convert it in-place
|
||||||
|
* to the desired format.
|
||||||
|
*
|
||||||
|
* The data conversion may expand the size of the audio data, so the buffer
|
||||||
|
* \c cvt->buf should be allocated after the \c cvt structure is initialized by
|
||||||
|
* SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
|
||||||
|
|
||||||
|
#define SDL_MIX_MAXVOLUME 128
|
||||||
|
/**
|
||||||
|
* This takes two audio buffers of the playing audio format and mixes
|
||||||
|
* them, performing addition, volume adjustment, and overflow clipping.
|
||||||
|
* The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
|
||||||
|
* for full audio volume. Note this does not change hardware volume.
|
||||||
|
* This is provided for convenience -- you can mix your own audio data.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
|
||||||
|
Uint32 len, int volume);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This works like SDL_MixAudio(), but you specify the audio format instead of
|
||||||
|
* using the format of audio device 1. Thus it can be used when no audio
|
||||||
|
* device is open at all.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
|
||||||
|
const Uint8 * src,
|
||||||
|
SDL_AudioFormat format,
|
||||||
|
Uint32 len, int volume);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue more audio on non-callback devices.
|
||||||
|
*
|
||||||
|
* SDL offers two ways to feed audio to the device: you can either supply a
|
||||||
|
* callback that SDL triggers with some frequency to obtain more audio
|
||||||
|
* (pull method), or you can supply no callback, and then SDL will expect
|
||||||
|
* you to supply data at regular intervals (push method) with this function.
|
||||||
|
*
|
||||||
|
* There are no limits on the amount of data you can queue, short of
|
||||||
|
* exhaustion of address space. Queued data will drain to the device as
|
||||||
|
* necessary without further intervention from you. If the device needs
|
||||||
|
* audio but there is not enough queued, it will play silence to make up
|
||||||
|
* the difference. This means you will have skips in your audio playback
|
||||||
|
* if you aren't routinely queueing sufficient data.
|
||||||
|
*
|
||||||
|
* This function copies the supplied data, so you are safe to free it when
|
||||||
|
* the function returns. This function is thread-safe, but queueing to the
|
||||||
|
* same device from two threads at once does not promise which buffer will
|
||||||
|
* be queued first.
|
||||||
|
*
|
||||||
|
* You may not queue audio on a device that is using an application-supplied
|
||||||
|
* callback; doing so returns an error. You have to use the audio callback
|
||||||
|
* or queue audio with this function, but not both.
|
||||||
|
*
|
||||||
|
* You should not call SDL_LockAudio() on the device before queueing; SDL
|
||||||
|
* handles locking internally for this function.
|
||||||
|
*
|
||||||
|
* \param dev The device ID to which we will queue audio.
|
||||||
|
* \param data The data to queue to the device for later playback.
|
||||||
|
* \param len The number of bytes (not samples!) to which (data) points.
|
||||||
|
* \return zero on success, -1 on error.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetQueuedAudioSize
|
||||||
|
* \sa SDL_ClearQueuedAudio
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of bytes of still-queued audio.
|
||||||
|
*
|
||||||
|
* This is the number of bytes that have been queued for playback with
|
||||||
|
* SDL_QueueAudio(), but have not yet been sent to the hardware.
|
||||||
|
*
|
||||||
|
* Once we've sent it to the hardware, this function can not decide the exact
|
||||||
|
* byte boundary of what has been played. It's possible that we just gave the
|
||||||
|
* hardware several kilobytes right before you called this function, but it
|
||||||
|
* hasn't played any of it yet, or maybe half of it, etc.
|
||||||
|
*
|
||||||
|
* You may not queue audio on a device that is using an application-supplied
|
||||||
|
* callback; calling this function on such a device always returns 0.
|
||||||
|
* You have to use the audio callback or queue audio with SDL_QueueAudio(),
|
||||||
|
* but not both.
|
||||||
|
*
|
||||||
|
* You should not call SDL_LockAudio() on the device before querying; SDL
|
||||||
|
* handles locking internally for this function.
|
||||||
|
*
|
||||||
|
* \param dev The device ID of which we will query queued audio size.
|
||||||
|
* \return Number of bytes (not samples!) of queued audio.
|
||||||
|
*
|
||||||
|
* \sa SDL_QueueAudio
|
||||||
|
* \sa SDL_ClearQueuedAudio
|
||||||
|
*/
|
||||||
|
extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop any queued audio data waiting to be sent to the hardware.
|
||||||
|
*
|
||||||
|
* Immediately after this call, SDL_GetQueuedAudioSize() will return 0 and
|
||||||
|
* the hardware will start playing silence if more audio isn't queued.
|
||||||
|
*
|
||||||
|
* This will not prevent playback of queued audio that's already been sent
|
||||||
|
* to the hardware, as we can not undo that, so expect there to be some
|
||||||
|
* fraction of a second of audio that might still be heard. This can be
|
||||||
|
* useful if you want to, say, drop any pending music during a level change
|
||||||
|
* in your game.
|
||||||
|
*
|
||||||
|
* You may not queue audio on a device that is using an application-supplied
|
||||||
|
* callback; calling this function on such a device is always a no-op.
|
||||||
|
* You have to use the audio callback or queue audio with SDL_QueueAudio(),
|
||||||
|
* but not both.
|
||||||
|
*
|
||||||
|
* You should not call SDL_LockAudio() on the device before clearing the
|
||||||
|
* queue; SDL handles locking internally for this function.
|
||||||
|
*
|
||||||
|
* This function always succeeds and thus returns void.
|
||||||
|
*
|
||||||
|
* \param dev The device ID of which to clear the audio queue.
|
||||||
|
*
|
||||||
|
* \sa SDL_QueueAudio
|
||||||
|
* \sa SDL_GetQueuedAudioSize
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Audio lock functions
|
||||||
|
*
|
||||||
|
* The lock manipulated by these functions protects the callback function.
|
||||||
|
* During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
|
||||||
|
* the callback function is not running. Do not call these from the callback
|
||||||
|
* function or you will cause deadlock.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
||||||
|
extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
|
||||||
|
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
||||||
|
extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
|
||||||
|
/* @} *//* Audio lock functions */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function shuts down audio processing and closes the audio device.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
||||||
|
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _SDL_audio_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
Vendored
+97
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_bits.h
|
||||||
|
*
|
||||||
|
* Functions for fiddling with bits and bitmasks.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_bits_h
|
||||||
|
#define _SDL_bits_h
|
||||||
|
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_bits.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the index of the most significant bit. Result is undefined when called
|
||||||
|
* with 0. This operation can also be stated as "count leading zeroes" and
|
||||||
|
* "log base 2".
|
||||||
|
*
|
||||||
|
* \return Index of the most significant bit, or -1 if the value is 0.
|
||||||
|
*/
|
||||||
|
SDL_FORCE_INLINE int
|
||||||
|
SDL_MostSignificantBitIndex32(Uint32 x)
|
||||||
|
{
|
||||||
|
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||||
|
/* Count Leading Zeroes builtin in GCC.
|
||||||
|
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
|
||||||
|
*/
|
||||||
|
if (x == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 31 - __builtin_clz(x);
|
||||||
|
#else
|
||||||
|
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
|
||||||
|
* <seander@cs.stanford.edu>, released in the public domain.
|
||||||
|
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
|
||||||
|
*/
|
||||||
|
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
|
||||||
|
const int S[] = {1, 2, 4, 8, 16};
|
||||||
|
|
||||||
|
int msbIndex = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (x == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 4; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (x & b[i])
|
||||||
|
{
|
||||||
|
x >>= S[i];
|
||||||
|
msbIndex |= S[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return msbIndex;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _SDL_bits_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_blendmode.h
|
||||||
|
*
|
||||||
|
* Header file declaring the SDL_BlendMode enumeration
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_blendmode_h
|
||||||
|
#define _SDL_blendmode_h
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
|
||||||
|
dstRGBA = srcRGBA */
|
||||||
|
SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
|
||||||
|
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
|
||||||
|
dstA = srcA + (dstA * (1-srcA)) */
|
||||||
|
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
|
||||||
|
dstRGB = (srcRGB * srcA) + dstRGB
|
||||||
|
dstA = dstA */
|
||||||
|
SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate
|
||||||
|
dstRGB = srcRGB * dstRGB
|
||||||
|
dstA = dstA */
|
||||||
|
} SDL_BlendMode;
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _SDL_blendmode_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_clipboard.h
|
||||||
|
*
|
||||||
|
* Include file for SDL clipboard handling
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_clipboard_h
|
||||||
|
#define _SDL_clipboard_h
|
||||||
|
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Put UTF-8 text into the clipboard
|
||||||
|
*
|
||||||
|
* \sa SDL_GetClipboardText()
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
|
||||||
|
*
|
||||||
|
* \sa SDL_SetClipboardText()
|
||||||
|
*/
|
||||||
|
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
|
||||||
|
*
|
||||||
|
* \sa SDL_GetClipboardText()
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* _SDL_clipboard_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
Appli/Middlewares/ST/touchgfx/framework/include/platform/hal/simulator/sdl2/vendor/SDL2/SDL_config.h
Vendored
+55
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_h
|
||||||
|
#define _SDL_config_h
|
||||||
|
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_config.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Add any platform that doesn't build using the configure system. */
|
||||||
|
#ifdef USING_PREMAKE_CONFIG_H
|
||||||
|
#include "SDL_config_premake.h"
|
||||||
|
#elif defined(__WIN32__)
|
||||||
|
#include "SDL_config_windows.h"
|
||||||
|
#elif defined(__WINRT__)
|
||||||
|
#include "SDL_config_winrt.h"
|
||||||
|
#elif defined(__MACOSX__)
|
||||||
|
#include "SDL_config_macosx.h"
|
||||||
|
#elif defined(__IPHONEOS__)
|
||||||
|
#include "SDL_config_iphoneos.h"
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#include "SDL_config_android.h"
|
||||||
|
#elif defined(__PSP__)
|
||||||
|
#include "SDL_config_psp.h"
|
||||||
|
#else
|
||||||
|
/* This is a minimal configuration just to get SDL running on new platforms */
|
||||||
|
#include "SDL_config_minimal.h"
|
||||||
|
#endif /* platform config */
|
||||||
|
|
||||||
|
#ifdef USING_GENERATED_CONFIG_H
|
||||||
|
#error Wrong SDL_config.h, check your include path?
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SDL_config_h */
|
||||||
+419
@@ -0,0 +1,419 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_h
|
||||||
|
#define _SDL_config_h
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_config.h.in
|
||||||
|
*
|
||||||
|
* This is a set of defines to configure the SDL features
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* General platform specific identifiers */
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/* C language features */
|
||||||
|
#cmakedefine const @HAVE_CONST@
|
||||||
|
#cmakedefine inline @HAVE_INLINE@
|
||||||
|
#cmakedefine volatile @HAVE_VOLATILE@
|
||||||
|
|
||||||
|
/* C datatypes */
|
||||||
|
/* Define SIZEOF_VOIDP for 64/32 architectures */
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define SIZEOF_VOIDP 8
|
||||||
|
#else
|
||||||
|
#define SIZEOF_VOIDP 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@
|
||||||
|
#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
|
||||||
|
|
||||||
|
#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
|
||||||
|
#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
|
||||||
|
#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
|
||||||
|
#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
|
||||||
|
#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
|
||||||
|
#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@
|
||||||
|
#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
|
||||||
|
#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
|
||||||
|
|
||||||
|
/* Comment this if you want to build without any C library requirements */
|
||||||
|
#cmakedefine HAVE_LIBC 1
|
||||||
|
#if HAVE_LIBC
|
||||||
|
|
||||||
|
/* Useful headers */
|
||||||
|
#cmakedefine HAVE_ALLOCA_H 1
|
||||||
|
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||||
|
#cmakedefine HAVE_STDIO_H 1
|
||||||
|
#cmakedefine STDC_HEADERS 1
|
||||||
|
#cmakedefine HAVE_STDLIB_H 1
|
||||||
|
#cmakedefine HAVE_STDARG_H 1
|
||||||
|
#cmakedefine HAVE_MALLOC_H 1
|
||||||
|
#cmakedefine HAVE_MEMORY_H 1
|
||||||
|
#cmakedefine HAVE_STRING_H 1
|
||||||
|
#cmakedefine HAVE_STRINGS_H 1
|
||||||
|
#cmakedefine HAVE_INTTYPES_H 1
|
||||||
|
#cmakedefine HAVE_STDINT_H 1
|
||||||
|
#cmakedefine HAVE_CTYPE_H 1
|
||||||
|
#cmakedefine HAVE_MATH_H 1
|
||||||
|
#cmakedefine HAVE_ICONV_H 1
|
||||||
|
#cmakedefine HAVE_SIGNAL_H 1
|
||||||
|
#cmakedefine HAVE_ALTIVEC_H 1
|
||||||
|
#cmakedefine HAVE_PTHREAD_NP_H 1
|
||||||
|
#cmakedefine HAVE_LIBUDEV_H 1
|
||||||
|
#cmakedefine HAVE_DBUS_DBUS_H 1
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#cmakedefine HAVE_MALLOC 1
|
||||||
|
#cmakedefine HAVE_CALLOC 1
|
||||||
|
#cmakedefine HAVE_REALLOC 1
|
||||||
|
#cmakedefine HAVE_FREE 1
|
||||||
|
#cmakedefine HAVE_ALLOCA 1
|
||||||
|
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
|
||||||
|
#cmakedefine HAVE_GETENV 1
|
||||||
|
#cmakedefine HAVE_SETENV 1
|
||||||
|
#cmakedefine HAVE_PUTENV 1
|
||||||
|
#cmakedefine HAVE_UNSETENV 1
|
||||||
|
#endif
|
||||||
|
#cmakedefine HAVE_QSORT 1
|
||||||
|
#cmakedefine HAVE_ABS 1
|
||||||
|
#cmakedefine HAVE_BCOPY 1
|
||||||
|
#cmakedefine HAVE_MEMSET 1
|
||||||
|
#cmakedefine HAVE_MEMCPY 1
|
||||||
|
#cmakedefine HAVE_MEMMOVE 1
|
||||||
|
#cmakedefine HAVE_MEMCMP 1
|
||||||
|
#cmakedefine HAVE_STRLEN 1
|
||||||
|
#cmakedefine HAVE_STRLCPY 1
|
||||||
|
#cmakedefine HAVE_STRLCAT 1
|
||||||
|
#cmakedefine HAVE_STRDUP 1
|
||||||
|
#cmakedefine HAVE__STRREV 1
|
||||||
|
#cmakedefine HAVE__STRUPR 1
|
||||||
|
#cmakedefine HAVE__STRLWR 1
|
||||||
|
#cmakedefine HAVE_INDEX 1
|
||||||
|
#cmakedefine HAVE_RINDEX 1
|
||||||
|
#cmakedefine HAVE_STRCHR 1
|
||||||
|
#cmakedefine HAVE_STRRCHR 1
|
||||||
|
#cmakedefine HAVE_STRSTR 1
|
||||||
|
#cmakedefine HAVE_ITOA 1
|
||||||
|
#cmakedefine HAVE__LTOA 1
|
||||||
|
#cmakedefine HAVE__UITOA 1
|
||||||
|
#cmakedefine HAVE__ULTOA 1
|
||||||
|
#cmakedefine HAVE_STRTOL 1
|
||||||
|
#cmakedefine HAVE_STRTOUL 1
|
||||||
|
#cmakedefine HAVE__I64TOA 1
|
||||||
|
#cmakedefine HAVE__UI64TOA 1
|
||||||
|
#cmakedefine HAVE_STRTOLL 1
|
||||||
|
#cmakedefine HAVE_STRTOULL 1
|
||||||
|
#cmakedefine HAVE_STRTOD 1
|
||||||
|
#cmakedefine HAVE_ATOI 1
|
||||||
|
#cmakedefine HAVE_ATOF 1
|
||||||
|
#cmakedefine HAVE_STRCMP 1
|
||||||
|
#cmakedefine HAVE_STRNCMP 1
|
||||||
|
#cmakedefine HAVE__STRICMP 1
|
||||||
|
#cmakedefine HAVE_STRCASECMP 1
|
||||||
|
#cmakedefine HAVE__STRNICMP 1
|
||||||
|
#cmakedefine HAVE_STRNCASECMP 1
|
||||||
|
#cmakedefine HAVE_VSSCANF 1
|
||||||
|
#cmakedefine HAVE_VSNPRINTF 1
|
||||||
|
#cmakedefine HAVE_M_PI 1
|
||||||
|
#cmakedefine HAVE_ATAN 1
|
||||||
|
#cmakedefine HAVE_ATAN2 1
|
||||||
|
#cmakedefine HAVE_ACOS 1
|
||||||
|
#cmakedefine HAVE_ASIN 1
|
||||||
|
#cmakedefine HAVE_CEIL 1
|
||||||
|
#cmakedefine HAVE_COPYSIGN 1
|
||||||
|
#cmakedefine HAVE_COS 1
|
||||||
|
#cmakedefine HAVE_COSF 1
|
||||||
|
#cmakedefine HAVE_FABS 1
|
||||||
|
#cmakedefine HAVE_FLOOR 1
|
||||||
|
#cmakedefine HAVE_LOG 1
|
||||||
|
#cmakedefine HAVE_POW 1
|
||||||
|
#cmakedefine HAVE_SCALBN 1
|
||||||
|
#cmakedefine HAVE_SIN 1
|
||||||
|
#cmakedefine HAVE_SINF 1
|
||||||
|
#cmakedefine HAVE_SQRT 1
|
||||||
|
#cmakedefine HAVE_SQRTF 1
|
||||||
|
#cmakedefine HAVE_TAN 1
|
||||||
|
#cmakedefine HAVE_TANF 1
|
||||||
|
#cmakedefine HAVE_FSEEKO 1
|
||||||
|
#cmakedefine HAVE_FSEEKO64 1
|
||||||
|
#cmakedefine HAVE_SIGACTION 1
|
||||||
|
#cmakedefine HAVE_SA_SIGACTION 1
|
||||||
|
#cmakedefine HAVE_SETJMP 1
|
||||||
|
#cmakedefine HAVE_NANOSLEEP 1
|
||||||
|
#cmakedefine HAVE_SYSCONF 1
|
||||||
|
#cmakedefine HAVE_SYSCTLBYNAME 1
|
||||||
|
#cmakedefine HAVE_CLOCK_GETTIME 1
|
||||||
|
#cmakedefine HAVE_GETPAGESIZE 1
|
||||||
|
#cmakedefine HAVE_MPROTECT 1
|
||||||
|
#cmakedefine HAVE_ICONV 1
|
||||||
|
#cmakedefine HAVE_PTHREAD_SETNAME_NP 1
|
||||||
|
#cmakedefine HAVE_PTHREAD_SET_NAME_NP 1
|
||||||
|
#cmakedefine HAVE_SEM_TIMEDWAIT 1
|
||||||
|
#elif __WIN32__
|
||||||
|
#cmakedefine HAVE_STDARG_H 1
|
||||||
|
#cmakedefine HAVE_STDDEF_H 1
|
||||||
|
#else
|
||||||
|
/* We may need some replacement for stdarg.h here */
|
||||||
|
#include <stdarg.h>
|
||||||
|
#endif /* HAVE_LIBC */
|
||||||
|
|
||||||
|
/* SDL internal assertion support */
|
||||||
|
#cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@
|
||||||
|
|
||||||
|
/* Allow disabling of core subsystems */
|
||||||
|
#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@
|
||||||
|
#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@
|
||||||
|
#cmakedefine SDL_CPUINFO_DISABLED @SDL_CPUINFO_DISABLED@
|
||||||
|
#cmakedefine SDL_EVENTS_DISABLED @SDL_EVENTS_DISABLED@
|
||||||
|
#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
|
||||||
|
#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
|
||||||
|
#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
|
||||||
|
#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@
|
||||||
|
#cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@
|
||||||
|
#cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@
|
||||||
|
#cmakedefine SDL_TIMERS_DISABLED @SDL_TIMERS_DISABLED@
|
||||||
|
#cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@
|
||||||
|
#cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@
|
||||||
|
#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@
|
||||||
|
|
||||||
|
/* Enable various audio drivers */
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_BSD @SDL_AUDIO_DRIVER_BSD@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
|
||||||
|
#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
|
||||||
|
|
||||||
|
/* Enable various input drivers */
|
||||||
|
#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
|
||||||
|
#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
|
||||||
|
#cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
|
||||||
|
#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
|
||||||
|
#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
|
||||||
|
#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@
|
||||||
|
#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
|
||||||
|
#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
|
||||||
|
#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
|
||||||
|
#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@
|
||||||
|
#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
|
||||||
|
#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
|
||||||
|
#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
|
||||||
|
#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@
|
||||||
|
#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@
|
||||||
|
#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@
|
||||||
|
#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@
|
||||||
|
#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
|
||||||
|
#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
|
||||||
|
#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
|
||||||
|
|
||||||
|
/* Enable various shared object loading systems */
|
||||||
|
#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@
|
||||||
|
#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
|
||||||
|
#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
|
||||||
|
#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@
|
||||||
|
#cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@
|
||||||
|
|
||||||
|
/* Enable various threading systems */
|
||||||
|
#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@
|
||||||
|
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@
|
||||||
|
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
|
||||||
|
#cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@
|
||||||
|
|
||||||
|
/* Enable various timer systems */
|
||||||
|
#cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@
|
||||||
|
#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@
|
||||||
|
#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@
|
||||||
|
#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@
|
||||||
|
#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
|
||||||
|
|
||||||
|
/* Enable various video drivers */
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
|
||||||
|
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@
|
||||||
|
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@
|
||||||
|
|
||||||
|
#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@
|
||||||
|
#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@
|
||||||
|
#cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@
|
||||||
|
#cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@
|
||||||
|
#cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
|
||||||
|
#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
|
||||||
|
|
||||||
|
/* Enable OpenGL support */
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_ES @SDL_VIDEO_OPENGL_ES@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_ES2 @SDL_VIDEO_OPENGL_ES2@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_BGL @SDL_VIDEO_OPENGL_BGL@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_CGL @SDL_VIDEO_OPENGL_CGL@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_GLX @SDL_VIDEO_OPENGL_GLX@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_WGL @SDL_VIDEO_OPENGL_WGL@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_EGL @SDL_VIDEO_OPENGL_EGL@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
|
||||||
|
#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
|
||||||
|
|
||||||
|
/* Enable system power support */
|
||||||
|
#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
|
||||||
|
#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
|
||||||
|
#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
|
||||||
|
#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
|
||||||
|
#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
|
||||||
|
#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
|
||||||
|
#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
|
||||||
|
|
||||||
|
/* Enable system filesystem support */
|
||||||
|
#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@
|
||||||
|
#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@
|
||||||
|
#cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@
|
||||||
|
#cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@
|
||||||
|
#cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@
|
||||||
|
#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@
|
||||||
|
#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@
|
||||||
|
|
||||||
|
/* Enable assembly routines */
|
||||||
|
#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
|
||||||
|
#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
|
||||||
|
|
||||||
|
|
||||||
|
/* Platform specific definitions */
|
||||||
|
#if !defined(__WIN32__)
|
||||||
|
# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
typedef signed char int8_t;
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef signed short int16_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
typedef signed int int32_t;
|
||||||
|
typedef unsigned int uint32_t;
|
||||||
|
typedef signed long long int64_t;
|
||||||
|
typedef unsigned long long uint64_t;
|
||||||
|
typedef unsigned long uintptr_t;
|
||||||
|
# endif /* if (stdint.h isn't available) */
|
||||||
|
#else /* __WIN32__ */
|
||||||
|
# if !defined(_STDINT_H_) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
|
||||||
|
# if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
typedef signed __int8 int8_t;
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef signed __int16 int16_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
# ifndef _UINTPTR_T_DEFINED
|
||||||
|
# ifdef _WIN64
|
||||||
|
typedef unsigned __int64 uintptr_t;
|
||||||
|
# else
|
||||||
|
typedef unsigned int uintptr_t;
|
||||||
|
# endif
|
||||||
|
#define _UINTPTR_T_DEFINED
|
||||||
|
# endif
|
||||||
|
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
||||||
|
# if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
|
||||||
|
#define DWORD_PTR DWORD
|
||||||
|
# endif
|
||||||
|
# if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
|
||||||
|
#define LONG_PTR LONG
|
||||||
|
# endif
|
||||||
|
# else /* !__GNUC__ && !_MSC_VER */
|
||||||
|
typedef signed char int8_t;
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef signed short int16_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
typedef signed int int32_t;
|
||||||
|
typedef unsigned int uint32_t;
|
||||||
|
typedef signed long long int64_t;
|
||||||
|
typedef unsigned long long uint64_t;
|
||||||
|
# ifndef _SIZE_T_DEFINED_
|
||||||
|
#define _SIZE_T_DEFINED_
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
# endif
|
||||||
|
typedef unsigned int uintptr_t;
|
||||||
|
# endif /* __GNUC__ || _MSC_VER */
|
||||||
|
# endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||||
|
#endif /* __WIN32__ */
|
||||||
|
|
||||||
|
#endif /* _SDL_config_h */
|
||||||
+359
@@ -0,0 +1,359 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_h
|
||||||
|
#define _SDL_config_h
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_config.h.in
|
||||||
|
*
|
||||||
|
* This is a set of defines to configure the SDL features
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* General platform specific identifiers */
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/* Make sure that this isn't included by Visual C++ */
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#error You should run hg revert SDL_config.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* C language features */
|
||||||
|
#undef const
|
||||||
|
#undef inline
|
||||||
|
#undef volatile
|
||||||
|
|
||||||
|
/* C datatypes */
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define SIZEOF_VOIDP 8
|
||||||
|
#else
|
||||||
|
#define SIZEOF_VOIDP 4
|
||||||
|
#endif
|
||||||
|
#undef HAVE_GCC_ATOMICS
|
||||||
|
#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
|
||||||
|
|
||||||
|
#undef HAVE_DDRAW_H
|
||||||
|
#undef HAVE_DINPUT_H
|
||||||
|
#undef HAVE_DSOUND_H
|
||||||
|
#undef HAVE_DXGI_H
|
||||||
|
#undef HAVE_XINPUT_H
|
||||||
|
|
||||||
|
/* Comment this if you want to build without any C library requirements */
|
||||||
|
#undef HAVE_LIBC
|
||||||
|
#if HAVE_LIBC
|
||||||
|
|
||||||
|
/* Useful headers */
|
||||||
|
#undef HAVE_ALLOCA_H
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
#undef HAVE_STDIO_H
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
#undef HAVE_STDARG_H
|
||||||
|
#undef HAVE_MALLOC_H
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
#undef HAVE_CTYPE_H
|
||||||
|
#undef HAVE_MATH_H
|
||||||
|
#undef HAVE_ICONV_H
|
||||||
|
#undef HAVE_SIGNAL_H
|
||||||
|
#undef HAVE_ALTIVEC_H
|
||||||
|
#undef HAVE_PTHREAD_NP_H
|
||||||
|
#undef HAVE_LIBUDEV_H
|
||||||
|
#undef HAVE_DBUS_DBUS_H
|
||||||
|
#undef HAVE_IBUS_IBUS_H
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#undef HAVE_MALLOC
|
||||||
|
#undef HAVE_CALLOC
|
||||||
|
#undef HAVE_REALLOC
|
||||||
|
#undef HAVE_FREE
|
||||||
|
#undef HAVE_ALLOCA
|
||||||
|
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
|
||||||
|
#undef HAVE_GETENV
|
||||||
|
#undef HAVE_SETENV
|
||||||
|
#undef HAVE_PUTENV
|
||||||
|
#undef HAVE_UNSETENV
|
||||||
|
#endif
|
||||||
|
#undef HAVE_QSORT
|
||||||
|
#undef HAVE_ABS
|
||||||
|
#undef HAVE_BCOPY
|
||||||
|
#undef HAVE_MEMSET
|
||||||
|
#undef HAVE_MEMCPY
|
||||||
|
#undef HAVE_MEMMOVE
|
||||||
|
#undef HAVE_MEMCMP
|
||||||
|
#undef HAVE_STRLEN
|
||||||
|
#undef HAVE_STRLCPY
|
||||||
|
#undef HAVE_STRLCAT
|
||||||
|
#undef HAVE_STRDUP
|
||||||
|
#undef HAVE__STRREV
|
||||||
|
#undef HAVE__STRUPR
|
||||||
|
#undef HAVE__STRLWR
|
||||||
|
#undef HAVE_INDEX
|
||||||
|
#undef HAVE_RINDEX
|
||||||
|
#undef HAVE_STRCHR
|
||||||
|
#undef HAVE_STRRCHR
|
||||||
|
#undef HAVE_STRSTR
|
||||||
|
#undef HAVE_ITOA
|
||||||
|
#undef HAVE__LTOA
|
||||||
|
#undef HAVE__UITOA
|
||||||
|
#undef HAVE__ULTOA
|
||||||
|
#undef HAVE_STRTOL
|
||||||
|
#undef HAVE_STRTOUL
|
||||||
|
#undef HAVE__I64TOA
|
||||||
|
#undef HAVE__UI64TOA
|
||||||
|
#undef HAVE_STRTOLL
|
||||||
|
#undef HAVE_STRTOULL
|
||||||
|
#undef HAVE_STRTOD
|
||||||
|
#undef HAVE_ATOI
|
||||||
|
#undef HAVE_ATOF
|
||||||
|
#undef HAVE_STRCMP
|
||||||
|
#undef HAVE_STRNCMP
|
||||||
|
#undef HAVE__STRICMP
|
||||||
|
#undef HAVE_STRCASECMP
|
||||||
|
#undef HAVE__STRNICMP
|
||||||
|
#undef HAVE_STRNCASECMP
|
||||||
|
#undef HAVE_SSCANF
|
||||||
|
#undef HAVE_VSSCANF
|
||||||
|
#undef HAVE_SNPRINTF
|
||||||
|
#undef HAVE_VSNPRINTF
|
||||||
|
#undef HAVE_M_PI
|
||||||
|
#undef HAVE_ATAN
|
||||||
|
#undef HAVE_ATAN2
|
||||||
|
#undef HAVE_ACOS
|
||||||
|
#undef HAVE_ASIN
|
||||||
|
#undef HAVE_CEIL
|
||||||
|
#undef HAVE_COPYSIGN
|
||||||
|
#undef HAVE_COS
|
||||||
|
#undef HAVE_COSF
|
||||||
|
#undef HAVE_FABS
|
||||||
|
#undef HAVE_FLOOR
|
||||||
|
#undef HAVE_LOG
|
||||||
|
#undef HAVE_POW
|
||||||
|
#undef HAVE_SCALBN
|
||||||
|
#undef HAVE_SIN
|
||||||
|
#undef HAVE_SINF
|
||||||
|
#undef HAVE_SQRT
|
||||||
|
#undef HAVE_SQRTF
|
||||||
|
#undef HAVE_TAN
|
||||||
|
#undef HAVE_TANF
|
||||||
|
#undef HAVE_FSEEKO
|
||||||
|
#undef HAVE_FSEEKO64
|
||||||
|
#undef HAVE_SIGACTION
|
||||||
|
#undef HAVE_SA_SIGACTION
|
||||||
|
#undef HAVE_SETJMP
|
||||||
|
#undef HAVE_NANOSLEEP
|
||||||
|
#undef HAVE_SYSCONF
|
||||||
|
#undef HAVE_SYSCTLBYNAME
|
||||||
|
#undef HAVE_CLOCK_GETTIME
|
||||||
|
#undef HAVE_GETPAGESIZE
|
||||||
|
#undef HAVE_MPROTECT
|
||||||
|
#undef HAVE_ICONV
|
||||||
|
#undef HAVE_PTHREAD_SETNAME_NP
|
||||||
|
#undef HAVE_PTHREAD_SET_NAME_NP
|
||||||
|
#undef HAVE_SEM_TIMEDWAIT
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define HAVE_STDARG_H 1
|
||||||
|
#define HAVE_STDDEF_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#endif /* HAVE_LIBC */
|
||||||
|
|
||||||
|
/* SDL internal assertion support */
|
||||||
|
#undef SDL_DEFAULT_ASSERT_LEVEL
|
||||||
|
|
||||||
|
/* Allow disabling of core subsystems */
|
||||||
|
#undef SDL_ATOMIC_DISABLED
|
||||||
|
#undef SDL_AUDIO_DISABLED
|
||||||
|
#undef SDL_CPUINFO_DISABLED
|
||||||
|
#undef SDL_EVENTS_DISABLED
|
||||||
|
#undef SDL_FILE_DISABLED
|
||||||
|
#undef SDL_JOYSTICK_DISABLED
|
||||||
|
#undef SDL_HAPTIC_DISABLED
|
||||||
|
#undef SDL_LOADSO_DISABLED
|
||||||
|
#undef SDL_RENDER_DISABLED
|
||||||
|
#undef SDL_THREADS_DISABLED
|
||||||
|
#undef SDL_TIMERS_DISABLED
|
||||||
|
#undef SDL_VIDEO_DISABLED
|
||||||
|
#undef SDL_POWER_DISABLED
|
||||||
|
#undef SDL_FILESYSTEM_DISABLED
|
||||||
|
|
||||||
|
/* Enable various audio drivers */
|
||||||
|
#undef SDL_AUDIO_DRIVER_ALSA
|
||||||
|
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
|
||||||
|
#undef SDL_AUDIO_DRIVER_ARTS
|
||||||
|
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
|
||||||
|
#undef SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||||
|
#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
|
||||||
|
#undef SDL_AUDIO_DRIVER_HAIKU
|
||||||
|
#undef SDL_AUDIO_DRIVER_BSD
|
||||||
|
#undef SDL_AUDIO_DRIVER_COREAUDIO
|
||||||
|
#undef SDL_AUDIO_DRIVER_DISK
|
||||||
|
#undef SDL_AUDIO_DRIVER_DUMMY
|
||||||
|
#undef SDL_AUDIO_DRIVER_ANDROID
|
||||||
|
#undef SDL_AUDIO_DRIVER_XAUDIO2
|
||||||
|
#undef SDL_AUDIO_DRIVER_DSOUND
|
||||||
|
#undef SDL_AUDIO_DRIVER_ESD
|
||||||
|
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
|
||||||
|
#undef SDL_AUDIO_DRIVER_NACL
|
||||||
|
#undef SDL_AUDIO_DRIVER_NAS
|
||||||
|
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
|
||||||
|
#undef SDL_AUDIO_DRIVER_SNDIO
|
||||||
|
#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
|
||||||
|
#undef SDL_AUDIO_DRIVER_OSS
|
||||||
|
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
|
||||||
|
#undef SDL_AUDIO_DRIVER_PAUDIO
|
||||||
|
#undef SDL_AUDIO_DRIVER_QSA
|
||||||
|
#undef SDL_AUDIO_DRIVER_SUNAUDIO
|
||||||
|
#undef SDL_AUDIO_DRIVER_WINMM
|
||||||
|
#undef SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||||
|
#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
|
||||||
|
#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
|
||||||
|
|
||||||
|
/* Enable various input drivers */
|
||||||
|
#undef SDL_INPUT_LINUXEV
|
||||||
|
#undef SDL_INPUT_LINUXKD
|
||||||
|
#undef SDL_INPUT_TSLIB
|
||||||
|
#undef SDL_JOYSTICK_HAIKU
|
||||||
|
#undef SDL_JOYSTICK_DINPUT
|
||||||
|
#undef SDL_JOYSTICK_XINPUT
|
||||||
|
#undef SDL_JOYSTICK_DUMMY
|
||||||
|
#undef SDL_JOYSTICK_IOKIT
|
||||||
|
#undef SDL_JOYSTICK_LINUX
|
||||||
|
#undef SDL_JOYSTICK_ANDROID
|
||||||
|
#undef SDL_JOYSTICK_WINMM
|
||||||
|
#undef SDL_JOYSTICK_USBHID
|
||||||
|
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
||||||
|
#undef SDL_JOYSTICK_EMSCRIPTEN
|
||||||
|
#undef SDL_HAPTIC_DUMMY
|
||||||
|
#undef SDL_HAPTIC_LINUX
|
||||||
|
#undef SDL_HAPTIC_IOKIT
|
||||||
|
#undef SDL_HAPTIC_DINPUT
|
||||||
|
#undef SDL_HAPTIC_XINPUT
|
||||||
|
|
||||||
|
/* Enable various shared object loading systems */
|
||||||
|
#undef SDL_LOADSO_HAIKU
|
||||||
|
#undef SDL_LOADSO_DLOPEN
|
||||||
|
#undef SDL_LOADSO_DUMMY
|
||||||
|
#undef SDL_LOADSO_LDG
|
||||||
|
#undef SDL_LOADSO_WINDOWS
|
||||||
|
|
||||||
|
/* Enable various threading systems */
|
||||||
|
#undef SDL_THREAD_PTHREAD
|
||||||
|
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
||||||
|
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
|
||||||
|
#undef SDL_THREAD_WINDOWS
|
||||||
|
|
||||||
|
/* Enable various timer systems */
|
||||||
|
#undef SDL_TIMER_HAIKU
|
||||||
|
#undef SDL_TIMER_DUMMY
|
||||||
|
#undef SDL_TIMER_UNIX
|
||||||
|
#undef SDL_TIMER_WINDOWS
|
||||||
|
|
||||||
|
/* Enable various video drivers */
|
||||||
|
#undef SDL_VIDEO_DRIVER_HAIKU
|
||||||
|
#undef SDL_VIDEO_DRIVER_COCOA
|
||||||
|
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
||||||
|
#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
|
||||||
|
#undef SDL_VIDEO_DRIVER_DUMMY
|
||||||
|
#undef SDL_VIDEO_DRIVER_WINDOWS
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
|
||||||
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
|
||||||
|
#undef SDL_VIDEO_DRIVER_MIR
|
||||||
|
#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC
|
||||||
|
#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11
|
||||||
|
#undef SDL_VIDEO_DRIVER_RPI
|
||||||
|
#undef SDL_VIDEO_DRIVER_ANDROID
|
||||||
|
#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XCURSOR
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XDBE
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XRANDR
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XSHAPE
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_XVIDMODE
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
|
||||||
|
#undef SDL_VIDEO_DRIVER_NACL
|
||||||
|
#undef SDL_VIDEO_DRIVER_VIVANTE
|
||||||
|
#undef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||||
|
|
||||||
|
#undef SDL_VIDEO_RENDER_D3D
|
||||||
|
#undef SDL_VIDEO_RENDER_D3D11
|
||||||
|
#undef SDL_VIDEO_RENDER_OGL
|
||||||
|
#undef SDL_VIDEO_RENDER_OGL_ES
|
||||||
|
#undef SDL_VIDEO_RENDER_OGL_ES2
|
||||||
|
#undef SDL_VIDEO_RENDER_DIRECTFB
|
||||||
|
|
||||||
|
/* Enable OpenGL support */
|
||||||
|
#undef SDL_VIDEO_OPENGL
|
||||||
|
#undef SDL_VIDEO_OPENGL_ES
|
||||||
|
#undef SDL_VIDEO_OPENGL_ES2
|
||||||
|
#undef SDL_VIDEO_OPENGL_BGL
|
||||||
|
#undef SDL_VIDEO_OPENGL_CGL
|
||||||
|
#undef SDL_VIDEO_OPENGL_EGL
|
||||||
|
#undef SDL_VIDEO_OPENGL_GLX
|
||||||
|
#undef SDL_VIDEO_OPENGL_WGL
|
||||||
|
#undef SDL_VIDEO_OPENGL_OSMESA
|
||||||
|
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
|
||||||
|
|
||||||
|
/* Enable system power support */
|
||||||
|
#undef SDL_POWER_LINUX
|
||||||
|
#undef SDL_POWER_WINDOWS
|
||||||
|
#undef SDL_POWER_MACOSX
|
||||||
|
#undef SDL_POWER_HAIKU
|
||||||
|
#undef SDL_POWER_ANDROID
|
||||||
|
#undef SDL_POWER_EMSCRIPTEN
|
||||||
|
#undef SDL_POWER_HARDWIRED
|
||||||
|
|
||||||
|
/* Enable system filesystem support */
|
||||||
|
#undef SDL_FILESYSTEM_HAIKU
|
||||||
|
#undef SDL_FILESYSTEM_COCOA
|
||||||
|
#undef SDL_FILESYSTEM_DUMMY
|
||||||
|
#undef SDL_FILESYSTEM_UNIX
|
||||||
|
#undef SDL_FILESYSTEM_WINDOWS
|
||||||
|
#undef SDL_FILESYSTEM_NACL
|
||||||
|
#undef SDL_FILESYSTEM_ANDROID
|
||||||
|
#undef SDL_FILESYSTEM_EMSCRIPTEN
|
||||||
|
|
||||||
|
/* Enable assembly routines */
|
||||||
|
#undef SDL_ASSEMBLY_ROUTINES
|
||||||
|
#undef SDL_ALTIVEC_BLITTERS
|
||||||
|
|
||||||
|
#endif /* _SDL_config_h */
|
||||||
+145
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_android_h
|
||||||
|
#define _SDL_config_android_h
|
||||||
|
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_config_android.h
|
||||||
|
*
|
||||||
|
* This is a configuration that can be used to build SDL for Android
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#define HAVE_GCC_ATOMICS 1
|
||||||
|
|
||||||
|
#define HAVE_ALLOCA_H 1
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
#define HAVE_STDIO_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
#define HAVE_ALLOCA 1
|
||||||
|
#define HAVE_GETENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
#define HAVE_QSORT 1
|
||||||
|
#define HAVE_ABS 1
|
||||||
|
#define HAVE_BCOPY 1
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
#define HAVE_MEMCMP 1
|
||||||
|
#define HAVE_STRLEN 1
|
||||||
|
#define HAVE_STRLCPY 1
|
||||||
|
#define HAVE_STRLCAT 1
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
#define HAVE_STRCHR 1
|
||||||
|
#define HAVE_STRRCHR 1
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
#define HAVE_STRTOULL 1
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_STRCMP 1
|
||||||
|
#define HAVE_STRNCMP 1
|
||||||
|
#define HAVE_STRCASECMP 1
|
||||||
|
#define HAVE_STRNCASECMP 1
|
||||||
|
#define HAVE_VSSCANF 1
|
||||||
|
#define HAVE_VSNPRINTF 1
|
||||||
|
#define HAVE_M_PI 1
|
||||||
|
#define HAVE_ATAN 1
|
||||||
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
|
#define HAVE_CEIL 1
|
||||||
|
#define HAVE_COPYSIGN 1
|
||||||
|
#define HAVE_COS 1
|
||||||
|
#define HAVE_COSF 1
|
||||||
|
#define HAVE_FABS 1
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
#define HAVE_LOG 1
|
||||||
|
#define HAVE_POW 1
|
||||||
|
#define HAVE_SCALBN 1
|
||||||
|
#define HAVE_SIN 1
|
||||||
|
#define HAVE_SINF 1
|
||||||
|
#define HAVE_SQRT 1
|
||||||
|
#define HAVE_SQRTF 1
|
||||||
|
#define HAVE_TAN 1
|
||||||
|
#define HAVE_TANF 1
|
||||||
|
#define HAVE_SETJMP 1
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
#define HAVE_SYSCONF 1
|
||||||
|
#define HAVE_CLOCK_GETTIME 1
|
||||||
|
|
||||||
|
#define SIZEOF_VOIDP 4
|
||||||
|
|
||||||
|
/* Enable various audio drivers */
|
||||||
|
#define SDL_AUDIO_DRIVER_ANDROID 1
|
||||||
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable various input drivers */
|
||||||
|
#define SDL_JOYSTICK_ANDROID 1
|
||||||
|
#define SDL_HAPTIC_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable various shared object loading systems */
|
||||||
|
#define SDL_LOADSO_DLOPEN 1
|
||||||
|
|
||||||
|
/* Enable various threading systems */
|
||||||
|
#define SDL_THREAD_PTHREAD 1
|
||||||
|
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||||
|
|
||||||
|
/* Enable various timer systems */
|
||||||
|
#define SDL_TIMER_UNIX 1
|
||||||
|
|
||||||
|
/* Enable various video drivers */
|
||||||
|
#define SDL_VIDEO_DRIVER_ANDROID 1
|
||||||
|
|
||||||
|
/* Enable OpenGL ES */
|
||||||
|
#define SDL_VIDEO_OPENGL_ES 1
|
||||||
|
#define SDL_VIDEO_OPENGL_ES2 1
|
||||||
|
#define SDL_VIDEO_OPENGL_EGL 1
|
||||||
|
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||||
|
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||||
|
|
||||||
|
/* Enable system power support */
|
||||||
|
#define SDL_POWER_ANDROID 1
|
||||||
|
|
||||||
|
/* Enable the filesystem driver */
|
||||||
|
#define SDL_FILESYSTEM_ANDROID 1
|
||||||
|
|
||||||
|
#endif /* _SDL_config_android_h */
|
||||||
+162
@@ -0,0 +1,162 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_iphoneos_h
|
||||||
|
#define _SDL_config_iphoneos_h
|
||||||
|
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define SIZEOF_VOIDP 8
|
||||||
|
#else
|
||||||
|
#define SIZEOF_VOIDP 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HAVE_GCC_ATOMICS 1
|
||||||
|
|
||||||
|
#define HAVE_ALLOCA_H 1
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
#define HAVE_STDIO_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
#define HAVE_ALLOCA 1
|
||||||
|
#define HAVE_GETENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
#define HAVE_QSORT 1
|
||||||
|
#define HAVE_ABS 1
|
||||||
|
#define HAVE_BCOPY 1
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
#define HAVE_MEMCMP 1
|
||||||
|
#define HAVE_STRLEN 1
|
||||||
|
#define HAVE_STRLCPY 1
|
||||||
|
#define HAVE_STRLCAT 1
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
#define HAVE_STRCHR 1
|
||||||
|
#define HAVE_STRRCHR 1
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
#define HAVE_STRTOULL 1
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_ATOF 1
|
||||||
|
#define HAVE_STRCMP 1
|
||||||
|
#define HAVE_STRNCMP 1
|
||||||
|
#define HAVE_STRCASECMP 1
|
||||||
|
#define HAVE_STRNCASECMP 1
|
||||||
|
#define HAVE_VSSCANF 1
|
||||||
|
#define HAVE_VSNPRINTF 1
|
||||||
|
#define HAVE_M_PI 1
|
||||||
|
#define HAVE_ATAN 1
|
||||||
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
|
#define HAVE_CEIL 1
|
||||||
|
#define HAVE_COPYSIGN 1
|
||||||
|
#define HAVE_COS 1
|
||||||
|
#define HAVE_COSF 1
|
||||||
|
#define HAVE_FABS 1
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
#define HAVE_LOG 1
|
||||||
|
#define HAVE_POW 1
|
||||||
|
#define HAVE_SCALBN 1
|
||||||
|
#define HAVE_SIN 1
|
||||||
|
#define HAVE_SINF 1
|
||||||
|
#define HAVE_SQRT 1
|
||||||
|
#define HAVE_SQRTF 1
|
||||||
|
#define HAVE_TAN 1
|
||||||
|
#define HAVE_TANF 1
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
#define HAVE_SETJMP 1
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
#define HAVE_SYSCONF 1
|
||||||
|
#define HAVE_SYSCTLBYNAME 1
|
||||||
|
|
||||||
|
/* enable iPhone version of Core Audio driver */
|
||||||
|
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||||
|
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||||
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
|
||||||
|
#define SDL_HAPTIC_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable MFi joystick support */
|
||||||
|
#define SDL_JOYSTICK_MFI 1
|
||||||
|
|
||||||
|
/* Enable Unix style SO loading */
|
||||||
|
/* Technically this works, but violates the iOS dev agreement prior to iOS 8 */
|
||||||
|
/* #define SDL_LOADSO_DLOPEN 1 */
|
||||||
|
|
||||||
|
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||||
|
#define SDL_LOADSO_DISABLED 1
|
||||||
|
|
||||||
|
/* Enable various threading systems */
|
||||||
|
#define SDL_THREAD_PTHREAD 1
|
||||||
|
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||||
|
|
||||||
|
/* Enable various timer systems */
|
||||||
|
#define SDL_TIMER_UNIX 1
|
||||||
|
|
||||||
|
/* Supported video drivers */
|
||||||
|
#define SDL_VIDEO_DRIVER_UIKIT 1
|
||||||
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
|
/* enable OpenGL ES */
|
||||||
|
#define SDL_VIDEO_OPENGL_ES2 1
|
||||||
|
#define SDL_VIDEO_OPENGL_ES 1
|
||||||
|
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||||
|
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||||
|
|
||||||
|
/* Enable system power support */
|
||||||
|
#define SDL_POWER_UIKIT 1
|
||||||
|
|
||||||
|
/* enable iPhone keyboard support */
|
||||||
|
#define SDL_IPHONE_KEYBOARD 1
|
||||||
|
|
||||||
|
/* enable iOS extended launch screen */
|
||||||
|
#define SDL_IPHONE_LAUNCHSCREEN 1
|
||||||
|
|
||||||
|
/* Set max recognized G-force from accelerometer
|
||||||
|
See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
|
||||||
|
*/
|
||||||
|
#define SDL_IPHONE_MAX_GFORCE 5.0
|
||||||
|
|
||||||
|
/* enable filesystem support */
|
||||||
|
#define SDL_FILESYSTEM_COCOA 1
|
||||||
|
|
||||||
|
#endif /* _SDL_config_iphoneos_h */
|
||||||
+188
@@ -0,0 +1,188 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_macosx_h
|
||||||
|
#define _SDL_config_macosx_h
|
||||||
|
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
|
||||||
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define SIZEOF_VOIDP 8
|
||||||
|
#else
|
||||||
|
#define SIZEOF_VOIDP 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Useful headers */
|
||||||
|
#define HAVE_ALLOCA_H 1
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
#define HAVE_STDIO_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
#define HAVE_ALLOCA 1
|
||||||
|
#define HAVE_GETENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
#define HAVE_QSORT 1
|
||||||
|
#define HAVE_ABS 1
|
||||||
|
#define HAVE_BCOPY 1
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
#define HAVE_MEMCMP 1
|
||||||
|
#define HAVE_STRLEN 1
|
||||||
|
#define HAVE_STRLCPY 1
|
||||||
|
#define HAVE_STRLCAT 1
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
#define HAVE_STRCHR 1
|
||||||
|
#define HAVE_STRRCHR 1
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
#define HAVE_STRTOULL 1
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_ATOF 1
|
||||||
|
#define HAVE_STRCMP 1
|
||||||
|
#define HAVE_STRNCMP 1
|
||||||
|
#define HAVE_STRCASECMP 1
|
||||||
|
#define HAVE_STRNCASECMP 1
|
||||||
|
#define HAVE_VSSCANF 1
|
||||||
|
#define HAVE_VSNPRINTF 1
|
||||||
|
#define HAVE_CEIL 1
|
||||||
|
#define HAVE_COPYSIGN 1
|
||||||
|
#define HAVE_COS 1
|
||||||
|
#define HAVE_COSF 1
|
||||||
|
#define HAVE_FABS 1
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
#define HAVE_LOG 1
|
||||||
|
#define HAVE_POW 1
|
||||||
|
#define HAVE_SCALBN 1
|
||||||
|
#define HAVE_SIN 1
|
||||||
|
#define HAVE_SINF 1
|
||||||
|
#define HAVE_SQRT 1
|
||||||
|
#define HAVE_SQRTF 1
|
||||||
|
#define HAVE_TAN 1
|
||||||
|
#define HAVE_TANF 1
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
#define HAVE_SETJMP 1
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
#define HAVE_SYSCONF 1
|
||||||
|
#define HAVE_SYSCTLBYNAME 1
|
||||||
|
#define HAVE_ATAN 1
|
||||||
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
|
|
||||||
|
/* Enable various audio drivers */
|
||||||
|
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||||
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable various input drivers */
|
||||||
|
#define SDL_JOYSTICK_IOKIT 1
|
||||||
|
#define SDL_HAPTIC_IOKIT 1
|
||||||
|
|
||||||
|
/* Enable various shared object loading systems */
|
||||||
|
#define SDL_LOADSO_DLOPEN 1
|
||||||
|
|
||||||
|
/* Enable various threading systems */
|
||||||
|
#define SDL_THREAD_PTHREAD 1
|
||||||
|
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||||
|
|
||||||
|
/* Enable various timer systems */
|
||||||
|
#define SDL_TIMER_UNIX 1
|
||||||
|
|
||||||
|
/* Enable various video drivers */
|
||||||
|
#define SDL_VIDEO_DRIVER_COCOA 1
|
||||||
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
#undef SDL_VIDEO_DRIVER_X11
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_XDBE 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
|
||||||
|
|
||||||
|
#ifdef MAC_OS_X_VERSION_10_8
|
||||||
|
/*
|
||||||
|
* No matter the versions targeted, this is the 10.8 or later SDK, so you have
|
||||||
|
* to use the external Xquartz, which is a more modern Xlib. Previous SDKs
|
||||||
|
* used an older Xlib.
|
||||||
|
*/
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SDL_VIDEO_RENDER_OGL
|
||||||
|
#define SDL_VIDEO_RENDER_OGL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable OpenGL support */
|
||||||
|
#ifndef SDL_VIDEO_OPENGL
|
||||||
|
#define SDL_VIDEO_OPENGL 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_CGL
|
||||||
|
#define SDL_VIDEO_OPENGL_CGL 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_GLX
|
||||||
|
#define SDL_VIDEO_OPENGL_GLX 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable system power support */
|
||||||
|
#define SDL_POWER_MACOSX 1
|
||||||
|
|
||||||
|
/* enable filesystem support */
|
||||||
|
#define SDL_FILESYSTEM_COCOA 1
|
||||||
|
|
||||||
|
/* Enable assembly routines */
|
||||||
|
#define SDL_ASSEMBLY_ROUTINES 1
|
||||||
|
#ifdef __ppc__
|
||||||
|
#define SDL_ALTIVEC_BLITTERS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SDL_config_macosx_h */
|
||||||
+81
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_minimal_h
|
||||||
|
#define _SDL_config_minimal_h
|
||||||
|
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_config_minimal.h
|
||||||
|
*
|
||||||
|
* This is the minimal configuration that can be used to build SDL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define HAVE_STDARG_H 1
|
||||||
|
#define HAVE_STDDEF_H 1
|
||||||
|
|
||||||
|
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||||
|
/* Here are some reasonable defaults */
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
typedef signed char int8_t;
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef signed short int16_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
typedef signed int int32_t;
|
||||||
|
typedef unsigned int uint32_t;
|
||||||
|
typedef signed long long int64_t;
|
||||||
|
typedef unsigned long long uint64_t;
|
||||||
|
typedef unsigned long uintptr_t;
|
||||||
|
#else
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#endif /* Visual Studio 2008 */
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||||
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
|
||||||
|
#define SDL_JOYSTICK_DISABLED 1
|
||||||
|
|
||||||
|
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
|
||||||
|
#define SDL_HAPTIC_DISABLED 1
|
||||||
|
|
||||||
|
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||||
|
#define SDL_LOADSO_DISABLED 1
|
||||||
|
|
||||||
|
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
||||||
|
#define SDL_THREADS_DISABLED 1
|
||||||
|
|
||||||
|
/* Enable the stub timer support (src/timer/dummy/\*.c) */
|
||||||
|
#define SDL_TIMERS_DISABLED 1
|
||||||
|
|
||||||
|
/* Enable the dummy video driver (src/video/dummy/\*.c) */
|
||||||
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
|
||||||
|
#define SDL_FILESYSTEM_DUMMY 1
|
||||||
|
|
||||||
|
#endif /* _SDL_config_minimal_h */
|
||||||
+127
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_h
|
||||||
|
#define _SDL_config_h
|
||||||
|
|
||||||
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
|
/* General platform specific identifiers */
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define SIZEOF_VOIDP 8
|
||||||
|
#else
|
||||||
|
#define SIZEOF_VOIDP 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SDL_BYTEORDER 1234
|
||||||
|
|
||||||
|
#define HAVE_ALLOCA_H 1
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
#define HAVE_STDIO_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
#define HAVE_STDARG_H 1
|
||||||
|
#define HAVE_MALLOC_H 1
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
#define HAVE_ICONV_H 1
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
#define HAVE_ALLOCA 1
|
||||||
|
#define HAVE_GETENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
#define HAVE_QSORT 1
|
||||||
|
#define HAVE_ABS 1
|
||||||
|
#define HAVE_BCOPY 1
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
#define HAVE_STRLEN 1
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
#define HAVE_STRCHR 1
|
||||||
|
#define HAVE_STRRCHR 1
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
#define HAVE_STRTOULL 1
|
||||||
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_ATOF 1
|
||||||
|
#define HAVE_STRCMP 1
|
||||||
|
#define HAVE_STRNCMP 1
|
||||||
|
#define HAVE_STRCASECMP 1
|
||||||
|
#define HAVE_STRNCASECMP 1
|
||||||
|
#define HAVE_VSSCANF 1
|
||||||
|
#define HAVE_VSNPRINTF 1
|
||||||
|
#define HAVE_M_PI 1
|
||||||
|
#define HAVE_CEIL 1
|
||||||
|
#define HAVE_COPYSIGN 1
|
||||||
|
#define HAVE_COS 1
|
||||||
|
#define HAVE_COSF 1
|
||||||
|
#define HAVE_FABS 1
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
#define HAVE_LOG 1
|
||||||
|
#define HAVE_SCALBN 1
|
||||||
|
#define HAVE_SIN 1
|
||||||
|
#define HAVE_SINF 1
|
||||||
|
#define HAVE_SQRT 1
|
||||||
|
#define HAVE_SQRTF 1
|
||||||
|
#define HAVE_TAN 1
|
||||||
|
#define HAVE_TANF 1
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
#define HAVE_SETJMP 1
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
#define SDL_AUDIO_DRIVER_OSS 1
|
||||||
|
|
||||||
|
#define SDL_INPUT_LINUXEV 1
|
||||||
|
#define SDL_INPUT_TSLIB 1
|
||||||
|
#define SDL_JOYSTICK_LINUX 1
|
||||||
|
#define SDL_HAPTIC_LINUX 1
|
||||||
|
|
||||||
|
#define SDL_LOADSO_DLOPEN 1
|
||||||
|
|
||||||
|
#define SDL_THREAD_PTHREAD 1
|
||||||
|
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
|
||||||
|
|
||||||
|
#define SDL_TIMER_UNIX 1
|
||||||
|
#define SDL_FILESYSTEM_UNIX 1
|
||||||
|
|
||||||
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
#define SDL_VIDEO_DRIVER_X11 1
|
||||||
|
#define SDL_VIDEO_DRIVER_PANDORA 1
|
||||||
|
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||||
|
#define SDL_VIDEO_OPENGL_ES 1
|
||||||
|
|
||||||
|
#endif /* _SDL_config_h */
|
||||||
+143
@@ -0,0 +1,143 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_psp_h
|
||||||
|
#define _SDL_config_psp_h
|
||||||
|
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HAVE_GCC_ATOMICS 1
|
||||||
|
|
||||||
|
#define HAVE_ALLOCA_H 1
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
#define HAVE_STDIO_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
#define HAVE_ALLOCA 1
|
||||||
|
#define HAVE_GETENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
#define HAVE_UNSETENV 1
|
||||||
|
#define HAVE_QSORT 1
|
||||||
|
#define HAVE_ABS 1
|
||||||
|
#define HAVE_BCOPY 1
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
#define HAVE_MEMCMP 1
|
||||||
|
#define HAVE_STRLEN 1
|
||||||
|
#define HAVE_STRLCPY 1
|
||||||
|
#define HAVE_STRLCAT 1
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
#define HAVE_STRCHR 1
|
||||||
|
#define HAVE_STRRCHR 1
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
#define HAVE_STRTOULL 1
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_ATOF 1
|
||||||
|
#define HAVE_STRCMP 1
|
||||||
|
#define HAVE_STRNCMP 1
|
||||||
|
#define HAVE_STRCASECMP 1
|
||||||
|
#define HAVE_STRNCASECMP 1
|
||||||
|
#define HAVE_VSSCANF 1
|
||||||
|
#define HAVE_VSNPRINTF 1
|
||||||
|
#define HAVE_M_PI 1
|
||||||
|
#define HAVE_ATAN 1
|
||||||
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
|
#define HAVE_CEIL 1
|
||||||
|
#define HAVE_COPYSIGN 1
|
||||||
|
#define HAVE_COS 1
|
||||||
|
#define HAVE_COSF 1
|
||||||
|
#define HAVE_FABS 1
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
#define HAVE_LOG 1
|
||||||
|
#define HAVE_POW 1
|
||||||
|
#define HAVE_SCALBN 1
|
||||||
|
#define HAVE_SIN 1
|
||||||
|
#define HAVE_SINF 1
|
||||||
|
#define HAVE_SQRT 1
|
||||||
|
#define HAVE_SQRTF 1
|
||||||
|
#define HAVE_TAN 1
|
||||||
|
#define HAVE_TANF 1
|
||||||
|
#define HAVE_SETJMP 1
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
/* #define HAVE_SYSCONF 1 */
|
||||||
|
/* #define HAVE_SIGACTION 1 */
|
||||||
|
|
||||||
|
|
||||||
|
/* PSP isn't that sophisticated */
|
||||||
|
#define LACKS_SYS_MMAN_H 1
|
||||||
|
|
||||||
|
/* Enable the stub thread support (src/thread/psp/\*.c) */
|
||||||
|
#define SDL_THREAD_PSP 1
|
||||||
|
|
||||||
|
/* Enable the stub timer support (src/timer/psp/\*.c) */
|
||||||
|
#define SDL_TIMERS_PSP 1
|
||||||
|
|
||||||
|
/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
|
||||||
|
#define SDL_JOYSTICK_PSP 1
|
||||||
|
|
||||||
|
/* Enable the stub audio driver (src/audio/psp/\*.c) */
|
||||||
|
#define SDL_AUDIO_DRIVER_PSP 1
|
||||||
|
|
||||||
|
/* PSP video dirver */
|
||||||
|
#define SDL_VIDEO_DRIVER_PSP 1
|
||||||
|
|
||||||
|
/* PSP render dirver */
|
||||||
|
#define SDL_VIDEO_RENDER_PSP 1
|
||||||
|
|
||||||
|
#define SDL_POWER_PSP 1
|
||||||
|
|
||||||
|
/* !!! FIXME: what does PSP do for filesystem stuff? */
|
||||||
|
#define SDL_FILESYSTEM_DUMMY 1
|
||||||
|
|
||||||
|
/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
|
||||||
|
#define SDL_HAPTIC_DISABLED 1
|
||||||
|
|
||||||
|
/* PSP can't load shared object (src/loadso/dummy/\*.c) */
|
||||||
|
#define SDL_LOADSO_DISABLED 1
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _SDL_config_psp_h */
|
||||||
+221
@@ -0,0 +1,221 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_config_windows_h
|
||||||
|
#define _SDL_config_windows_h
|
||||||
|
|
||||||
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
|
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||||
|
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
typedef signed __int8 int8_t;
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef signed __int16 int16_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
#ifndef _UINTPTR_T_DEFINED
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef unsigned __int64 uintptr_t;
|
||||||
|
#else
|
||||||
|
typedef unsigned int uintptr_t;
|
||||||
|
#endif
|
||||||
|
#define _UINTPTR_T_DEFINED
|
||||||
|
#endif
|
||||||
|
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
||||||
|
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
|
||||||
|
#define DWORD_PTR DWORD
|
||||||
|
#endif
|
||||||
|
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
|
||||||
|
#define LONG_PTR LONG
|
||||||
|
#endif
|
||||||
|
#else /* !__GNUC__ && !_MSC_VER */
|
||||||
|
typedef signed char int8_t;
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef signed short int16_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
typedef signed int int32_t;
|
||||||
|
typedef unsigned int uint32_t;
|
||||||
|
typedef signed long long int64_t;
|
||||||
|
typedef unsigned long long uint64_t;
|
||||||
|
#ifndef _SIZE_T_DEFINED_
|
||||||
|
#define _SIZE_T_DEFINED_
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
#endif
|
||||||
|
typedef unsigned int uintptr_t;
|
||||||
|
#endif /* __GNUC__ || _MSC_VER */
|
||||||
|
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
# define SIZEOF_VOIDP 8
|
||||||
|
#else
|
||||||
|
# define SIZEOF_VOIDP 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HAVE_DDRAW_H 1
|
||||||
|
#define HAVE_DINPUT_H 1
|
||||||
|
#define HAVE_DSOUND_H 1
|
||||||
|
#define HAVE_DXGI_H 1
|
||||||
|
#define HAVE_XINPUT_H 1
|
||||||
|
|
||||||
|
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
|
||||||
|
#ifdef HAVE_LIBC
|
||||||
|
/* Useful headers */
|
||||||
|
#define HAVE_STDIO_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
#define HAVE_ALLOCA 1
|
||||||
|
#define HAVE_QSORT 1
|
||||||
|
#define HAVE_ABS 1
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
#define HAVE_MEMCMP 1
|
||||||
|
#define HAVE_STRLEN 1
|
||||||
|
#define HAVE__STRREV 1
|
||||||
|
#define HAVE__STRUPR 1
|
||||||
|
#define HAVE__STRLWR 1
|
||||||
|
#define HAVE_STRCHR 1
|
||||||
|
#define HAVE_STRRCHR 1
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE__LTOA 1
|
||||||
|
#define HAVE__ULTOA 1
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_ATOF 1
|
||||||
|
#define HAVE_STRCMP 1
|
||||||
|
#define HAVE_STRNCMP 1
|
||||||
|
#define HAVE__STRICMP 1
|
||||||
|
#define HAVE__STRNICMP 1
|
||||||
|
#define HAVE_ATAN 1
|
||||||
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
|
#define HAVE_CEIL 1
|
||||||
|
#define HAVE_COS 1
|
||||||
|
#define HAVE_COSF 1
|
||||||
|
#define HAVE_FABS 1
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
#define HAVE_LOG 1
|
||||||
|
#define HAVE_POW 1
|
||||||
|
#define HAVE_SIN 1
|
||||||
|
#define HAVE_SINF 1
|
||||||
|
#define HAVE_SQRT 1
|
||||||
|
#define HAVE_SQRTF 1
|
||||||
|
#define HAVE_TAN 1
|
||||||
|
#define HAVE_TANF 1
|
||||||
|
#if _MSC_VER >= 1800
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
#define HAVE_VSSCANF 1
|
||||||
|
#define HAVE_COPYSIGN 1
|
||||||
|
#define HAVE_SCALBN 1
|
||||||
|
#endif
|
||||||
|
#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
|
||||||
|
#define HAVE_M_PI 1
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define HAVE_STDARG_H 1
|
||||||
|
#define HAVE_STDDEF_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable various audio drivers */
|
||||||
|
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||||
|
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
||||||
|
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||||
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
|
/* Enable various input drivers */
|
||||||
|
#define SDL_JOYSTICK_DINPUT 1
|
||||||
|
#define SDL_JOYSTICK_XINPUT 1
|
||||||
|
#define SDL_HAPTIC_DINPUT 1
|
||||||
|
#define SDL_HAPTIC_XINPUT 1
|
||||||
|
|
||||||
|
/* Enable various shared object loading systems */
|
||||||
|
#define SDL_LOADSO_WINDOWS 1
|
||||||
|
|
||||||
|
/* Enable various threading systems */
|
||||||
|
#define SDL_THREAD_WINDOWS 1
|
||||||
|
|
||||||
|
/* Enable various timer systems */
|
||||||
|
#define SDL_TIMER_WINDOWS 1
|
||||||
|
|
||||||
|
/* Enable various video drivers */
|
||||||
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
#define SDL_VIDEO_DRIVER_WINDOWS 1
|
||||||
|
|
||||||
|
#ifndef SDL_VIDEO_RENDER_D3D
|
||||||
|
#define SDL_VIDEO_RENDER_D3D 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_RENDER_D3D11
|
||||||
|
#define SDL_VIDEO_RENDER_D3D11 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable OpenGL support */
|
||||||
|
#ifndef SDL_VIDEO_OPENGL
|
||||||
|
#define SDL_VIDEO_OPENGL 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_WGL
|
||||||
|
#define SDL_VIDEO_OPENGL_WGL 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_RENDER_OGL
|
||||||
|
#define SDL_VIDEO_RENDER_OGL 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_RENDER_OGL_ES2
|
||||||
|
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_ES2
|
||||||
|
#define SDL_VIDEO_OPENGL_ES2 1
|
||||||
|
#endif
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_EGL
|
||||||
|
#define SDL_VIDEO_OPENGL_EGL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Enable system power support */
|
||||||
|
#define SDL_POWER_WINDOWS 1
|
||||||
|
|
||||||
|
/* Enable filesystem support */
|
||||||
|
#define SDL_FILESYSTEM_WINDOWS 1
|
||||||
|
|
||||||
|
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
||||||
|
#ifndef _WIN64
|
||||||
|
#define SDL_ASSEMBLY_ROUTINES 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SDL_config_windows_h */
|
||||||
Loaded 100 of 2491 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user