зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1044658 - 6/6 - expand TestWeakPtr - r=froydnj
This commit is contained in:
Родитель
c50ccf8dba
Коммит
db8df3f0db
|
@ -11,20 +11,6 @@
|
|||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLFramebufferAttachable::AttachmentPoint*
|
||||
WebGLFramebufferAttachable::Contains(const WebGLFramebuffer* fb, GLenum attachment)
|
||||
{
|
||||
AttachmentPoint* first = mAttachmentPoints.begin();
|
||||
AttachmentPoint* last = mAttachmentPoints.end();
|
||||
|
||||
for (; first != last; ++first) {
|
||||
if (first->mFB == fb && first->mAttachment == attachment)
|
||||
return first;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
WebGLFramebufferAttachable::AttachTo(WebGLFramebuffer* fb, GLenum attachment)
|
||||
{
|
||||
|
@ -32,10 +18,10 @@ WebGLFramebufferAttachable::AttachTo(WebGLFramebuffer* fb, GLenum attachment)
|
|||
if (!fb)
|
||||
return;
|
||||
|
||||
if (Contains(fb, attachment))
|
||||
if (mAttachmentPoints.Contains(AttachmentPoint(fb, attachment)))
|
||||
return; // Already attached. Ignore.
|
||||
|
||||
mAttachmentPoints.append(AttachmentPoint(fb, attachment));
|
||||
mAttachmentPoints.AppendElement(AttachmentPoint(fb, attachment));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -45,20 +31,18 @@ WebGLFramebufferAttachable::DetachFrom(WebGLFramebuffer* fb, GLenum attachment)
|
|||
if (!fb)
|
||||
return;
|
||||
|
||||
AttachmentPoint* point = Contains(fb, attachment);
|
||||
if (!point) {
|
||||
const size_t i = mAttachmentPoints.IndexOf(AttachmentPoint(fb, attachment));
|
||||
if (i == mAttachmentPoints.NoIndex) {
|
||||
MOZ_ASSERT(false, "Is not attached to FB");
|
||||
return;
|
||||
}
|
||||
|
||||
mAttachmentPoints.erase(point);
|
||||
mAttachmentPoints.RemoveElementAt(i);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLFramebufferAttachable::NotifyFBsStatusChanged()
|
||||
{
|
||||
AttachmentPoint* first = mAttachmentPoints.begin();
|
||||
AttachmentPoint* last = mAttachmentPoints.end();
|
||||
for ( ; first != last; ++first)
|
||||
first->mFB->NotifyAttachableChanged();
|
||||
for (size_t i = 0; i < mAttachmentPoints.Length(); ++i)
|
||||
mAttachmentPoints[i].mFB->NotifyAttachableChanged();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define WEBGLFRAMEBUFFERATTACHABLE_H_
|
||||
|
||||
#include "GLDefs.h"
|
||||
#include "mozilla/Vector.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -24,11 +24,13 @@ class WebGLFramebufferAttachable
|
|||
|
||||
const WebGLFramebuffer* mFB;
|
||||
GLenum mAttachment;
|
||||
|
||||
bool operator==(const AttachmentPoint& o) const {
|
||||
return mFB == o.mFB && mAttachment == o.mAttachment;
|
||||
}
|
||||
};
|
||||
|
||||
Vector<AttachmentPoint> mAttachmentPoints;
|
||||
|
||||
AttachmentPoint* Contains(const WebGLFramebuffer* fb, GLenum attachment);
|
||||
nsTArray<AttachmentPoint> mAttachmentPoints;
|
||||
|
||||
public:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче