mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
DrawBuffer: Basic scissor support.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/logging.h"
|
||||
#include "math/math_util.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
@@ -360,3 +361,15 @@ void DrawBuffer::EnableBlend(bool enable) {
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void DrawBuffer::SetClipRect(float x, float y, float w, float h)
|
||||
{
|
||||
// Sigh, OpenGL is upside down.
|
||||
glScissor(x, g_yres - y, w, h);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
void DrawBuffer::NoClip()
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
@@ -97,6 +97,13 @@ class DrawBuffer {
|
||||
// Utility to avoid having to include gl.h just for this in UI code.
|
||||
void EnableBlend(bool enable);
|
||||
|
||||
|
||||
// Rectangular clipping, implemented using scissoring.
|
||||
// Must flush before and after.
|
||||
void SetClipRect(float x1, float y1, float x2, float y2);
|
||||
void NoClip();
|
||||
|
||||
|
||||
private:
|
||||
void DoAlign(int flags, float *x, float *y, float *w, float *h);
|
||||
struct Vertex {
|
||||
|
||||
Reference in New Issue
Block a user