Nux

Merge lp:~thomir-deactivatedaccount/nux/lockrect-overloaded-method-hiding into lp:nux

Proposed by Thomi Richards
Status: Needs review
Proposed branch: lp:~thomir-deactivatedaccount/nux/lockrect-overloaded-method-hiding
Merge into: lp:nux
Diff against target: 56 lines (+6/-5)
3 files modified
NuxGraphics/IOpenGLAnimatedTexture.cpp (+2/-2)
NuxGraphics/IOpenGLBaseTexture.cpp (+2/-2)
NuxGraphics/IOpenGLBaseTexture.h (+2/-1)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/nux/lockrect-overloaded-method-hiding
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Francis Ginther Abstain
Jay Taoko (community) Needs Fixing
Review via email: mp+109773@code.launchpad.net

Commit message

Fixed a spot where a derived method was hiding a virtual method in the base class because the method signatures were different.

Description of the change

Problem:

IOpenGLVolumeTexture defined lockRect as:

int IOpenGLVolumeTexture::LockRect(
    int Slice,
    int Level,
    SURFACE_LOCKED_RECT *pLockedRect,
    const SURFACE_RECT *pRect)

but it's base class defined it as:

virtual int LockRect(
      int Level,
      SURFACE_LOCKED_RECT *pLockedRect,
      const SURFACE_RECT *pRect);

i.e.- missing the Slice parameter. This means that the derived method was hiding the virtual method form the case class.

Solution:

I've added the Slice parameter to the base class. I also had to update one place in the code where this was being called. The 'Level' parameter was being passed in as 0, so I passed the 'Slice' parameter in as 0 as well. I have no idea if this is the right thing to do or not, so someone who knows what this code does should look into this.

Tests:

There are no tests. This code may break something.

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote :

Is this a warning that we get in Unity right now? I couldn't see it. How can I reproduce?

* I think we need to had a comment to say that "the value of slice must be zero" that for IOpenGLBaseTexture::LockRect.
* IOpenGLTexture2D::LockRect and IOpenGLRectangleTexture::LockRect have to be changed accordingly

review: Needs Fixing
Revision history for this message
Francis Ginther (fginther) wrote :

Review was claimed by accident, please ignore.

review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

623. By Thomi Richards

Updated code that calls it. apparently we can just pass 0's around.

622. By Thomi Richards

Fix a place where virtual methods had different signatures in different classes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NuxGraphics/IOpenGLAnimatedTexture.cpp'
--- NuxGraphics/IOpenGLAnimatedTexture.cpp 2011-10-22 06:17:42 +0000
+++ NuxGraphics/IOpenGLAnimatedTexture.cpp 2012-06-12 05:40:25 +0000
@@ -93,13 +93,13 @@
93 SURFACE_LOCKED_RECT *pLockedRect,93 SURFACE_LOCKED_RECT *pLockedRect,
94 const SURFACE_RECT *pRect)94 const SURFACE_RECT *pRect)
95 {95 {
96 return _FrameTextureArray[Frame]->LockRect(0, pLockedRect, pRect);96 return _FrameTextureArray[Frame]->LockRect(0, 0, pLockedRect, pRect);
97 }97 }
9898
99 int IOpenGLAnimatedTexture::UnlockRect(99 int IOpenGLAnimatedTexture::UnlockRect(
100 int Frame)100 int Frame)
101 {101 {
102 return _FrameTextureArray[Frame]->UnlockRect(0);102 return _FrameTextureArray[Frame]->UnlockRect(0, 0);
103 }103 }
104104
105 void IOpenGLAnimatedTexture::PresentFirstFrame()105 void IOpenGLAnimatedTexture::PresentFirstFrame()
106106
=== modified file 'NuxGraphics/IOpenGLBaseTexture.cpp'
--- NuxGraphics/IOpenGLBaseTexture.cpp 2012-01-17 03:57:31 +0000
+++ NuxGraphics/IOpenGLBaseTexture.cpp 2012-06-12 05:40:25 +0000
@@ -244,12 +244,12 @@
244 return ObjectPtr<IOpenGLSurface> (0);244 return ObjectPtr<IOpenGLSurface> (0);
245 }245 }
246246
247 int IOpenGLBaseTexture::LockRect(int Level, SURFACE_LOCKED_RECT *pLockedRect, const SURFACE_RECT *pRect)247 int IOpenGLBaseTexture::LockRect(int Slice, int Level, SURFACE_LOCKED_RECT *pLockedRect, const SURFACE_RECT *pRect)
248 {248 {
249 return 0;249 return 0;
250 }250 }
251251
252 int IOpenGLBaseTexture::UnlockRect(int Level)252 int IOpenGLBaseTexture::UnlockRect(int Slice, int Level)
253 {253 {
254 return 0;254 return 0;
255 }255 }
256256
=== modified file 'NuxGraphics/IOpenGLBaseTexture.h'
--- NuxGraphics/IOpenGLBaseTexture.h 2012-01-17 03:57:31 +0000
+++ NuxGraphics/IOpenGLBaseTexture.h 2012-06-12 05:40:25 +0000
@@ -132,11 +132,12 @@
132 virtual void GetSurfaceLevel(int Level, ObjectPtr<IOpenGLSurface>& surface);132 virtual void GetSurfaceLevel(int Level, ObjectPtr<IOpenGLSurface>& surface);
133 virtual ObjectPtr<IOpenGLSurface> GetSurfaceLevel(int Level);133 virtual ObjectPtr<IOpenGLSurface> GetSurfaceLevel(int Level);
134 virtual int LockRect(134 virtual int LockRect(
135 int Slice,
135 int Level,136 int Level,
136 SURFACE_LOCKED_RECT *pLockedRect,137 SURFACE_LOCKED_RECT *pLockedRect,
137 const SURFACE_RECT *pRect);138 const SURFACE_RECT *pRect);
138139
139 virtual int UnlockRect(int Level);140 virtual int UnlockRect(int Slice, int Level);
140141
141 //! Return a pointer to a mipmap level data.142 //! Return a pointer to a mipmap level data.
142 /*!143 /*!

Subscribers

People subscribed via source and target branches