uint32_t byteSize = bytesPerPixel * xFaceSize * yFaceSize;
uint8_t* destBuffer = reinterpret_cast<uint8_t*>(malloc(byteSize + 4u));
- int32_t srcStride = width * bytesPerPixel;
- int32_t destStride = xFaceSize * bytesPerPixel;
- int32_t srcOffset = xOffset * bytesPerPixel + yOffset * srcStride;
- int32_t destOffset = 0;
- for(uint16_t row = yOffset; row < yOffset + yFaceSize; ++row)
+ if(DALI_LIKELY(destBuffer))
{
- memcpy(destBuffer + destOffset, sourceBuffer + srcOffset, destStride);
- srcOffset += srcStride;
- destOffset += destStride;
+ int32_t srcStride = width * bytesPerPixel;
+ int32_t destStride = xFaceSize * bytesPerPixel;
+ int32_t srcOffset = xOffset * bytesPerPixel + yOffset * srcStride;
+ int32_t destOffset = 0;
+ for(uint16_t row = yOffset; row < yOffset + yFaceSize; ++row)
+ {
+ memcpy(destBuffer + destOffset, sourceBuffer + srcOffset, destStride);
+ srcOffset += srcStride;
+ destOffset += destStride;
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", byteSize + 4u);
}
return destBuffer;
uint32_t finalFaceHeight = (yOffset + static_cast<uint32_t>(faceHeight) < imageHeight) ? static_cast<uint32_t>(faceHeight) : imageHeight - yOffset;
uint8_t* tempImageBuffer = GetCroppedBuffer(imageBuffer, bytesPerPixel, imageWidth, imageHeight, xOffset, yOffset, finalFaceWidth, finalFaceHeight);
- cubeFacePixelData = Dali::Integration::NewPixelDataWithReleaseAfterUpload(tempImageBuffer, finalFaceWidth * finalFaceHeight * bytesPerPixel, finalFaceWidth, finalFaceHeight, 0u, imagePixelFormat, PixelData::FREE);
+ if(DALI_LIKELY(tempImageBuffer))
+ {
+ cubeFacePixelData = Dali::Integration::NewPixelDataWithReleaseAfterUpload(tempImageBuffer, finalFaceWidth * finalFaceHeight * bytesPerPixel, finalFaceWidth, finalFaceHeight, 0u, imagePixelFormat, PixelData::FREE);
+ }
}
}
return cubeFacePixelData;
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
uint32_t byteSize = bytesPerPixel * xFaceSize * yFaceSize;
uint8_t* destBuffer = reinterpret_cast<uint8_t*>(malloc(byteSize + 4u));
- int32_t srcStride = width * bytesPerPixel;
- int32_t destStride = xFaceSize * bytesPerPixel;
- int32_t srcOffset = xOffset * bytesPerPixel + yOffset * srcStride;
- int32_t destOffset = 0;
- for(uint16_t row = yOffset; row < yOffset + yFaceSize; ++row)
+ if(DALI_LIKELY(destBuffer))
{
- memcpy(destBuffer + destOffset, sourceBuffer + srcOffset, destStride);
- srcOffset += srcStride;
- destOffset += destStride;
+ int32_t srcStride = width * bytesPerPixel;
+ int32_t destStride = xFaceSize * bytesPerPixel;
+ int32_t srcOffset = xOffset * bytesPerPixel + yOffset * srcStride;
+ int32_t destOffset = 0;
+ for(uint16_t row = yOffset; row < yOffset + yFaceSize; ++row)
+ {
+ memcpy(destBuffer + destOffset, sourceBuffer + srcOffset, destStride);
+ srcOffset += srcStride;
+ destOffset += destStride;
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", byteSize + 4u);
}
return destBuffer;
uint32_t xOffset = CUBEMAP_INDEX_X[cubeType][faceIndex] * faceSize;
uint32_t yOffset = CUBEMAP_INDEX_Y[cubeType][faceIndex] * faceSize;
- uint8_t* tempImageBuffer = GetCroppedBuffer(imageBuffer, bytesPerPixel, imageWidth, imageHeight, xOffset, yOffset, faceSize, faceSize);
- PixelData pixelData = PixelData::New(tempImageBuffer, faceSize * faceSize * bytesPerPixel, faceSize, faceSize, pixelBuffer.GetPixelFormat(), PixelData::FREE);
- texture.Upload(pixelData, CubeMapLayer::POSITIVE_X + faceIndex, 0, 0, 0, faceSize, faceSize);
+ uint8_t* tempImageBuffer = GetCroppedBuffer(imageBuffer, bytesPerPixel, imageWidth, imageHeight, xOffset, yOffset, faceSize, faceSize);
+ if(DALI_LIKELY(tempImageBuffer))
+ {
+ PixelData pixelData = PixelData::New(tempImageBuffer, faceSize * faceSize * bytesPerPixel, faceSize, faceSize, pixelBuffer.GetPixelFormat(), PixelData::FREE);
+ texture.Upload(pixelData, CubeMapLayer::POSITIVE_X + faceIndex, 0, 0, 0, faceSize, faceSize);
+ }
}
void Scene3dView::SetCubeMap(const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
/**
* @brief Prepare decode glyph bitmap data. It must be call END_GLYPH_BITMAP end of same scope.
*/
-#define BEGIN_GLYPH_BITMAP(data) \
-{ \
- uint32_t glyphOffet = 0u; \
- const bool useLocalScanline = data.glyphBitmap.compressionType != TextAbstraction::GlyphBufferData::CompressionType::NO_COMPRESSION; \
- uint8_t* __restrict__ glyphScanline = useLocalScanline ? (uint8_t*)malloc(data.glyphBitmap.width * glyphPixelSize) : data.glyphBitmap.buffer;
+#define BEGIN_GLYPH_BITMAP(data) \
+{ \
+ uint32_t glyphOffet = 0u; \
+ const bool useLocalScanline = data.glyphBitmap.compressionType != TextAbstraction::GlyphBufferData::CompressionType::NO_COMPRESSION; \
+ uint8_t* __restrict__ glyphScanline = useLocalScanline ? (uint8_t*)malloc(data.glyphBitmap.width * glyphPixelSize) : data.glyphBitmap.buffer; \
+ DALI_ASSERT_ALWAYS(glyphScanline && "Glyph scanline for buffer is null!");
/**
* @brief Macro to skip useless line fast.