-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * Copyright (c) 2014 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 <dali/internal/render/gl-resources/compressed-bitmap-texture.h>
-// EXTERNAL INCLUDES
-#include <math.h>
-#include <memory.h>
-
// INTERNAL INCLUDES
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/math/math-utils.h>
#include <dali/integration-api/debug.h>
-#include <dali/internal/render/common/vertex.h>
#include <dali/internal/render/common/performance-monitor.h>
#include <dali/internal/render/gl-resources/context.h>
+#include <dali/internal/render/gl-resources/texture-units.h>
namespace Dali
{
namespace Internal
{
-CompressedBitmapTexture::CompressedBitmapTexture(Internal::BitmapCompressed* const bitmap, Context& context)
+CompressedBitmapTexture::CompressedBitmapTexture(Internal::BitmapCompressed* const bitmap, Context& context, ResourcePolicy::Discardable /*discardPolicy*/)
: Texture(context,
bitmap->GetImageWidth(),
bitmap->GetImageHeight(),
bitmap->GetImageWidth(),
- bitmap->GetImageHeight(),
- bitmap->GetPixelFormat()),
- mBitmap(bitmap)
+ bitmap->GetImageHeight()),
+ mBitmap(bitmap),
+ mPixelFormat( bitmap->GetPixelFormat() )
{
DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
DALI_LOG_SET_OBJECT_STRING(this, DALI_LOG_GET_OBJECT_STRING(bitmap));
}
DALI_ASSERT_DEBUG( mId != 0 );
- mContext.ActiveTexture(GL_TEXTURE7); // bind in unused unit so rebind works the first time
+ mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD );
mContext.Bind2dTexture(mId);
GLenum pixelFormat = GL_RGBA;
mContext.PixelStorei(GL_UNPACK_ALIGNMENT, 1); // We always use tightly packed data
mContext.CompressedTexImage2D(GL_TEXTURE_2D, 0, pixelFormat, mWidth, mHeight, 0, bufferSize, pixels);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED, bufferSize );
}
void CompressedBitmapTexture::Update( Integration::Bitmap* bitmap )
if( !bitmap )
{
- DALI_LOG_ERROR( "Passed a null bitmap to update this compressed bitmap texture." );
+ DALI_LOG_ERROR( "Passed a null bitmap to update this compressed bitmap texture.\n" );
return;
}
if ( mId ) // If the texture is already bound
{
AssignBitmap( false, pixels, mBitmap->GetBufferSize() );
- mBitmap->DiscardBuffer();
}
}
}