Skip to content

Commit

Permalink
Backout 2348924d6410 (bug 612407) for build bustage.
Browse files Browse the repository at this point in the history
  • Loading branch information
mounirlamouri committed May 6, 2011
1 parent e6e16b4 commit 6906061
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 159 deletions.
131 changes: 0 additions & 131 deletions gfx/layers/opengl/LayerManagerOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "ImageLayerOGL.h"
#include "ColorLayerOGL.h"
#include "CanvasLayerOGL.h"
#include "mozilla/TimeStamp.h"

#include "LayerManagerOGLShaders.h"

Expand Down Expand Up @@ -81,7 +80,6 @@ LayerManagerOGL::LayerManagerOGL(nsIWidget *aWidget)
, mBackBufferTexture(0)
, mBackBufferSize(-1, -1)
, mHasBGRA(0)
, mRenderFPS(false)
{
}

Expand Down Expand Up @@ -540,131 +538,6 @@ LayerManagerOGL::RootLayer() const
return static_cast<LayerOGL*>(mRoot->ImplData());
}

void
LayerManagerOGL::FPSState::DrawFPS(GLContext* context, CopyProgram* copyprog)
{
fcount++;

int rate = 30;
if (fcount >= rate) {
TimeStamp now = TimeStamp::Now();
TimeDuration duration = now - last;
last = now;
fps = rate / duration.ToSeconds() + .5;
fcount = 0;
}

GLint viewport[4];
context->fGetIntegerv(LOCAL_GL_VIEWPORT, viewport);

static GLuint texture;
if (!initialized) {
// Bind the number of textures we need, in this case one.
context->fGenTextures(1, &texture);
context->fBindTexture(LOCAL_GL_TEXTURE_2D, texture);
context->fTexParameteri(LOCAL_GL_TEXTURE_2D,LOCAL_GL_TEXTURE_MIN_FILTER,LOCAL_GL_NEAREST);
context->fTexParameteri(LOCAL_GL_TEXTURE_2D,LOCAL_GL_TEXTURE_MAG_FILTER,LOCAL_GL_NEAREST);

char text[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 255, 255, 255, 0, 255, 255, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 0, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,
0, 255, 0, 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 0, 255, 0, 255, 0, 255, 0, 255, 0, 0, 0, 255, 0, 0, 0, 0, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
0, 255, 0, 255, 0, 0, 255, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,
0, 255, 0, 255, 0, 0, 255, 0, 0, 255, 0, 0, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 255, 0, 255, 0, 0, 0, 255, 0, 255, 0, 255, 0, 0, 0, 255, 0,
0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 255, 0, 255, 255, 255, 0, 0, 0, 255, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};

unsigned long* buf = (unsigned long*)malloc(64 * 8 * 4);
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 41; j++) {
buf[i * 64 + j] = (text[i * 41 + j] == 0) ? 0xfff000ff : 0xffffffff;
}
}
context->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGBA, 64, 8, 0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, buf);
initialized = true;
}

struct Vertex2D {
float x,y;
};
const Vertex2D vertices[] = {
{ -1.0, 1.0 - 42. / viewport[3] },
{ -1.0, 1.0},
{ -1.0 + 22. / viewport[2], 1.0 - 42. / viewport[3] },
{ -1.0 + 22. / viewport[2], 1.0 },

{ -1.0 + 22. / viewport[2], 1.0 - 42. / viewport[3] },
{ -1.0 + 22. / viewport[2], 1.0 },
{ -1.0 + 44. / viewport[2], 1.0 - 42. / viewport[3] },
{ -1.0 + 44. / viewport[2], 1.0 },

{ -1.0 + 44. / viewport[2], 1.0 - 42. / viewport[3] },
{ -1.0 + 44. / viewport[2], 1.0 },
{ -1.0 + 66. / viewport[2], 1.0 - 42. / viewport[3] },
{ -1.0 + 66. / viewport[2], 1.0 }
};

int v1 = fps % 10;
int v10 = (fps % 100) / 10;
int v100 = (fps % 1000) / 100;

// Feel free to comment these texture coordinates out and use one
// of the ones below instead, or play around with your own values.
const GLfloat texCoords[] = {
(v100 * 4.) / 64, 7. / 8,
(v100 * 4.) / 64, 0.0,
(v100 * 4. + 4) / 64, 7. / 8,
(v100 * 4. + 4) / 64, 0.0,

(v10 * 4.) / 64, 7. / 8,
(v10 * 4.) / 64, 0.0,
(v10 * 4. + 4) / 64, 7. / 8,
(v10 * 4. + 4) / 64, 0.0,

(v1 * 4.) / 64, 7. / 8,
(v1 * 4.) / 64, 0.0,
(v1 * 4. + 4) / 64, 7. / 8,
(v1 * 4. + 4) / 64, 0.0,
};

// Turn necessary features on
context->fEnable(LOCAL_GL_BLEND);
context->fBlendFunc(LOCAL_GL_ONE, LOCAL_GL_SRC_COLOR);

context->fBindTexture(LOCAL_GL_TEXTURE_2D, texture);

copyprog->Activate();
copyprog->SetTextureUnit(0);

// we're going to use client-side vertex arrays for this.
context->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);

// "COPY"
context->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ZERO,
LOCAL_GL_ONE, LOCAL_GL_ZERO);

// enable our vertex attribs; we'll call glVertexPointer below
// to fill with the correct data.
GLint vcattr = copyprog->AttribLocation(CopyProgram::VertexCoordAttrib);
GLint tcattr = copyprog->AttribLocation(CopyProgram::TexCoordAttrib);

context->fEnableVertexAttribArray(vcattr);
context->fEnableVertexAttribArray(tcattr);

context->fVertexAttribPointer(vcattr,
2, LOCAL_GL_FLOAT,
LOCAL_GL_FALSE,
0, vertices);

context->fVertexAttribPointer(tcattr,
2, LOCAL_GL_FLOAT,
LOCAL_GL_FALSE,
0, texCoords);

context->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 12);
}

void
LayerManagerOGL::Render()
{
Expand Down Expand Up @@ -732,10 +605,6 @@ LayerManagerOGL::Render()
return;
}

if (mRenderFPS) {
mFPS.DrawFPS(mGLContext, GetCopy2DProgram());
}

if (mGLContext->IsDoubleBuffered()) {
mGLContext->SwapBuffers();
return;
Expand Down
23 changes: 0 additions & 23 deletions gfx/layers/opengl/LayerManagerOGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@

#include "mozilla/layers/ShadowLayers.h"

#include "mozilla/TimeStamp.h"

#ifdef XP_WIN
#include <windows.h>
#endif
Expand Down Expand Up @@ -388,8 +386,6 @@ class THEBES_API LayerManagerOGL :
gfxMatrix& GetWorldTransform(void);
void WorldTransformRect(nsIntRect& aRect);

void SetRenderFPS(bool aRenderFPS) { mRenderFPS = aRenderFPS; };

private:
/** Widget associated with this layer manager */
nsIWidget *mWidget;
Expand Down Expand Up @@ -468,25 +464,6 @@ class THEBES_API LayerManagerOGL :
DrawThebesLayerCallback mThebesLayerCallback;
void *mThebesLayerCallbackData;
gfxMatrix mWorldMatrix;

struct FPSState
{
GLuint texture;
int fps;
bool initialized;
int fcount;
TimeStamp last;

FPSState()
: texture(0)
, fps(0)
, initialized(false)
, fcount(0)
{}
void DrawFPS(GLContext*, CopyProgram*);
} mFPS;

bool mRenderFPS;
};

/**
Expand Down
4 changes: 0 additions & 4 deletions widget/src/xpwidgets/nsBaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ nsBaseWidget::nsBaseWidget()
, mZIndex(0)
, mSizeMode(nsSizeMode_Normal)
, mPopupLevel(ePopupLevelTop)
, mDrawFPS(PR_FALSE)
{
#ifdef NOISY_WIDGET_LEAKS
gNumWidgets++;
Expand Down Expand Up @@ -824,8 +823,6 @@ nsBaseWidget::GetShouldAccelerate()
prefs->GetBoolPref("layers.acceleration.force-enabled",
&forceAcceleration);

prefs->GetBoolPref("layers.acceleration.draw-fps",
&mDrawFPS);
}

const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
Expand Down Expand Up @@ -879,7 +876,6 @@ LayerManager* nsBaseWidget::GetLayerManager(LayerManagerPersistence,
* deal with it though!
*/
if (layerManager->Initialize()) {
layerManager->SetRenderFPS(mDrawFPS);
mLayerManager = layerManager;
}
}
Expand Down
1 change: 0 additions & 1 deletion widget/src/xpwidgets/nsBaseWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ class nsBaseWidget : public nsIWidget
PRInt32 mZIndex;
nsSizeMode mSizeMode;
nsPopupLevel mPopupLevel;
PRBool mDrawFPS;

// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
// so it can be cleared automatically.
Expand Down

0 comments on commit 6906061

Please sign in to comment.