/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
mRenderRefreshRate( 1 ),
mGlesCallAccumulate( false ),
mMultiSamplingLevel( 0 ),
+ mMaxTextureSize( 0 ),
mLogFunction( NULL )
{
ParseEnvironmentOptions();
return mMultiSamplingLevel;
}
+unsigned int EnvironmentOptions::GetMaxTextureSize() const
+{
+ return mMaxTextureSize;
+}
+
bool EnvironmentOptions::PerformanceServerRequired() const
{
return ( ( GetPerformanceStatsLoggingOptions() > 0) ||
mMultiSamplingLevel = multiSamplingLevel;
}
}
+
+ int maxTextureSize( 0 );
+ if( GetIntegerEnvironmentVariable( DALI_ENV_MAX_TEXTURE_SIZE, maxTextureSize ) )
+ {
+ if( maxTextureSize > 0 )
+ {
+ mMaxTextureSize = maxTextureSize;
+ }
+ }
}
} // Adaptor
#define __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
*/
unsigned int GetMultiSamplingLevel() const;
+ /**
+ * @return The maximum texture size
+ */
+ unsigned int GetMaxTextureSize() const;
+
private: // Internal
/**
unsigned int mRenderRefreshRate; ///< render refresh rate
bool mGlesCallAccumulate; ///< Whether or not to accumulate gles call statistics
unsigned int mMultiSamplingLevel; ///< The number of samples required in multisample buffers
+ unsigned int mMaxTextureSize; ///< The maximum texture size that GL can handle
Dali::Integration::Log::LogFunction mLogFunction;
#define __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_VARIABLES_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
#define DALI_ENV_MULTI_SAMPLING_LEVEL "DALI_MULTI_SAMPLING_LEVEL"
+#define DALI_ENV_MAX_TEXTURE_SIZE "DALI_MAX_TEXTURE_SIZE"
+
} // namespace Adaptor
} // namespace Internal
// INTERNAL INCLUDES
#include <base/thread-controller.h>
-# include <base/performance-logging/performance-interface-factory.h>
+#include <base/performance-logging/performance-interface-factory.h>
#include <base/lifecycle-observer.h>
#include <dali/devel-api/text-abstraction/font-client.h>
#include <window-impl.h>
#include <tizen-logging.h>
+#include <image-loading.h>
using Dali::TextAbstraction::FontClient;
{
Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
}
+
+ // Set max texture size
+ if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
+ {
+ Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
+ }
}
Adaptor::~Adaptor()
namespace
{
+
// limit maximum image down load size to 50 MB
const size_t MAXIMUM_DOWNLOAD_IMAGE_SIZE = 50 * 1024 * 1024 ;
+
+static unsigned int gMaxTextureSize = 4096;
+
}
Devel::PixelBuffer LoadImageFromFile( const std::string& url, ImageDimensions size, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection )
SamplingMode::Type samplingMode,
bool orientationCorrection )
{
- return TizenPlatform::ImageLoader::GetClosestImageSize( filename, size, fittingMode, samplingMode, orientationCorrection );
+ ImageDimensions dimension = TizenPlatform::ImageLoader::GetClosestImageSize( filename, size, fittingMode, samplingMode, orientationCorrection );
+
+ dimension.SetWidth( std::min( dimension.GetWidth(), static_cast< uint16_t >( GetMaxTextureSize() ) ) );
+ dimension.SetHeight( std::min( dimension.GetHeight(), static_cast< uint16_t >( GetMaxTextureSize() ) ) );
+
+ return dimension;
}
return Dali::Devel::PixelBuffer();
}
+void SetMaxTextureSize( unsigned int size )
+{
+ gMaxTextureSize = size;
+}
+
+unsigned int GetMaxTextureSize()
+{
+ return gMaxTextureSize;
+}
} // namespace Dali
SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR,
bool orientationCorrection = true );
+/**
+ * @brief Set the maximum texture size. Then size can be kwown by GL_MAX_TEXTURE_SIZE.
+ *
+ * @param [in] size The maximum texture size to set
+ */
+void SetMaxTextureSize( unsigned int size );
+
+/**
+ * @brief get the maximum texture size.
+ *
+ * @return The maximum texture size
+ */
+unsigned int GetMaxTextureSize();
} // Dali
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/math/vector2.h>
#include <resampler.h>
+#include <image-loading.h>
// INTERNAL INCLUDES
*/
ImageDimensions CalculateDesiredDimensions( unsigned int bitmapWidth, unsigned int bitmapHeight, unsigned int requestedWidth, unsigned int requestedHeight )
{
+ unsigned int maxSize = Dali::GetMaxTextureSize();
+
// If no dimensions have been requested, default to the source ones:
if( requestedWidth == 0 && requestedHeight == 0 )
{
- return ImageDimensions( bitmapWidth, bitmapHeight );
+ return ImageDimensions( std::min( bitmapWidth, maxSize ), std::min( bitmapHeight, maxSize ) );
}
// If both dimensions have values requested, use them both:
if( requestedWidth != 0 && requestedHeight != 0 )
{
- return ImageDimensions( requestedWidth, requestedHeight );
+ return ImageDimensions( std::min( requestedWidth, maxSize ), std::min( requestedHeight, maxSize ) );
}
// Only one of the dimensions has been requested. Calculate the other from
// the requested one and the source image aspect ratio:
if( requestedWidth != 0 )
{
+ requestedWidth = std::min( requestedWidth, maxSize );
return ImageDimensions( requestedWidth, bitmapHeight / float(bitmapWidth) * requestedWidth + 0.5f );
}
+
+ requestedHeight = std::min( requestedHeight, maxSize );
return ImageDimensions( bitmapWidth / float(bitmapHeight) * requestedHeight + 0.5f, requestedHeight );
}