/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
#include <dali/internal/event/images/frame-buffer-image-impl.h>
// INTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/resources/resource-client.h>
namespace Internal
{
-FrameBufferImage::~FrameBufferImage()
+namespace
+{
+TypeRegistration mType( typeid( Dali::FrameBufferImage ), typeid( Dali::Image ), NULL );
+} // unnamed namespace
+
+FrameBufferImagePtr FrameBufferImage::New( unsigned int width,
+ unsigned int height,
+ Pixel::Format pixelFormat,
+ RenderBuffer::Format bufferformat )
{
+ FrameBufferImagePtr image = new FrameBufferImage( width, height, pixelFormat, bufferformat );
+ image->Initialize();
+ return image;
}
-FrameBufferImage::FrameBufferImage(unsigned int width, unsigned int height, Pixel::Format pixelFormat, ReleasePolicy releasePolicy)
-: Image(Dali::Image::Immediate, releasePolicy),
- mPixelFormat(pixelFormat)
+FrameBufferImagePtr FrameBufferImage::New( NativeImageInterface& nativeImage )
{
- mWidth = width;
- mHeight = height;
+ FrameBufferImagePtr image = new FrameBufferImage( nativeImage );
+ image->Initialize();
+ return image;
}
-FrameBufferImage::FrameBufferImage( NativeImage& nativeImage )
-: Image(Dali::Image::Immediate),
- mNativeImage(&nativeImage),
- mPixelFormat(nativeImage.GetPixelFormat())
+
+FrameBufferImage::FrameBufferImage( unsigned int width,
+ unsigned int height,
+ Pixel::Format pixelFormat,
+ RenderBuffer::Format bufferformat )
+: Image(),
+ mNativeImage(0),
+ mPixelFormat( pixelFormat ),
+ mBufferFormat( bufferformat ),
+ mIsNativeFbo( false )
{
- mWidth = nativeImage.GetWidth();
- mHeight = nativeImage.GetHeight();
+ mWidth = width;
+ mHeight = height;
}
-FrameBufferImage::FrameBufferImage( NativeImage& nativeImage, ReleasePolicy releasePolicy )
-: Image(Dali::Image::Immediate, releasePolicy),
- mNativeImage(&nativeImage),
- mPixelFormat(nativeImage.GetPixelFormat())
+FrameBufferImage::FrameBufferImage( NativeImageInterface& nativeImage )
+: Image(),
+ mNativeImage( &nativeImage ),
+ mPixelFormat( Pixel::FIRST_VALID_PIXEL_FORMAT ),
+ mBufferFormat( RenderBuffer::COLOR ),
+ mIsNativeFbo( true )
{
mWidth = nativeImage.GetWidth();
mHeight = nativeImage.GetHeight();
}
else
{
- mTicket = resourceClient.AddFrameBufferImage(mWidth, mHeight, mPixelFormat);
+ mTicket = resourceClient.AddFrameBufferImage(mWidth, mHeight, mPixelFormat, mBufferFormat);
mTicket->AddObserver(*this);
}
}
DALI_ASSERT_DEBUG(mConnectionCount > 0);
--mConnectionCount;
- if (mConnectionCount == 0 && mReleasePolicy == Dali::Image::Unused)
+ if (mConnectionCount == 0)
{
// release image memory when it's not visible anymore (decrease ref. count of texture)
mTicket->RemoveObserver(*this);
}
}
+bool FrameBufferImage::IsNativeFbo() const
+{
+ return mIsNativeFbo;
+}
+
+FrameBufferImage::~FrameBufferImage()
+{
+}
+
} // namespace Internal
} // namespace Dali