| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- /*
- * Copyright (c) 2009-2021 Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the License); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*============================ INCLUDES ======================================*/
- #include "asset_corner_box.h"
- #include "arm_2d.h"
- #include "arm_2d_helper.h"
- #include "Arm2D_common.h"
- #include <math.h>
- #if defined(__clang__)
- # pragma clang diagnostic push
- # pragma clang diagnostic ignored "-Wsign-conversion"
- # pragma clang diagnostic ignored "-Wpadded"
- # pragma clang diagnostic ignored "-Wcast-qual"
- # pragma clang diagnostic ignored "-Wcast-align"
- # pragma clang diagnostic ignored "-Wmissing-field-initializers"
- # pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
- # pragma clang diagnostic ignored "-Wmissing-braces"
- # pragma clang diagnostic ignored "-Wunused-const-variable"
- # pragma clang diagnostic ignored "-Wmissing-declarations"
- # pragma clang diagnostic ignored "-Wmissing-variable-declarations"
- # pragma clang diagnostic ignored "-Winitializer-overrides"
- #endif
- /*============================ MACROS ========================================*/
- /*============================ MACROFIED FUNCTIONS ===========================*/
- /*============================ TYPES =========================================*/
- /*============================ GLOBAL VARIABLES ==============================*/
- extern
- const arm_2d_tile_t c_tileWhiteDotAlphaQuarter;
- /*============================ PROTOTYPES ====================================*/
- /*============================ LOCAL VARIABLES ===============================*/
- impl_fb(s_tCorner, 7, 7, uint8_t,
- .tInfo = {
- .bIsRoot = true,
- .bHasEnforcedColour = true,
- .tColourInfo = {
- .chScheme = ARM_2D_COLOUR_8BIT,
- },
- },
- )
- /*============================ IMPLEMENTATION ================================*/
- void draw_round_corner_box( const arm_2d_tile_t *ptTarget,
- const arm_2d_region_t *ptRegion,
- uint16_t hwColour,
- uint8_t chAlpha,
- bool bIsNewFrame)
- {
- ARM_2D_UNUSED(bIsNewFrame);
- if (NULL == ptRegion) {
- ptRegion = (const arm_2d_region_t *)&(ptTarget->tRegion);
- }
-
- arm_2d_region_t tRegion = *ptRegion;
-
- //! copy the top left corner
- arm_2d_c8bit_tile_copy( &c_tileWhiteDotAlphaQuarter,
- &s_tCorner,
- NULL,
- ARM_2D_CP_MODE_COPY |
- ARM_2D_CP_MODE_X_MIRROR |
- ARM_2D_CP_MODE_Y_MIRROR);
-
- arm_2d_fill_colour_with_mask_and_opacity(
- ptTarget,
- &tRegion,
- &s_tCorner,
- (arm_2d_color_rgb565_t){hwColour},
- chAlpha);
-
- arm_2d_op_wait_async(NULL);
- //! copy the top right corner
- tRegion.tLocation.iX += ptRegion->tSize.iWidth - s_tCorner.tRegion.tSize.iWidth;
- arm_2d_c8bit_tile_copy( &c_tileWhiteDotAlphaQuarter,
- &s_tCorner,
- NULL,
- ARM_2D_CP_MODE_COPY |
- ARM_2D_CP_MODE_Y_MIRROR);
-
- arm_2d_fill_colour_with_mask_and_opacity(
- ptTarget,
- &tRegion,
- &s_tCorner,
- (arm_2d_color_rgb565_t){hwColour},
- chAlpha);
- arm_2d_op_wait_async(NULL);
- arm_2dp_fill_colour_with_opacity(
- NULL,
- ptTarget,
- &(arm_2d_region_t) {
- .tSize = {
- .iHeight = s_tCorner.tRegion.tSize.iHeight,
- .iWidth = tRegion.tSize.iWidth - s_tCorner.tRegion.tSize.iWidth * 2,
- },
- .tLocation = {
- .iX = ptRegion->tLocation.iX + s_tCorner.tRegion.tSize.iWidth,
- .iY = ptRegion->tLocation.iY,
- },
- },
- (arm_2d_color_rgb565_t){hwColour},
- chAlpha);
-
- arm_2d_op_wait_async(NULL);
- arm_2dp_fill_colour_with_opacity(
- NULL,
- ptTarget,
- &(arm_2d_region_t) {
- .tSize = {
- .iHeight = tRegion.tSize.iHeight - s_tCorner.tRegion.tSize.iHeight * 2,
- .iWidth = tRegion.tSize.iWidth,
- },
- .tLocation = {
- .iX = ptRegion->tLocation.iX,
- .iY = ptRegion->tLocation.iY + s_tCorner.tRegion.tSize.iHeight,
- },
- },
- (arm_2d_color_rgb565_t){hwColour},
- chAlpha);
- arm_2d_op_wait_async(NULL);
-
- //! copy the bottom right corner
- tRegion.tLocation.iY += ptRegion->tSize.iHeight - s_tCorner.tRegion.tSize.iHeight;
- arm_2d_c8bit_tile_copy( &c_tileWhiteDotAlphaQuarter,
- &s_tCorner,
- NULL,
- ARM_2D_CP_MODE_COPY);
- arm_2d_fill_colour_with_mask_and_opacity(
- ptTarget,
- &tRegion,
- &s_tCorner,
- (arm_2d_color_rgb565_t){hwColour},
- chAlpha);
- arm_2d_op_wait_async(NULL);
- //! copy the bottom left corner
- tRegion.tLocation.iX = ptRegion->tLocation.iX;
- arm_2d_c8bit_tile_copy( &c_tileWhiteDotAlphaQuarter,
- &s_tCorner,
- NULL,
- ARM_2D_CP_MODE_COPY |
- ARM_2D_CP_MODE_X_MIRROR );
-
- arm_2d_fill_colour_with_mask_and_opacity(
- ptTarget,
- &tRegion,
- &s_tCorner,
- (arm_2d_color_rgb565_t){hwColour},
- chAlpha);
- arm_2d_op_wait_async(NULL);
- arm_2dp_fill_colour_with_opacity(
- NULL,
- ptTarget,
- &(arm_2d_region_t) {
- .tSize = {
- .iHeight = s_tCorner.tRegion.tSize.iHeight,
- .iWidth = tRegion.tSize.iWidth - s_tCorner.tRegion.tSize.iWidth * 2,
- },
- .tLocation = {
- .iX = tRegion.tLocation.iX + s_tCorner.tRegion.tSize.iWidth,
- .iY = tRegion.tLocation.iY,
- },
- },
- (arm_2d_color_rgb565_t){hwColour},
- chAlpha);
- arm_2d_op_wait_async(NULL);
- }
- #if defined(__clang__)
- # pragma clang diagnostic pop
- #endif
|