${adaptor_styling_common_src_files}
${adaptor_system_common_src_files}
${adaptor_system_linux_src_files}
+ ${adaptor_system_tizen_wayland_src_files}
${adaptor_system_tizen_wearable_src_files}
${adaptor_text_common_src_files}
${adaptor_resampler_src_files}
*/
// CLASS HEADER
-#include <dali/internal/system/tizen-wayland/tizen-wearable/capture-impl.h>
+#include <dali/internal/system/common/capture-impl.h>
// EXTERNAL INCLUDES
#include <fstream>
Capture::Capture()
: mTimer(),
mPath(),
- mNativeImageSourcePtr( NULL ),
- mTbmSurface( NULL )
+ mNativeImageSourcePtr( NULL )
{
}
: mCameraActor( cameraActor ),
mTimer(),
mPath(),
- mNativeImageSourcePtr( NULL ),
- mTbmSurface( NULL )
+ mNativeImageSourcePtr( NULL )
{
}
Capture::~Capture()
{
+ DeleteNativeImageSource();
}
CapturePtr Capture::New()
return mFinishedSignal;
}
-void Capture::CreateSurface( const Vector2& size )
-{
- DALI_ASSERT_ALWAYS(!mTbmSurface && "mTbmSurface is already created.");
-
- mTbmSurface = tbm_surface_create( size.width, size.height, TBM_FORMAT_RGBA8888 );
-}
-
-void Capture::DeleteSurface()
-{
- DALI_ASSERT_ALWAYS(mTbmSurface && "mTbmSurface is empty.");
-
- tbm_surface_destroy( mTbmSurface );
- mTbmSurface = NULL;
-}
-
-void Capture::ClearSurface( const Vector2& size )
-{
- DALI_ASSERT_ALWAYS(mTbmSurface && "mTbmSurface is empty.");
-
- tbm_surface_info_s surface_info;
-
- if( tbm_surface_map( mTbmSurface, TBM_SURF_OPTION_WRITE, &surface_info ) == TBM_SURFACE_ERROR_NONE )
- {
- //DALI_ASSERT_ALWAYS(surface_info.bpp == 32 && "unsupported tbm format");
-
- unsigned char* ptr = surface_info.planes[0].ptr;
- memset( ptr, 0, surface_info.size ); // TODO: support color
-
- if( tbm_surface_unmap( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
- {
- DALI_LOG_ERROR( "Fail to unmap tbm_surface\n" );
- }
- }
- else
- {
- DALI_ASSERT_ALWAYS(0 && "tbm_surface_map failed");
- }
-}
-
-bool Capture::IsSurfaceCreated()
-{
- return mTbmSurface != 0;
-}
-
-void Capture::CreateNativeImageSource()
+void Capture::CreateNativeImageSource( const Vector2& size )
{
Dali::Adaptor& adaptor = Dali::Adaptor::Get();
DALI_ASSERT_ALWAYS(adaptor.IsAvailable() && "Dali::Adaptor is not available.");
- DALI_ASSERT_ALWAYS(mTbmSurface && "mTbmSurface is empty.");
-
DALI_ASSERT_ALWAYS(!mNativeImageSourcePtr && "NativeImageSource is already created.");
// create the NativeImageSource object with our surface
- mNativeImageSourcePtr = Dali::NativeImageSource::New( mTbmSurface );
+ mNativeImageSourcePtr = Dali::NativeImageSource::New( size.width, size.height, Dali::NativeImageSource::COLOR_DEPTH_DEFAULT );
}
void Capture::DeleteNativeImageSource()
void Capture::SetupResources( const Dali::Vector2& size, const Dali::Vector4& clearColor, Dali::Actor source )
{
- CreateSurface( size );
- ClearSurface( size );
-
- CreateNativeImageSource();
+ CreateNativeImageSource( size );
CreateFrameBuffer();
{
DeleteFrameBuffer();
}
-
- if( IsNativeImageSourceCreated() )
- {
- DeleteNativeImageSource();
- }
-
- if( IsSurfaceCreated() )
- {
- DeleteSurface();
- }
}
void Capture::OnRenderFinished( Dali::RenderTask& task )
if( !Save() )
{
state = Dali::Capture::FinishState::FAILED;
- DALI_LOG_ERROR("Fail to Capture mTbmSurface[%p] Path[%s]", mTbmSurface, mPath.c_str());
+ DALI_LOG_ERROR("Fail to Capture Path[%s]", mPath.c_str());
}
Dali::Capture handle( this );
// EXTERNAL INCLUDES
#include <string>
#include <memory>
-#include <tbm_surface.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/render-tasks/render-task.h>
private:
/**
- * @brief Create surface.
- *
- * @param[in] size of surface.
- */
- void CreateSurface( const Dali::Vector2& size );
-
- /**
- * @brief Delete surface.
- */
- void DeleteSurface();
-
- /**
- * @brief Clear surface with color.
- *
- * @param[in] size of clear aread.
- */
- void ClearSurface( const Dali::Vector2& size );
-
- /**
- * @brief Query whether surface is created or not.
- *
- * @return True is surface is created.
- */
- bool IsSurfaceCreated();
-
- /**
* @brief Create native image source.
*/
- void CreateNativeImageSource();
+ void CreateNativeImageSource( const Dali::Vector2& size );
/**
* @brief Delete native image source.
Dali::Capture::CaptureFinishedSignalType mFinishedSignal;
std::string mPath;
Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< pointer to surface image
- tbm_surface_h mTbmSurface;
};
} // End of namespace Adaptor
# module: system, backend: common
SET( adaptor_system_common_src_files
${adaptor_system_dir}/common/abort-handler.cpp
+ ${adaptor_system_dir}/common/capture-impl.cpp
${adaptor_system_dir}/common/color-controller-impl.cpp
${adaptor_system_dir}/common/command-line-options.cpp
${adaptor_system_dir}/common/configuration-manager.cpp
# module: system, backend: tizen-wearable
SET( adaptor_system_tizen_wearable_src_files
- ${adaptor_system_dir}/common/shared-file.cpp
- ${adaptor_system_dir}/common/trigger-event.cpp
- ${adaptor_system_dir}/common/trigger-event-factory.cpp
- ${adaptor_system_dir}/tizen-wayland/logging-tizen.cpp
- ${adaptor_system_dir}/tizen-wayland/tizen-wearable/capture.cpp
- ${adaptor_system_dir}/tizen-wayland/tizen-wearable/capture-impl-tizen.cpp
${adaptor_system_dir}/tizen-wayland/tizen-wearable/watch-time.cpp
- ${adaptor_system_dir}/tizen-wayland/system-settings-tizen.cpp
- ${adaptor_system_dir}/tizen-wayland/widget-application-impl-tizen.cpp
- ${adaptor_system_dir}/tizen-wayland/widget-controller-tizen.cpp
)
# module: system, backend: ubuntu-x11
#include <dali/public-api/capture/capture.h>
// INTERNAL HEADER
-#include <dali/internal/system/tizen-wayland/tizen-wearable/capture-impl.h>
+#include <dali/internal/system/common/capture-impl.h>
namespace Dali
{
#define DALI_CAPTURE_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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 Capture snapshots the current scene and save as a file.
*
- * @SINCE_1_3_4
+ * @SINCE_1_3.4
*
* Applications should follow the example below to create capture :
*
SET( adaptor_public_api_src_files
- ${adaptor_public_api_dir}/adaptor-framework/application.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
- ${adaptor_public_api_dir}/adaptor-framework/tts-player.cpp
- ${adaptor_public_api_dir}/adaptor-framework/native-image-source.cpp
- ${adaptor_public_api_dir}/adaptor-framework/widget.cpp
- ${adaptor_public_api_dir}/adaptor-framework/widget-application.cpp
- ${adaptor_public_api_dir}/adaptor-framework/widget-impl.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/application.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
+ ${adaptor_public_api_dir}/adaptor-framework/tts-player.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/native-image-source.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/widget.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/widget-application.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/widget-impl.cpp
+ ${adaptor_public_api_dir}/capture/capture.cpp
${adaptor_public_api_dir}/dali-adaptor-version.cpp
)
SET( public_api_header_files
- ${adaptor_public_api_dir}/dali-adaptor-version.h
+ ${adaptor_public_api_dir}/dali-adaptor-version.h
${adaptor_public_api_dir}/dali-adaptor-common.h
)
SET( public_api_adaptor_framework_header_files
- ${adaptor_public_api_dir}/adaptor-framework/application.h
- ${adaptor_public_api_dir}/adaptor-framework/application-configuration.h
- ${adaptor_public_api_dir}/adaptor-framework/device-status.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
- ${adaptor_public_api_dir}/adaptor-framework/style-change.h
- ${adaptor_public_api_dir}/adaptor-framework/timer.h
- ${adaptor_public_api_dir}/adaptor-framework/tts-player.h
- ${adaptor_public_api_dir}/adaptor-framework/native-image-source.h
- ${adaptor_public_api_dir}/adaptor-framework/window.h
- ${adaptor_public_api_dir}/adaptor-framework/widget.h
- ${adaptor_public_api_dir}/adaptor-framework/widget-application.h
+ ${adaptor_public_api_dir}/adaptor-framework/application.h
+ ${adaptor_public_api_dir}/adaptor-framework/application-configuration.h
+ ${adaptor_public_api_dir}/adaptor-framework/device-status.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
+ ${adaptor_public_api_dir}/adaptor-framework/style-change.h
+ ${adaptor_public_api_dir}/adaptor-framework/timer.h
+ ${adaptor_public_api_dir}/adaptor-framework/tts-player.h
+ ${adaptor_public_api_dir}/adaptor-framework/native-image-source.h
+ ${adaptor_public_api_dir}/adaptor-framework/window.h
+ ${adaptor_public_api_dir}/adaptor-framework/widget.h
+ ${adaptor_public_api_dir}/adaptor-framework/widget-application.h
${adaptor_public_api_dir}/adaptor-framework/widget-impl.h
)
+
+SET( public_dali_capture_header_files
+ ${adaptor_public_api_dir}/capture/capture.h
+)
+
+
# wearable and watch extra public headers
SET( adaptor_dali_wearable_header_file
${adaptor_public_api_dir}/watch/dali-wearable.h
)
+
# wearable and watch extra public headers
SET( public_dali_watch_header_files
- ${adaptor_public_api_dir}/watch/watch-application.h
+ ${adaptor_public_api_dir}/watch/watch-application.h
${adaptor_public_api_dir}/watch/watch-time.h
-)
-
-# wearable and watch extra public headers
-SET( public_dali_capture_header_files
- ${adaptor_public_api_dir}/capture/capture.h
-)
-
+)
\ No newline at end of file