Skip to content

Commit

Permalink
more TexturedQuad allocations removed
Browse files Browse the repository at this point in the history
  • Loading branch information
robn committed Mar 11, 2012
1 parent 2055086 commit d2d9a32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/gui/GuiGradient.cpp
Expand Up @@ -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])
Expand All @@ -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]));
}

}
2 changes: 1 addition & 1 deletion src/gui/GuiGradient.h
Expand Up @@ -26,7 +26,7 @@ namespace Gui {
virtual void GetSizeRequested(float size[2]);

private:
ScopedPtr<TexturedQuad> m_quad;
RefCountedPtr<Graphics::Texture> m_texture;
};

}
Expand Down

0 comments on commit d2d9a32

Please sign in to comment.