Bladeren bron

display: Move GraphicsPipe::_detected_display_zoom to class member

rdb 5 jaren geleden
bovenliggende
commit
e9c7d345df
3 gewijzigde bestanden met toevoegingen van 12 en 13 verwijderingen
  1. 8 0
      panda/src/display/graphicsPipe.I
  2. 2 12
      panda/src/display/graphicsPipe.cxx
  3. 2 1
      panda/src/display/graphicsPipe.h

+ 8 - 0
panda/src/display/graphicsPipe.I

@@ -81,3 +81,11 @@ INLINE GraphicsDevice *GraphicsPipe::
 get_device() const {
   return _device;
 }
+
+/**
+ * Called by derived class to set the display zoom factor.
+ */
+INLINE void GraphicsPipe::
+set_detected_display_zoom(PN_stdfloat zoom) {
+  _detected_display_zoom = zoom;
+}

+ 2 - 12
panda/src/display/graphicsPipe.cxx

@@ -97,9 +97,6 @@ static void update_memory_info(DisplayInformation *info) {
 }
 #endif
 
-// Temporarily declared as global float.
-static PN_stdfloat detected_display_zoom = 1.0;
-
 TypeHandle GraphicsPipe::_type_handle;
 
 /**
@@ -119,6 +116,7 @@ GraphicsPipe() :
 
   _display_width = 0;
   _display_height = 0;
+  _detected_display_zoom = 1.0;
 
   _display_information = new DisplayInformation();
 
@@ -287,15 +285,7 @@ get_display_zoom() const {
       return override;
     }
   }
-  return detected_display_zoom;
-}
-
-/**
- * Called by derived class to set the display zoom factor.
- */
-void GraphicsPipe::
-set_detected_display_zoom(PN_stdfloat zoom) {
-  detected_display_zoom = zoom;
+  return _detected_display_zoom;
 }
 
 /**

+ 2 - 1
panda/src/display/graphicsPipe.h

@@ -117,7 +117,7 @@ public:
   virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
 
 protected:
-  void set_detected_display_zoom(PN_stdfloat zoom);
+  INLINE void set_detected_display_zoom(PN_stdfloat zoom);
 
   virtual void close_gsg(GraphicsStateGuardian *gsg);
 
@@ -137,6 +137,7 @@ protected:
   int _supported_types;
   int _display_width;
   int _display_height;
+  PN_stdfloat _detected_display_zoom;
   PT(GraphicsDevice) _device;
 
   DisplayInformation *_display_information;