Provide general purpose Quad in GlobalState

This commit is contained in:
Jonas Kulla 2013-09-04 19:07:28 +02:00
parent e8a9873125
commit f89cd2d207
3 changed files with 12 additions and 4 deletions

View File

@ -254,7 +254,7 @@ void Bitmap::stretchBlt(const IntRect &destRect,
shader.setSubRect(bltSubRect);
shader.setOpacity(normOpacity);
Quad quad;
Quad &quad = gState->gpQuad();
quad.setTexPosRect(sourceRect, destRect);
quad.setColor(Vec4(1, 1, 1, normOpacity));
@ -303,7 +303,7 @@ void Bitmap::gradientFillRect(const IntRect &rect,
flush();
Quad quad;
Quad &quad = gState->gpQuad();
if (vertical)
{
@ -405,8 +405,9 @@ void Bitmap::hueChange(int hue)
FloatRect texRect(rect());
Quad quad;
Quad &quad = gState->gpQuad();
quad.setTexPosRect(texRect, texRect);
quad.setColor(Vec4(1, 1, 1, 1));
/* Calculate hue parameter */
hue = wrapRange(hue, 0, 359);
@ -521,7 +522,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
Tex::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA);
Tex::setSmooth(true);
Quad quad;
Quad &quad = gState->gpQuad();
quad.setTexRect(FloatRect(0, 0, txtSurf->w, txtSurf->h));
quad.setPosRect(posRect);
SDL_FreeSurface(txtSurf);

View File

@ -33,6 +33,7 @@
#include "eventthread.h"
#include "gl-util.h"
#include "global-ibo.h"
#include "quad.h"
#include "binding.h"
#include <QFile>
@ -80,6 +81,8 @@ struct GlobalStatePrivate
TexFBO gpTexFBO;
Quad gpQuad;
unsigned int stampCounter;
GlobalStatePrivate(RGSSThreadData *threadData)
@ -180,6 +183,7 @@ GSATT(HueShader&, hueShader)
GSATT(BltShader&, bltShader)
GSATT(TexPool&, texPool)
GSATT(FontPool&, fontPool)
GSATT(Quad&, gpQuad)
void GlobalState::setBindingData(void *data)
{

View File

@ -33,6 +33,7 @@ struct GlobalIBO;
struct mrb_state;
struct SDL_Window;
struct TexFBO;
struct Quad;
class Scene;
class FileSystem;
@ -101,6 +102,8 @@ struct GlobalState
TexFBO &gpTexFBO(int minW, int minH);
Quad &gpQuad();
/* Checks EventThread's shutdown request flag and if set,
* requests the binding to terminate. In this case, this
* function will most likely not return */