mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-24 21:55:58 +01:00
matrix: remove wlr_matrix_projection()
69477051cc
("matrix: deprecate wlr_matrix_projection") marked it
as deprecated. 1 year later, we can now remove it from our public
API.
This commit is contained in:
parent
c2e046022f
commit
96b594110d
5 changed files with 22 additions and 13 deletions
15
include/types/wlr_matrix.h
Normal file
15
include/types/wlr_matrix.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef TYPES_WLR_MATRIX_H
|
||||||
|
#define TYPES_WLR_MATRIX_H
|
||||||
|
|
||||||
|
#include <wlr/types/wlr_matrix.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a 2D orthographic projection matrix to mat of (width, height) with a
|
||||||
|
* specified wl_output_transform.
|
||||||
|
*
|
||||||
|
* Equivalent to glOrtho(0, width, 0, height, 1, -1) with the transform applied.
|
||||||
|
*/
|
||||||
|
void matrix_projection(float mat[static 9], int width, int height,
|
||||||
|
enum wl_output_transform transform);
|
||||||
|
|
||||||
|
#endif
|
|
@ -43,14 +43,6 @@ void wlr_matrix_rotate(float mat[static 9], float rad);
|
||||||
void wlr_matrix_transform(float mat[static 9],
|
void wlr_matrix_transform(float mat[static 9],
|
||||||
enum wl_output_transform transform);
|
enum wl_output_transform transform);
|
||||||
|
|
||||||
/** Writes a 2D orthographic projection matrix to mat of (width, height) with a
|
|
||||||
* specified wl_output_transform.
|
|
||||||
*
|
|
||||||
* Deprecated: this function is deprecated and will be removed in a future
|
|
||||||
* version of wlroots. */
|
|
||||||
void wlr_matrix_projection(float mat[static 9], int width, int height,
|
|
||||||
enum wl_output_transform transform);
|
|
||||||
|
|
||||||
/** Shortcut for the various matrix operations involved in projecting the
|
/** Shortcut for the various matrix operations involved in projecting the
|
||||||
* specified wlr_box onto a given orthographic projection with a given
|
* specified wlr_box onto a given orthographic projection with a given
|
||||||
* rotation. The result is written to mat, which can be applied to each
|
* rotation. The result is written to mat, which can be applied to each
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "render/egl.h"
|
#include "render/egl.h"
|
||||||
#include "render/gles2.h"
|
#include "render/gles2.h"
|
||||||
#include "render/pixel_format.h"
|
#include "render/pixel_format.h"
|
||||||
|
#include "types/wlr_matrix.h"
|
||||||
|
|
||||||
static const GLfloat verts[] = {
|
static const GLfloat verts[] = {
|
||||||
1, 0, // top right
|
1, 0, // top right
|
||||||
|
@ -203,7 +204,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
|
||||||
renderer->viewport_height = height;
|
renderer->viewport_height = height;
|
||||||
|
|
||||||
// refresh projection matrix
|
// refresh projection matrix
|
||||||
wlr_matrix_projection(renderer->projection, width, height,
|
matrix_projection(renderer->projection, width, height,
|
||||||
WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
||||||
|
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "render/vulkan/shaders/texture.frag.h"
|
#include "render/vulkan/shaders/texture.frag.h"
|
||||||
#include "render/vulkan/shaders/quad.frag.h"
|
#include "render/vulkan/shaders/quad.frag.h"
|
||||||
#include "types/wlr_buffer.h"
|
#include "types/wlr_buffer.h"
|
||||||
|
#include "types/wlr_matrix.h"
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - simplify stage allocation, don't track allocations but use ringbuffer-like
|
// - simplify stage allocation, don't track allocations but use ringbuffer-like
|
||||||
|
@ -564,9 +565,9 @@ static void vulkan_begin(struct wlr_renderer *wlr_renderer,
|
||||||
vkCmdSetScissor(cb, 0, 1, &rect);
|
vkCmdSetScissor(cb, 0, 1, &rect);
|
||||||
|
|
||||||
// Refresh projection matrix.
|
// Refresh projection matrix.
|
||||||
// wlr_matrix_projection assumes a GL corrdinate system so we need
|
// matrix_projection() assumes a GL coordinate system so we need
|
||||||
// to pass WL_OUTPUT_TRANSFORM_FLIPPED_180 to adjust it for vulkan.
|
// to pass WL_OUTPUT_TRANSFORM_FLIPPED_180 to adjust it for vulkan.
|
||||||
wlr_matrix_projection(renderer->projection, width, height,
|
matrix_projection(renderer->projection, width, height,
|
||||||
WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
||||||
|
|
||||||
renderer->render_width = width;
|
renderer->render_width = width;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
|
#include "types/wlr_matrix.h"
|
||||||
|
|
||||||
void wlr_matrix_identity(float mat[static 9]) {
|
void wlr_matrix_identity(float mat[static 9]) {
|
||||||
static const float identity[9] = {
|
static const float identity[9] = {
|
||||||
|
@ -117,8 +118,7 @@ void wlr_matrix_transform(float mat[static 9],
|
||||||
wlr_matrix_multiply(mat, mat, transforms[transform]);
|
wlr_matrix_multiply(mat, mat, transforms[transform]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equivalent to glOrtho(0, width, 0, height, 1, -1) with the transform applied
|
void matrix_projection(float mat[static 9], int width, int height,
|
||||||
void wlr_matrix_projection(float mat[static 9], int width, int height,
|
|
||||||
enum wl_output_transform transform) {
|
enum wl_output_transform transform) {
|
||||||
memset(mat, 0, sizeof(*mat) * 9);
|
memset(mat, 0, sizeof(*mat) * 9);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue