Purge underscored header file barriers
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / image-loader / image-load-thread.h
index 4eddce7..4791a75 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_IMAGE_LOAD_THREAD_H__
-#define __DALI_TOOLKIT_IMAGE_LOAD_THREAD_H__
+#ifndef DALI_TOOLKIT_IMAGE_LOAD_THREAD_H
+#define DALI_TOOLKIT_IMAGE_LOAD_THREAD_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
 // EXTERNAL INCLUDES
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/images/image-operations.h>
 #include <dali/devel-api/threading/conditional-wait.h>
 #include <dali/devel-api/threading/mutex.h>
 #include <dali/devel-api/threading/thread.h>
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
 #include <dali/devel-api/adaptor-framework/event-thread-callback.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/integration-api/adaptors/log-factory-interface.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
 
 namespace Dali
 {
@@ -42,8 +45,21 @@ struct LoadingTask
 {
   /**
    * Constructor.
+   * @param [in] id of the task
+   * @param [in] url The URL of the image file to load.
+   * @param [in] size The width and height to fit the loaded image to, 0.0 means whole image
+   * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
+   * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
+   * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
    */
-  LoadingTask( uint32_t id, BitmapLoader loader );
+  LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dimensions,
+               FittingMode::Type fittingMode, SamplingMode::Type samplingMode,
+               bool orientationCorrection );
+
+  /**
+   * Load the image
+   */
+  void Load();
 
 private:
 
@@ -55,8 +71,14 @@ private:
 
 public:
 
-  BitmapLoader loader;    ///< The loader used to load the bitmap from URL
-  uint32_t     id;        ///< The id associated with this task.
+  Devel::PixelBuffer pixelBuffer;   ///< pixelBuffer handle after successful load
+  VisualUrl          url;           ///< url of the image to load
+  uint32_t           id;            ///< The unique id associated with this task.
+  ImageDimensions    dimensions;    ///< dimensions to load
+  FittingMode::Type  fittingMode;   ///< fitting options
+  SamplingMode::Type samplingMode;  ///< sampling options
+  bool               orientationCorrection:1; ///< if orientation correction is needed
+
 };
 
 
@@ -83,6 +105,8 @@ public:
    * Add a task in to the loading queue
    *
    * @param[in] task The task added to the queue.
+   *
+   * @note This class takes ownership of the task object
    */
   void AddTask( LoadingTask* task );
 
@@ -139,10 +163,11 @@ private:
 
   Vector< LoadingTask* > mLoadQueue;     ///<The task queue with images for loading.
   Vector< LoadingTask* > mCompleteQueue; ///<The task queue with images loaded.
+  EventThreadCallback*   mTrigger;
+  const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
 
   ConditionalWait        mConditionalWait;
   Dali::Mutex            mMutex;
-  EventThreadCallback*   mTrigger;
 };
 
 } // namespace Internal
@@ -151,4 +176,4 @@ private:
 
 } // namespace Dali
 
-#endif /* __DALI_TOOLKIT_IMAGE_LOAD_THREAD_H__ */
+#endif // DALI_TOOLKIT_IMAGE_LOAD_THREAD_H