Browse Source

Make also constructor protected when destructor is protected.

Creating given object on heap (via new) (and then not deleting it) would
be possible that way, which shouldn't be.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
f937be8646
  1. 3
      src/AbstractFramebuffer.h
  2. 14
      src/AbstractImage.h

3
src/AbstractFramebuffer.h

@ -189,8 +189,6 @@ class MAGNUM_EXPORT AbstractFramebuffer {
blit(source, destination, rectangle, rectangle, mask, FramebufferBlitFilter::Nearest);
}
explicit AbstractFramebuffer() = default;
/**
* @brief Bind framebuffer for rendering
*
@ -268,6 +266,7 @@ class MAGNUM_EXPORT AbstractFramebuffer {
#else
protected:
#endif
explicit AbstractFramebuffer() = default;
~AbstractFramebuffer() = default;
void MAGNUM_LOCAL bindInternal(FramebufferTarget target);

14
src/AbstractImage.h

@ -56,13 +56,6 @@ class MAGNUM_EXPORT AbstractImage {
*/
static std::size_t pixelSize(ImageFormat format, ImageType type);
/**
* @brief Constructor
* @param format Format of pixel data
* @param type Data type of pixel data
*/
constexpr explicit AbstractImage(ImageFormat format, ImageType type): _format(format), _type(type) {}
/** @brief Format of pixel data */
constexpr ImageFormat format() const { return _format; }
@ -77,6 +70,13 @@ class MAGNUM_EXPORT AbstractImage {
std::size_t pixelSize() const { return pixelSize(_format, _type); }
protected:
/**
* @brief Constructor
* @param format Format of pixel data
* @param type Data type of pixel data
*/
constexpr explicit AbstractImage(ImageFormat format, ImageType type): _format(format), _type(type) {}
~AbstractImage() = default;
#ifdef DOXYGEN_GENERATING_OUTPUT

Loading…
Cancel
Save