mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 656215 - check max size for textures and renderbuffers - r=joedrew
This is needed to correctly handle exceedingly large canvases, for example.
This commit is contained in:
parent
b5dc4a0330
commit
7e05c500e7
@ -383,6 +383,7 @@ GLContext::InitWithPrefix(const char *prefix, PRBool trygl)
|
||||
mViewportStack.AppendElement(nsIntRect(v[0], v[1], v[2], v[3]));
|
||||
|
||||
fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
|
||||
fGetIntegerv(LOCAL_GL_MAX_RENDERBUFFER_SIZE, &mMaxRenderbufferSize);
|
||||
|
||||
UpdateActualFormat();
|
||||
}
|
||||
@ -702,6 +703,9 @@ BasicTextureImage::Resize(const nsIntSize& aSize)
|
||||
PRBool
|
||||
GLContext::ResizeOffscreenFBO(const gfxIntSize& aSize)
|
||||
{
|
||||
if (!IsOffscreenSizeAllowed(aSize))
|
||||
return PR_FALSE;
|
||||
|
||||
MakeCurrent();
|
||||
|
||||
bool alpha = mCreationFormat.alpha > 0;
|
||||
|
@ -994,11 +994,18 @@ protected:
|
||||
return teximage.forget();
|
||||
}
|
||||
|
||||
bool IsOffscreenSizeAllowed(const gfxIntSize& aSize) const {
|
||||
PRInt32 biggerDimension = NS_MAX(aSize.width, aSize.height);
|
||||
PRInt32 maxAllowed = NS_MIN(mMaxRenderbufferSize, mMaxTextureSize);
|
||||
return biggerDimension <= maxAllowed;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsTArray<nsIntRect> mViewportStack;
|
||||
nsTArray<nsIntRect> mScissorStack;
|
||||
|
||||
GLint mMaxTextureSize;
|
||||
GLint mMaxRenderbufferSize;
|
||||
|
||||
public:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user