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
1=== modified file 'NuxGraphics/IOpenGLAnimatedTexture.cpp'
2--- NuxGraphics/IOpenGLAnimatedTexture.cpp 2011-10-22 06:17:42 +0000
3+++ NuxGraphics/IOpenGLAnimatedTexture.cpp 2012-06-12 05:40:25 +0000
4@@ -93,13 +93,13 @@
5 SURFACE_LOCKED_RECT *pLockedRect,
6 const SURFACE_RECT *pRect)
7 {
8- return _FrameTextureArray[Frame]->LockRect(0, pLockedRect, pRect);
9+ return _FrameTextureArray[Frame]->LockRect(0, 0, pLockedRect, pRect);
10 }
11
12 int IOpenGLAnimatedTexture::UnlockRect(
13 int Frame)
14 {
15- return _FrameTextureArray[Frame]->UnlockRect(0);
16+ return _FrameTextureArray[Frame]->UnlockRect(0, 0);
17 }
18
19 void IOpenGLAnimatedTexture::PresentFirstFrame()
20
21=== modified file 'NuxGraphics/IOpenGLBaseTexture.cpp'
22--- NuxGraphics/IOpenGLBaseTexture.cpp 2012-01-17 03:57:31 +0000
23+++ NuxGraphics/IOpenGLBaseTexture.cpp 2012-06-12 05:40:25 +0000
24@@ -244,12 +244,12 @@
25 return ObjectPtr<IOpenGLSurface> (0);
26 }
27
28- int IOpenGLBaseTexture::LockRect(int Level, SURFACE_LOCKED_RECT *pLockedRect, const SURFACE_RECT *pRect)
29+ int IOpenGLBaseTexture::LockRect(int Slice, int Level, SURFACE_LOCKED_RECT *pLockedRect, const SURFACE_RECT *pRect)
30 {
31 return 0;
32 }
33
34- int IOpenGLBaseTexture::UnlockRect(int Level)
35+ int IOpenGLBaseTexture::UnlockRect(int Slice, int Level)
36 {
37 return 0;
38 }
39
40=== modified file 'NuxGraphics/IOpenGLBaseTexture.h'
41--- NuxGraphics/IOpenGLBaseTexture.h 2012-01-17 03:57:31 +0000
42+++ NuxGraphics/IOpenGLBaseTexture.h 2012-06-12 05:40:25 +0000
43@@ -132,11 +132,12 @@
44 virtual void GetSurfaceLevel(int Level, ObjectPtr<IOpenGLSurface>& surface);
45 virtual ObjectPtr<IOpenGLSurface> GetSurfaceLevel(int Level);
46 virtual int LockRect(
47+ int Slice,
48 int Level,
49 SURFACE_LOCKED_RECT *pLockedRect,
50 const SURFACE_RECT *pRect);
51
52- virtual int UnlockRect(int Level);
53+ virtual int UnlockRect(int Slice, int Level);
54
55 //! Return a pointer to a mipmap level data.
56 /*!

Subscribers

People subscribed via source and target branches