X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fintegration-api%2Fbitmap.cpp;h=4491800d1e87903a7e12e0d6e306399feaaad05f;hb=1d8c42f83a9803d65c01226636eac4d6f8faf133;hp=3f50e12f280494d3f6f6cc6aeae1d31c28d9f286;hpb=eef638e77a71bf910e84ed1731f874c7bd5f0a95;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/integration-api/bitmap.cpp b/dali/integration-api/bitmap.cpp index 3f50e12..4491800 100644 --- a/dali/integration-api/bitmap.cpp +++ b/dali/integration-api/bitmap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,116 +20,115 @@ // INTERNAL INCLUDES #include +#include +#include #include #include -#include #include -#include -#include +#include namespace Dali { - namespace Integration { using namespace Dali::Pixel; -void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& internalFormat ) +void ConvertToGlFormat(Format pixelformat, unsigned& pixelDataType, unsigned& internalFormat) { // Compressed textures have no pixelDataType, so init to an invalid value: - pixelDataType = -1; + pixelDataType = GL_INVALID_VALUE; - switch( pixelformat ) + switch(pixelformat) { case A8: { - pixelDataType = GL_UNSIGNED_BYTE; - internalFormat= GL_ALPHA; + pixelDataType = GL_UNSIGNED_BYTE; + internalFormat = GL_ALPHA; break; } case L8: { - pixelDataType = GL_UNSIGNED_BYTE; - internalFormat= GL_LUMINANCE; + pixelDataType = GL_UNSIGNED_BYTE; + internalFormat = GL_LUMINANCE; break; } case LA88: { - pixelDataType = GL_UNSIGNED_BYTE; - internalFormat= GL_LUMINANCE_ALPHA; + pixelDataType = GL_UNSIGNED_BYTE; + internalFormat = GL_LUMINANCE_ALPHA; break; } case RGB565: { - pixelDataType = GL_UNSIGNED_SHORT_5_6_5; - internalFormat= GL_RGB; + pixelDataType = GL_UNSIGNED_SHORT_5_6_5; + internalFormat = GL_RGB; break; } case BGR565: { DALI_LOG_ERROR("Pixel format BGR565 is not supported by GLES.\n"); - pixelDataType = GL_UNSIGNED_SHORT_5_6_5; + pixelDataType = GL_UNSIGNED_SHORT_5_6_5; #ifdef _ARCH_ARM_ - internalFormat= GL_BGRA_EXT; // alpha is reserved but not used + internalFormat = GL_BGRA_EXT; // alpha is reserved but not used #else - internalFormat= GL_RGBA; // alpha is reserved but not used + internalFormat = GL_RGBA; // alpha is reserved but not used #endif break; } case RGBA4444: { - pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4; - internalFormat= GL_RGBA; + pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4; + internalFormat = GL_RGBA; break; } case BGRA4444: { DALI_LOG_ERROR("Pixel format BGRA4444 is not supported by GLES.\n"); - pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4; + pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4; #ifdef _ARCH_ARM_ - internalFormat= GL_BGRA_EXT; // alpha is reserved but not used + internalFormat = GL_BGRA_EXT; // alpha is reserved but not used #else - internalFormat= GL_RGBA; // alpha is reserved but not used + internalFormat = GL_RGBA; // alpha is reserved but not used #endif break; } case RGBA5551: { - pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1; - internalFormat= GL_RGBA; + pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1; + internalFormat = GL_RGBA; break; } case BGRA5551: { DALI_LOG_ERROR("Pixel format BGRA5551 is not supported by GLES.\n"); - pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1; + pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1; #ifdef _ARCH_ARM_ - internalFormat= GL_BGRA_EXT; // alpha is reserved but not used + internalFormat = GL_BGRA_EXT; // alpha is reserved but not used #else - internalFormat= GL_RGBA; // alpha is reserved but not used + internalFormat = GL_RGBA; // alpha is reserved but not used #endif break; } case RGB888: { - pixelDataType = GL_UNSIGNED_BYTE; - internalFormat= GL_RGB; + pixelDataType = GL_UNSIGNED_BYTE; + internalFormat = GL_RGB; break; } case RGB8888: { - pixelDataType = GL_UNSIGNED_BYTE; - internalFormat= GL_RGBA; // alpha is reserved but not used + pixelDataType = GL_UNSIGNED_BYTE; + internalFormat = GL_RGBA; // alpha is reserved but not used break; } @@ -137,17 +136,17 @@ void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& i { pixelDataType = GL_UNSIGNED_BYTE; #ifdef GL_BGRA_EXT - internalFormat= GL_BGRA_EXT; // alpha is reserved but not used + internalFormat = GL_BGRA_EXT; // alpha is reserved but not used #else - internalFormat= GL_RGBA; // alpha is reserved but not used + internalFormat = GL_RGBA; // alpha is reserved but not used #endif - break; + break; } case RGBA8888: { - pixelDataType = GL_UNSIGNED_BYTE; - internalFormat= GL_RGBA; + pixelDataType = GL_UNSIGNED_BYTE; + internalFormat = GL_RGBA; break; } @@ -155,9 +154,9 @@ void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& i { pixelDataType = GL_UNSIGNED_BYTE; #ifdef GL_BGRA_EXT - internalFormat= GL_BGRA_EXT; // alpha is reserved but not used + internalFormat = GL_BGRA_EXT; // alpha is reserved but not used #else - internalFormat= GL_RGBA; // alpha is reserved but not used + internalFormat = GL_RGBA; // alpha is reserved but not used #endif break; } @@ -165,13 +164,13 @@ void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& i // GLES 2 extension compressed formats: case COMPRESSED_RGB8_ETC1: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB8_ETC1.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB8_ETC1.\n"); internalFormat = 0x8D64; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater. break; } case COMPRESSED_RGB_PVRTC_4BPPV1: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB_PVRTC_4BPPV1.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB_PVRTC_4BPPV1.\n"); internalFormat = 0x8C00; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater. break; } @@ -185,55 +184,55 @@ void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& i } case COMPRESSED_SIGNED_R11_EAC: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_R11_EAC.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_R11_EAC.\n"); internalFormat = GL_COMPRESSED_SIGNED_R11_EAC; break; } case COMPRESSED_RG11_EAC: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RG11_EAC.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RG11_EAC.\n"); internalFormat = GL_COMPRESSED_RG11_EAC; break; } case COMPRESSED_SIGNED_RG11_EAC: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_RG11_EAC.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_RG11_EAC.\n"); internalFormat = GL_COMPRESSED_SIGNED_RG11_EAC; break; } case COMPRESSED_RGB8_ETC2: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_ETC2.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_ETC2.\n"); internalFormat = GL_COMPRESSED_RGB8_ETC2; break; } case COMPRESSED_SRGB8_ETC2: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ETC2.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ETC2.\n"); internalFormat = GL_COMPRESSED_SRGB8_ETC2; break; } case COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n"); internalFormat = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; break; } case COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n"); internalFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2; break; } case COMPRESSED_RGBA8_ETC2_EAC: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGBA8_ETC2_EAC.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGBA8_ETC2_EAC.\n"); internalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; break; } case COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ETC2_EAC.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ETC2_EAC.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC; break; } @@ -241,169 +240,169 @@ void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& i // GLES 3.1 extension compressed formats: case COMPRESSED_RGBA_ASTC_4x4_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_4x4_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_4x4_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; break; } case COMPRESSED_RGBA_ASTC_5x4_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x4_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x4_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR; break; } case COMPRESSED_RGBA_ASTC_5x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x5_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR; break; } case COMPRESSED_RGBA_ASTC_6x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x5_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR; break; } case COMPRESSED_RGBA_ASTC_6x6_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x6_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x6_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR; break; } case COMPRESSED_RGBA_ASTC_8x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x5_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR; break; } case COMPRESSED_RGBA_ASTC_8x6_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x6_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x6_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR; break; } case COMPRESSED_RGBA_ASTC_8x8_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x8_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x8_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; break; } case COMPRESSED_RGBA_ASTC_10x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x5_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR; break; } case COMPRESSED_RGBA_ASTC_10x6_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x6_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x6_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR; break; } case COMPRESSED_RGBA_ASTC_10x8_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x8_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x8_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR; break; } case COMPRESSED_RGBA_ASTC_10x10_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x10_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x10_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR; break; } case COMPRESSED_RGBA_ASTC_12x10_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x10_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x10_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR; break; } case COMPRESSED_RGBA_ASTC_12x12_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x12_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x12_KHR.\n"); internalFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; break; } case COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR.\n" ); + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR.\n"); internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; break; } @@ -411,54 +410,61 @@ void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& i // GLES 3.0 floating point formats. case RGB16F: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" ); - pixelDataType = GL_HALF_FLOAT; - internalFormat= GL_RGB; + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n"); + pixelDataType = GL_HALF_FLOAT; + internalFormat = GL_RGB; break; } case RGB32F: { - DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" ); - pixelDataType = GL_FLOAT; - internalFormat= GL_RGB; + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n"); + pixelDataType = GL_FLOAT; + internalFormat = GL_RGB; + break; + } + case R11G11B10F: + { + DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n"); + pixelDataType = GL_FLOAT; + internalFormat = GL_R11F_G11F_B10F; break; } // GLES 3.0 depth and stencil formats case Pixel::DEPTH_UNSIGNED_INT: { - pixelDataType = GL_UNSIGNED_INT; + pixelDataType = GL_UNSIGNED_INT; internalFormat = GL_DEPTH_COMPONENT; break; } case Pixel::DEPTH_FLOAT: { - pixelDataType = GL_FLOAT; + pixelDataType = GL_FLOAT; internalFormat = GL_DEPTH_COMPONENT; break; } case Pixel::DEPTH_STENCIL: { - pixelDataType = GL_UNSIGNED_INT_24_8; + pixelDataType = GL_UNSIGNED_INT_24_8; internalFormat = GL_DEPTH_STENCIL; break; } case INVALID: { - DALI_LOG_ERROR( "Invalid pixel format for bitmap\n" ); + DALI_LOG_ERROR("Invalid pixel format for bitmap\n"); internalFormat = 0; break; } } } -Bitmap* Bitmap::New( const Profile profile = BITMAP_2D_PACKED_PIXELS, - ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_DISCARD ) +Bitmap* Bitmap::New(const Profile profile = BITMAP_2D_PACKED_PIXELS, + ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_DISCARD) { DALI_ASSERT_DEBUG(profile == BITMAP_2D_PACKED_PIXELS || profile == BITMAP_COMPRESSED); - switch( profile ) + switch(profile) { /** A 2D array of pixels where each pixel is a whole number of bytes * and each scanline of the backing memory buffer may have additional @@ -466,21 +472,20 @@ Bitmap* Bitmap::New( const Profile profile = BITMAP_2D_PACKED_PIXELS, * scanlines past the bottom of the image in the buffer if requested.*/ case BITMAP_2D_PACKED_PIXELS: { - Bitmap * const bitmap = new Dali::Internal::BitmapPackedPixel( discardable ); + Bitmap* const bitmap = new Dali::Internal::BitmapPackedPixel(discardable); return bitmap; } /** The data for the bitmap is buffered in an opaque form.*/ case BITMAP_COMPRESSED: { - return new Dali::Internal::BitmapCompressed( discardable ); + return new Dali::Internal::BitmapCompressed(discardable); } } - return 0; + return nullptr; } - -Bitmap::Bitmap( ResourcePolicy::Discardable discardable, Dali::Integration::PixelBuffer* pixBuf) +Bitmap::Bitmap(ResourcePolicy::Discardable discardable, Dali::Integration::PixelBuffer* pixBuf) : mImageWidth(0), mImageHeight(0), mPixelFormat(Pixel::RGBA8888), @@ -494,13 +499,13 @@ Bitmap::Bitmap( ResourcePolicy::Discardable discardable, Dali::Integration::Pixe PixelBuffer* Bitmap::GetBufferOwnership() { PixelBuffer* buffer = mData; - mData = NULL; + mData = nullptr; return buffer; } void Bitmap::DiscardBuffer() { - if( mDiscardable == ResourcePolicy::OWNED_DISCARD ) + if(mDiscardable == ResourcePolicy::OWNED_DISCARD) { DeletePixelBuffer(); } @@ -516,23 +521,22 @@ Bitmap::~Bitmap() * */ void Bitmap::DeletePixelBuffer() { - if( !mData ) + if(!mData) { return; } - free ( mData ); - mData = NULL; + free(mData); + mData = nullptr; } - -void Bitmap::Initialize( Pixel::Format pixelFormat, - unsigned int width, - unsigned int height) +void Bitmap::Initialize(Pixel::Format pixelFormat, + unsigned int width, + unsigned int height) { DALI_ASSERT_DEBUG(width * height < (32 * 1024) * (32 * 1024) && "The total area of the bitmap is too great.\n"); - mImageWidth = width; - mImageHeight = height; - mPixelFormat = pixelFormat; + mImageWidth = width; + mImageHeight = height; + mPixelFormat = pixelFormat; mHasAlphaChannel = Pixel::HasAlpha(pixelFormat); }