Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/windowmanager/intern/wm_subwindow.c
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/windowmanager/intern/wm_subwindow.c')
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c130
1 files changed, 68 insertions, 62 deletions
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 6f856e16047..2f40947b395 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -37,99 +37,105 @@
void wmViewport(const rcti *winrct)
{
- int width = BLI_rcti_size_x(winrct) + 1;
- int height = BLI_rcti_size_y(winrct) + 1;
+ int width = BLI_rcti_size_x(winrct) + 1;
+ int height = BLI_rcti_size_y(winrct) + 1;
- glViewport(winrct->xmin, winrct->ymin, width, height);
- glScissor(winrct->xmin, winrct->ymin, width, height);
+ glViewport(winrct->xmin, winrct->ymin, width, height);
+ glScissor(winrct->xmin, winrct->ymin, width, height);
- wmOrtho2_pixelspace(width, height);
- GPU_matrix_identity_set();
+ wmOrtho2_pixelspace(width, height);
+ GPU_matrix_identity_set();
}
void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct)
{
- /* Setup part of the viewport for partial redraw. */
- bool scissor_pad;
-
- if (partialrct->xmin == partialrct->xmax) {
- /* Full region. */
- *drawrct = *winrct;
- scissor_pad = true;
- }
- else {
- /* Partial redraw, clipped to region. */
- BLI_rcti_isect(winrct, partialrct, drawrct);
- scissor_pad = false;
- }
-
- int x = drawrct->xmin - winrct->xmin;
- int y = drawrct->ymin - winrct->ymin;
- int width = BLI_rcti_size_x(winrct) + 1;
- int height = BLI_rcti_size_y(winrct) + 1;
-
- int scissor_width = BLI_rcti_size_x(drawrct);
- int scissor_height = BLI_rcti_size_y(drawrct);
-
- /* Partial redraw rect uses different convention than region rect,
- * so compensate for that here. One pixel offset is noticeable with
- * viewport border render. */
- if (scissor_pad) {
- scissor_width += 1;
- scissor_height += 1;
- }
-
- glViewport(0, 0, width, height);
- glScissor(x, y, scissor_width, scissor_height);
-
- wmOrtho2_pixelspace(width, height);
- GPU_matrix_identity_set();
+ /* Setup part of the viewport for partial redraw. */
+ bool scissor_pad;
+
+ if (partialrct->xmin == partialrct->xmax) {
+ /* Full region. */
+ *drawrct = *winrct;
+ scissor_pad = true;
+ }
+ else {
+ /* Partial redraw, clipped to region. */
+ BLI_rcti_isect(winrct, partialrct, drawrct);
+ scissor_pad = false;
+ }
+
+ int x = drawrct->xmin - winrct->xmin;
+ int y = drawrct->ymin - winrct->ymin;
+ int width = BLI_rcti_size_x(winrct) + 1;
+ int height = BLI_rcti_size_y(winrct) + 1;
+
+ int scissor_width = BLI_rcti_size_x(drawrct);
+ int scissor_height = BLI_rcti_size_y(drawrct);
+
+ /* Partial redraw rect uses different convention than region rect,
+ * so compensate for that here. One pixel offset is noticeable with
+ * viewport border render. */
+ if (scissor_pad) {
+ scissor_width += 1;
+ scissor_height += 1;
+ }
+
+ glViewport(0, 0, width, height);
+ glScissor(x, y, scissor_width, scissor_height);
+
+ wmOrtho2_pixelspace(width, height);
+ GPU_matrix_identity_set();
}
void wmWindowViewport(wmWindow *win)
{
- int width = WM_window_pixels_x(win);
- int height = WM_window_pixels_y(win);
+ int width = WM_window_pixels_x(win);
+ int height = WM_window_pixels_y(win);
- glViewport(0, 0, width, height);
- glScissor(0, 0, width, height);
+ glViewport(0, 0, width, height);
+ glScissor(0, 0, width, height);
- wmOrtho2_pixelspace(width, height);
- GPU_matrix_identity_set();
+ wmOrtho2_pixelspace(width, height);
+ GPU_matrix_identity_set();
}
void wmOrtho2(float x1, float x2, float y1, float y2)
{
- /* prevent opengl from generating errors */
- if (x2 == x1) {
- x2 += 1.0f;
- }
- if (y2 == y1) {
- y2 += 1.0f;
- }
-
- GPU_matrix_ortho_set(x1, x2, y1, y2, -100, 100);
+ /* prevent opengl from generating errors */
+ if (x2 == x1) {
+ x2 += 1.0f;
+ }
+ if (y2 == y1) {
+ y2 += 1.0f;
+ }
+
+ GPU_matrix_ortho_set(x1, x2, y1, y2, -100, 100);
}
static void wmOrtho2_offset(const float x, const float y, const float ofs)
{
- wmOrtho2(ofs, x + ofs, ofs, y + ofs);
+ wmOrtho2(ofs, x + ofs, ofs, y + ofs);
}
/* Default pixel alignment for regions. */
void wmOrtho2_region_pixelspace(const ARegion *ar)
{
- wmOrtho2_offset(ar->winx, ar->winy, -0.01f);
+ wmOrtho2_offset(ar->winx, ar->winy, -0.01f);
}
void wmOrtho2_pixelspace(const float x, const float y)
{
- wmOrtho2_offset(x, y, -GLA_PIXEL_OFS);
+ wmOrtho2_offset(x, y, -GLA_PIXEL_OFS);
}
void wmGetProjectionMatrix(float mat[4][4], const rcti *winrct)
{
- int width = BLI_rcti_size_x(winrct) + 1;
- int height = BLI_rcti_size_y(winrct) + 1;
- orthographic_m4(mat, -GLA_PIXEL_OFS, (float)width - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, (float)height - GLA_PIXEL_OFS, -100, 100);
+ int width = BLI_rcti_size_x(winrct) + 1;
+ int height = BLI_rcti_size_y(winrct) + 1;
+ orthographic_m4(mat,
+ -GLA_PIXEL_OFS,
+ (float)width - GLA_PIXEL_OFS,
+ -GLA_PIXEL_OFS,
+ (float)height - GLA_PIXEL_OFS,
+ -100,
+ 100);
}