Permalink
Browse files

more TexturedQuad allocations removed

  • Loading branch information...
1 parent 2055086 commit d2d9a327815e5fa0d67c562f2bb35cc271cfb6b8 @robn robn committed Mar 11, 2012
Showing with 4 additions and 5 deletions.
  1. +3 −4 src/gui/GuiGradient.cpp
  2. +1 −1 src/gui/GuiGradient.h
View
@@ -13,9 +13,8 @@ Gradient::Gradient(float width, float height, const Color &beginColor, const Col
};
vector2f size = direction == HORIZONTAL ? vector2f(2.0f,1.0f) : vector2f(1.0f,2.0f);
- Graphics::Texture *texture = Gui::Screen::GetRenderer()->CreateTexture(Graphics::TextureDescriptor(Graphics::TEXTURE_RGBA, size));
- texture->Update(data, size, Graphics::IMAGE_RGBA, Graphics::IMAGE_FLOAT);
- m_quad.Reset(new TexturedQuad(texture));
+ m_texture.Reset(Gui::Screen::GetRenderer()->CreateTexture(Graphics::TextureDescriptor(Graphics::TEXTURE_RGBA, size)));
+ m_texture->Update(data, size, Graphics::IMAGE_RGBA, Graphics::IMAGE_FLOAT);
}
void Gradient::GetSizeRequested(float size[2])
@@ -28,7 +27,7 @@ void Gradient::Draw()
float size[2];
GetSize(size);
- m_quad->Draw(Gui::Screen::GetRenderer(), vector2f(0.0f), vector2f(size[0],size[1]));
+ TexturedQuad(m_texture.Get()).Draw(Gui::Screen::GetRenderer(), vector2f(0.0f), vector2f(size[0],size[1]));
}
}
View
@@ -26,7 +26,7 @@ namespace Gui {
virtual void GetSizeRequested(float size[2]);
private:
- ScopedPtr<TexturedQuad> m_quad;
+ RefCountedPtr<Graphics::Texture> m_texture;
};
}

0 comments on commit d2d9a32

Please sign in to comment.