SET(CAPI_LIB "dali-adaptor")
SET(TC_SOURCES
utc-Dali-Application.cpp
+ utc-Dali-EncodedImageBuffer.cpp
utc-Dali-FileLoader.cpp
utc-Dali-GifLoading.cpp
utc-Dali-ImageLoading.cpp
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ *
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <dali/dali.h>
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
+
+using namespace Dali;
+
+namespace
+{
+EncodedImageBuffer::RawBufferType tinybuffer()
+{
+ EncodedImageBuffer::RawBufferType buffer;
+ buffer.PushBack(0x11);
+ buffer.PushBack(0x22);
+ buffer.PushBack(0x33);
+ return buffer;
+}
+
+} // anonymous namespace
+
+void dali_encoded_image_buffer_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_encoded_image_buffer_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliEncodedImageBufferNew(void)
+{
+ // invoke default handle constructor
+ EncodedImageBuffer buffer;
+
+ DALI_TEST_CHECK(!buffer);
+
+ // initialise handle
+ buffer = EncodedImageBuffer::New(tinybuffer());
+
+ DALI_TEST_CHECK(buffer);
+ END_TEST;
+}
+
+int UtcDaliEncodedImageBufferCopyConstructor(void)
+{
+ EncodedImageBuffer buffer = EncodedImageBuffer::New(tinybuffer());
+ EncodedImageBuffer bufferCopy(buffer);
+
+ DALI_TEST_EQUALS( (bool)bufferCopy, true, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliEncodedImageBufferAssignmentOperator(void)
+{
+ EncodedImageBuffer buffer = EncodedImageBuffer::New(tinybuffer());
+
+ EncodedImageBuffer buffer2;
+ DALI_TEST_EQUALS( (bool)buffer2, false, TEST_LOCATION );
+
+ buffer2 = buffer;
+ DALI_TEST_EQUALS( (bool)buffer2, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliEncodedImageBufferGetRawBuffer(void)
+{
+ EncodedImageBuffer::RawBufferType originBuffer = tinybuffer();
+
+ EncodedImageBuffer buffer = EncodedImageBuffer::New(originBuffer);
+
+ EncodedImageBuffer::RawBufferType getBuffer = buffer.GetRawBuffer();
+
+ // compare value between originBuffer and getBuffer
+ DALI_TEST_EQUALS(originBuffer.Count(), getBuffer.Count(), TEST_LOCATION);
+
+ EncodedImageBuffer::RawBufferType::Iterator iter = originBuffer.Begin();
+ EncodedImageBuffer::RawBufferType::Iterator jter = getBuffer.Begin();
+ for(; iter != originBuffer.End(); ++iter, ++jter)
+ {
+ DALI_TEST_EQUALS(*iter, *jter, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ *
+ */
+
+// CLASS HEADER
+#include "encoded-image-buffer-impl.h"
+
+namespace Dali
+{
+namespace Internal
+{
+
+EncodedImageBuffer::EncodedImageBuffer(const RawBufferType& buffer)
+: mBuffer(buffer)
+{
+}
+
+EncodedImageBuffer::~EncodedImageBuffer()
+{
+}
+
+IntrusivePtr<EncodedImageBuffer> EncodedImageBuffer::New(const RawBufferType& buffer)
+{
+ IntrusivePtr<EncodedImageBuffer> internal = new EncodedImageBuffer(buffer);
+
+ return internal;
+}
+
+const EncodedImageBuffer::RawBufferType& EncodedImageBuffer::GetRawBuffer() const
+{
+ return mBuffer;
+}
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_ENCODED_IMAGE_BUFFER_IMPL_H
+#define DALI_ENCODED_IMAGE_BUFFER_IMPL_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/common/dali-vector.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+#include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
+
+namespace Dali
+{
+namespace Internal
+{
+class EncodedImageBuffer : public BaseObject
+{
+public:
+ using RawBufferType = Dali::EncodedImageBuffer::RawBufferType;
+
+ /**
+ * Constructor
+ * @param [in] buffer The raw buffer of image.
+ */
+ EncodedImageBuffer(const RawBufferType& buffer);
+
+ /**
+ * @copydoc Dali::EncodedImageBuffer::New
+ */
+ static IntrusivePtr<EncodedImageBuffer> New(const RawBufferType& buffer);
+
+ /**
+ * @copydoc Dali::EncodedImageBuffer::GetRawBuffer
+ */
+ const RawBufferType& GetRawBuffer() const;
+
+protected:
+ /**
+ * Destructor
+ */
+ ~EncodedImageBuffer();
+
+private:
+ // Undefined
+ EncodedImageBuffer(const EncodedImageBuffer& imageBuffer);
+
+ // Undefined
+ EncodedImageBuffer& operator=(const EncodedImageBuffer& imageBuffer);
+
+private:
+ Dali::Vector<uint8_t> mBuffer;
+};
+
+} // namespace Internal
+
+inline const Internal::EncodedImageBuffer& GetImplementation(const Dali::EncodedImageBuffer& encodedImageBuffer)
+{
+ DALI_ASSERT_ALWAYS(encodedImageBuffer && "EncodedImageBuffer handle is empty");
+
+ const BaseObject& handle = encodedImageBuffer.GetBaseObject();
+
+ return static_cast<const Internal::EncodedImageBuffer&>(handle);
+}
+
+inline Internal::EncodedImageBuffer& GetImplementation(Dali::EncodedImageBuffer& encodedImageBuffer)
+{
+ DALI_ASSERT_ALWAYS(encodedImageBuffer && "EncodedImageBuffer handle is empty");
+
+ BaseObject& handle = encodedImageBuffer.GetBaseObject();
+
+ return static_cast<Internal::EncodedImageBuffer&>(handle);
+}
+
+} // namespace Dali
+
+#endif // DALI_ENCODED_IMAGE_BUFFER_IMPL_H
${adaptor_imaging_dir}/common/native-bitmap-buffer-impl.cpp
${adaptor_imaging_dir}/common/pixel-buffer-impl.cpp
${adaptor_imaging_dir}/common/alpha-mask.cpp
+ ${adaptor_imaging_dir}/common/encoded-image-buffer-impl.cpp
${adaptor_imaging_dir}/common/gaussian-blur.cpp
${adaptor_imaging_dir}/common/http-utils.cpp
${adaptor_imaging_dir}/common/image-loader.cpp
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ *
+ */
+
+// CLASS HEADER
+#include "encoded-image-buffer.h"
+
+// INTERNAL INCLUDES
+#include <dali/internal/imaging/common/encoded-image-buffer-impl.h>
+
+namespace Dali
+{
+EncodedImageBuffer::EncodedImageBuffer()
+{
+}
+
+EncodedImageBuffer::~EncodedImageBuffer()
+{
+}
+
+EncodedImageBuffer::EncodedImageBuffer(Internal::EncodedImageBuffer* internal)
+: BaseHandle(internal)
+{
+}
+
+EncodedImageBuffer::EncodedImageBuffer(const EncodedImageBuffer& handle)
+: BaseHandle(handle)
+{
+}
+
+const EncodedImageBuffer::RawBufferType& EncodedImageBuffer::GetRawBuffer() const
+{
+ return GetImplementation(*this).GetRawBuffer();
+}
+
+EncodedImageBuffer& EncodedImageBuffer::operator=(const EncodedImageBuffer& handle)
+{
+ BaseHandle::operator=(handle);
+ return *this;
+}
+
+EncodedImageBuffer EncodedImageBuffer::New(const RawBufferType& buffer)
+{
+ IntrusivePtr<Internal::EncodedImageBuffer> internal = Internal::EncodedImageBuffer::New(buffer);
+ return EncodedImageBuffer(internal.Get());
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_ENCODED_IMAGE_BUFFER_H
+#define DALI_ENCODED_IMAGE_BUFFER_H
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/common/dali-vector.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
+namespace Dali
+{
+namespace Internal DALI_INTERNAL
+{
+class EncodedImageBuffer;
+}
+
+/**
+ * @brief EncodedImageBuffer contains the large encoded raw buffer informations.
+ *
+ * We can upload this buffer by generated url.
+ * The images are loaded by a worker thread to avoid blocking the main event thread.
+ * @note cannot change raw buffer after make handle.
+ * @note only regular image upload support now.
+ */
+class DALI_ADAPTOR_API EncodedImageBuffer : public BaseHandle
+{
+public:
+ using RawBufferType = Dali::Vector<uint8_t>;
+
+public:
+ /**
+ * @brief Create a new EncodedImageBuffer.
+ *
+ * @param [in] buffer The encoded raw buffer
+ * @return A handle to a new EncodedImageBuffer.
+ */
+ static EncodedImageBuffer New(const RawBufferType& buffer);
+
+ /**
+ * @brief Create an empty handle.
+ *
+ * Calling member functions of an empty handle is not allowed.
+ */
+ EncodedImageBuffer();
+
+ /**
+ * @brief Destructor.
+ */
+ ~EncodedImageBuffer();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ EncodedImageBuffer(const EncodedImageBuffer& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ * @return A reference to this
+ */
+ EncodedImageBuffer& operator=(const EncodedImageBuffer& handle);
+
+ /**
+ * @brief Get raw buffer data
+ * @note this method return const value. Mean, you cannot change raw buffer
+ * @return A RawBufferType this buffer have
+ */
+ const RawBufferType& GetRawBuffer() const;
+
+public: // Not intended for developer use
+ explicit DALI_INTERNAL EncodedImageBuffer(Internal::EncodedImageBuffer* impl);
+};
+
+} // namespace Dali
+
+#endif // DALI_ENCODED_IMAGE_BUFFER_H
SET( adaptor_public_api_src_files
${adaptor_public_api_dir}/adaptor-framework/application.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/encoded-image-buffer.cpp
${adaptor_public_api_dir}/adaptor-framework/key.cpp
${adaptor_public_api_dir}/adaptor-framework/window.cpp
${adaptor_public_api_dir}/adaptor-framework/timer.cpp
SET( public_api_adaptor_framework_header_files
${adaptor_public_api_dir}/adaptor-framework/application.h
${adaptor_public_api_dir}/adaptor-framework/device-status.h
+ ${adaptor_public_api_dir}/adaptor-framework/encoded-image-buffer.h
${adaptor_public_api_dir}/adaptor-framework/input-method.h
${adaptor_public_api_dir}/adaptor-framework/key.h
${adaptor_public_api_dir}/adaptor-framework/key-grab.h