[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin/fredrik/vulkan] /: Add a CullMode property in ScreenPaintData
From:       Fredrik_Höglund <null () kde ! org>
Date:       2018-02-16 17:01:50
Message-ID: E1emjOQ-0004Yx-9X () code ! kde ! org
[Download RAW message or body]

Git commit 5f9f8de42f3b53d8965b5fd1253435c2ca5306a6 by Fredrik Höglund.
Committed on 16/02/2018 at 16:58.
Pushed by fredrik into branch 'fredrik/vulkan'.

Add a CullMode property in ScreenPaintData

This commit also adds a PAINT_SCREEN_WITH_FACE_CULLING flag, which
must be set for the scene to use the property.

M  +13   -0    libkwineffects/kwineffects.cpp
M  +31   -1    libkwineffects/kwineffects.h
M  +2    -1    scene.h

https://commits.kde.org/kwin/5f9f8de42f3b53d8965b5fd1253435c2ca5306a6

diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp
index 47aeb2437..643ef5a82 100644
--- a/libkwineffects/kwineffects.cpp
+++ b/libkwineffects/kwineffects.cpp
@@ -436,6 +436,7 @@ class ScreenPaintData::Private
 public:
     QMatrix4x4 projectionMatrix;
     QRect outputGeometry;
+    CullModeFlags cullMode = CullModeFlag::None;
 };
 
 ScreenPaintData::ScreenPaintData()
@@ -467,6 +468,7 @@ ScreenPaintData::ScreenPaintData(const ScreenPaintData &other)
     setRotationAngle(other.rotationAngle());
     d->projectionMatrix = other.d->projectionMatrix;
     d->outputGeometry = other.d->outputGeometry;
+    d->cullMode = other.d->cullMode;
 }
 
 ScreenPaintData &ScreenPaintData::operator=(const ScreenPaintData &rhs)
@@ -482,6 +484,7 @@ ScreenPaintData &ScreenPaintData::operator=(const ScreenPaintData &rhs)
     setRotationAngle(rhs.rotationAngle());
     d->projectionMatrix = rhs.d->projectionMatrix;
     d->outputGeometry = rhs.d->outputGeometry;
+    d->cullMode = rhs.d->cullMode;
     return *this;
 }
 
@@ -539,6 +542,16 @@ QRect ScreenPaintData::outputGeometry() const
     return d->outputGeometry;
 }
 
+void ScreenPaintData::setCullMode(CullModeFlags cullMode)
+{
+    d->cullMode = cullMode;
+}
+
+CullModeFlags ScreenPaintData::cullMode() const
+{
+    return d->cullMode;
+}
+
 //****************************************
 // Effect
 //****************************************
diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h
index c197fa903..4ec850820 100644
--- a/libkwineffects/kwineffects.h
+++ b/libkwineffects/kwineffects.h
@@ -352,8 +352,12 @@ public:
         /**
          * Window will be painted with a lanczos filter.
          **/
-        PAINT_WINDOW_LANCZOS = 1 << 8
+        PAINT_WINDOW_LANCZOS = 1 << 8,
         // PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed
+        /**
+         * Use the cull mode in ScreenPaintData when painting the screen.
+         */
+        PAINT_SCREEN_WITH_FACE_CULLING = 1 << 10
     };
 
     enum Feature {
@@ -2727,6 +2731,15 @@ private:
     WindowPaintDataPrivate * const d;
 };
 
+enum class CullModeFlag {
+    None         = 0,
+    Front        = 0x00000001,
+    Back         = 0x00000002,
+    FrontAndBack = 0x00000003,
+};
+
+Q_DECLARE_FLAGS(CullModeFlags, CullModeFlag)
+
 class KWINEFFECTS_EXPORT ScreenPaintData : public PaintData
 {
 public:
@@ -2793,6 +2806,23 @@ public:
      * @since 5.9
      **/
     QRect outputGeometry() const;
+
+    /**
+     * Sets the cull mode that will be used when painting the screen.
+     *
+     * The default setting is CullModeFlag::None.
+     *
+     * @since 5.12
+     */
+    void setCullMode(CullModeFlags cullMode);
+
+    /**
+     * Returns the cull mode that will be used when painting the screen.
+     *
+     * @since 5.12
+     */
+    CullModeFlags cullMode() const;
+
 private:
     class Private;
     QScopedPointer<Private> d;
diff --git a/scene.h b/scene.h
index a4eb3ba34..f74334bd6 100644
--- a/scene.h
+++ b/scene.h
@@ -124,8 +124,9 @@ public:
         PAINT_SCREEN_BACKGROUND_FIRST = 1 << 6,
         // PAINT_DECORATION_ONLY = 1 << 7 has been removed
         // Window will be painted with a lanczos filter.
-        PAINT_WINDOW_LANCZOS = 1 << 8
+        PAINT_WINDOW_LANCZOS = 1 << 8,
         // PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed
+        PAINT_SCREEN_WITH_FACE_CULLING = 1 << 10
     };
     // types of filtering available
     enum ImageFilterType { ImageFilterFast, ImageFilterGood };

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic