diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 94fe4dc758..8509649261 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -73,7 +73,7 @@ Texture(const string &name) : //////////////////////////////////////////////////////////////////// // Function: Texture::Destructor -// Access: Published +// Access: Published, Virtual // Description: //////////////////////////////////////////////////////////////////// Texture:: @@ -1271,6 +1271,36 @@ string_filter_type(const string &string) { } } +//////////////////////////////////////////////////////////////////// +// Function: Texture::up_to_power_2 +// Access: Protected, Static +// Description: Returns the smallest power of 2 greater than or equal +// to value. +//////////////////////////////////////////////////////////////////// +int Texture:: +up_to_power_2(int value) { + int x = 1; + while (x < value) { + x = (x << 1); + } + return x; +} + +//////////////////////////////////////////////////////////////////// +// Function: Texture::down_to_power_2 +// Access: Protected, Static +// Description: Returns the largest power of 2 less than or equal +// to value. +//////////////////////////////////////////////////////////////////// +int Texture:: +down_to_power_2(int value) { + int x = 1; + while ((x << 1) <= value) { + x = (x << 1); + } + return x; +} + //////////////////////////////////////////////////////////////////// // Function: Texture::clear_prepared // Access: Private @@ -1293,36 +1323,6 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) { } } -//////////////////////////////////////////////////////////////////// -// Function: Texture::up_to_power_2 -// Access: Private, Static -// Description: Returns the smallest power of 2 greater than or equal -// to value. -//////////////////////////////////////////////////////////////////// -int Texture:: -up_to_power_2(int value) { - int x = 1; - while (x < value) { - x = (x << 1); - } - return x; -} - -//////////////////////////////////////////////////////////////////// -// Function: Texture::down_to_power_2 -// Access: Private, Static -// Description: Returns the largest power of 2 less than or equal -// to value. -//////////////////////////////////////////////////////////////////// -int Texture:: -down_to_power_2(int value) { - int x = 1; - while ((x << 1) <= value) { - x = (x << 1); - } - return x; -} - //////////////////////////////////////////////////////////////////// // Function: Texture::consider_rescale // Access: Private diff --git a/panda/src/gobj/texture.h b/panda/src/gobj/texture.h index 571bab11e0..cc2919bd31 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -133,7 +133,7 @@ PUBLISHED: PUBLISHED: Texture(const string &name = string()); - ~Texture(); + virtual ~Texture(); void setup_texture(TextureType texture_type, int x_size, int y_size, int z_size, @@ -266,11 +266,12 @@ public: static WrapMode string_wrap_mode(const string &string); static FilterType string_filter_type(const string &string); -private: - void clear_prepared(PreparedGraphicsObjects *prepared_objects); - +protected: static int up_to_power_2(int value); static int down_to_power_2(int value); + +private: + void clear_prepared(PreparedGraphicsObjects *prepared_objects); void consider_rescale(PNMImage &pnmimage); void consider_downgrade(PNMImage &pnmimage, int num_channels);