/*
- * Copyright (c) 2014 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.
BlendingOptions::BlendingOptions()
: mBitmask( 0u ),
- mBlendColor( NULL )
+ mBlendColor( nullptr )
{
SetBlendFunc( BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA,
BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA );
SetBlendEquation( BlendEquation::ADD, BlendEquation::ADD );
}
-BlendingOptions::~BlendingOptions()
-{
- delete mBlendColor;
-}
+BlendingOptions::~BlendingOptions() = default;
void BlendingOptions::SetBitmask( unsigned int bitmask )
{
void BlendingOptions::SetBlendColor( const Vector4& color )
{
- if( Vector4::ZERO == color )
+ if( Color::TRANSPARENT == color )
{
- if( mBlendColor )
- {
- // Discard unnecessary vector
- delete mBlendColor;
- mBlendColor = NULL;
- }
- return;
- }
-
- if( mBlendColor )
- {
- *mBlendColor = color;
+ mBlendColor = nullptr;
}
else
{
- // Lazy allocation when non-default is set
- mBlendColor = new Vector4( color );
+ if( mBlendColor )
+ {
+ *mBlendColor = color;
+ }
+ else
+ {
+ // Lazy allocation when non-default is set
+ mBlendColor = new Vector4( color );
+ }
}
}
const Vector4* BlendingOptions::GetBlendColor() const
{
- return mBlendColor;
+ return mBlendColor.Get();
}
} // namespace Internal