X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhslider.cpp;h=837b2ba5c2dae4a0344da91665661079c7e427ef;hb=c8291177b545ec81930603a5915234a60296db51;hp=e855fcfb4d80bf6bf44bfa81dd12a039bc895f4a;hpb=43ac7c4514658754d09552463425bcd344fb9ded;p=libs%2Fgltk.git diff --git a/source/hslider.cpp b/source/hslider.cpp index e855fcf..837b2ba 100644 --- a/source/hslider.cpp +++ b/source/hslider.cpp @@ -1,12 +1,5 @@ -/* $Id$ - -This file is part of libmspgltk -Copyright © 2007-2008, 2010-2011 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include -#include +#include #include "graphic.h" #include "hslider.h" #include "part.h" @@ -35,10 +28,14 @@ void HSlider::autosize() } } -void HSlider::render_special(const Part &part) const +void HSlider::rebuild_special(const Part &part) { if(part.get_name()=="slider") { + const Graphic *graphic = part.get_graphic(state); + if(!graphic || !graphic->get_texture()) + return; + Alignment align = part.get_alignment(); if(max>min) align.x = (value-min)/(max-min); @@ -46,10 +43,9 @@ void HSlider::render_special(const Part &part) const Geometry pgeom = part.get_geometry(); align.apply(pgeom, geom, part.get_margin()); - GL::push_matrix(); - GL::translate(pgeom.x, pgeom.y, 0); - part.get_graphic(state)->render(pgeom.w, pgeom.h); - GL::pop_matrix(); + GL::MeshBuilder bld(part_cache.create_mesh(part, *graphic->get_texture())); + bld.matrix() *= GL::Matrix::translation(pgeom.x, pgeom.y, 0); + graphic->build(pgeom.w, pgeom.h, bld); } }