diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-10 20:38:51 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-10 20:38:51 +0000 |
commit | 24864e4e13f014b00340d37e9328b479b3c7e887 (patch) | |
tree | 86576e4ec0f364750b0318f7fb8e55c95a8a8f7c /app/gfx | |
parent | 3bcd52f1e8d8e8ddd086d71d9ef36a2016b62947 (diff) | |
download | chromium_src-24864e4e13f014b00340d37e9328b479b3c7e887.zip chromium_src-24864e4e13f014b00340d37e9328b479b3c7e887.tar.gz chromium_src-24864e4e13f014b00340d37e9328b479b3c7e887.tar.bz2 |
Start reordering the methods in headers in app/.
(Trying to carfully not touch whatever Ben is currently refactoring.)
BUG=68682
TEST=compiles
Review URL: http://codereview.chromium.org/6162002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx')
-rw-r--r-- | app/gfx/gl/gl_context_egl.h | 10 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_osmesa.cc | 52 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_osmesa.h | 16 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_stub.h | 4 |
4 files changed, 41 insertions, 41 deletions
diff --git a/app/gfx/gl/gl_context_egl.h b/app/gfx/gl/gl_context_egl.h index 9cbdba1..1647239 100644 --- a/app/gfx/gl/gl_context_egl.h +++ b/app/gfx/gl/gl_context_egl.h @@ -22,15 +22,15 @@ class BaseEGLContext : public GLContext { BaseEGLContext() {} virtual ~BaseEGLContext() {} - // Implement GLContext. - virtual std::string GetExtensions(); + static bool InitializeOneOff(); + + static EGLDisplay GetDisplay(); // Get the associated EGL surface. virtual EGLSurface GetSurface() = 0; - static bool InitializeOneOff(); - - static EGLDisplay GetDisplay(); + // Implement GLContext. + virtual std::string GetExtensions(); private: DISALLOW_COPY_AND_ASSIGN(BaseEGLContext); diff --git a/app/gfx/gl/gl_context_osmesa.cc b/app/gfx/gl/gl_context_osmesa.cc index d9cbe4f..f92da9e 100644 --- a/app/gfx/gl/gl_context_osmesa.cc +++ b/app/gfx/gl/gl_context_osmesa.cc @@ -57,6 +57,32 @@ bool OSMesaGLContext::Initialize(GLuint format, GLContext* shared_context) { return true; } +void OSMesaGLContext::Resize(const gfx::Size& new_size) { + if (new_size == size_) + return; + + // Allocate a new back buffer. + scoped_array<int32> new_buffer(new int32[new_size.GetArea()]); + memset(new_buffer.get(), 0, new_size.GetArea() * sizeof(new_buffer[0])); + + // Copy the current back buffer into the new buffer. + int copy_width = std::min(size_.width(), new_size.width()); + int copy_height = std::min(size_.height(), new_size.height()); + for (int y = 0; y < copy_height; ++y) { + for (int x = 0; x < copy_width; ++x) { + new_buffer[y * new_size.width() + x] = buffer_[y * size_.width() + x]; + } + } + + buffer_.reset(new_buffer.release()); + size_ = new_size; + + // If this context is current, need to call MakeCurrent again so OSMesa uses + // the new buffer. + if (IsCurrent()) + MakeCurrent(); +} + void OSMesaGLContext::Destroy() { if (context_) { OSMesaDestroyContext(static_cast<OSMesaContext>(context_)); @@ -102,30 +128,4 @@ void OSMesaGLContext::SetSwapInterval(int interval) { NOTREACHED() << "Attempt to call SetSwapInterval on an OSMesaGLContext."; } -void OSMesaGLContext::Resize(const gfx::Size& new_size) { - if (new_size == size_) - return; - - // Allocate a new back buffer. - scoped_array<int32> new_buffer(new int32[new_size.GetArea()]); - memset(new_buffer.get(), 0, new_size.GetArea() * sizeof(new_buffer[0])); - - // Copy the current back buffer into the new buffer. - int copy_width = std::min(size_.width(), new_size.width()); - int copy_height = std::min(size_.height(), new_size.height()); - for (int y = 0; y < copy_height; ++y) { - for (int x = 0; x < copy_width; ++x) { - new_buffer[y * new_size.width() + x] = buffer_[y * size_.width() + x]; - } - } - - buffer_.reset(new_buffer.release()); - size_ = new_size; - - // If this context is current, need to call MakeCurrent again so OSMesa uses - // the new buffer. - if (IsCurrent()) - MakeCurrent(); -} - } // namespace gfx diff --git a/app/gfx/gl/gl_context_osmesa.h b/app/gfx/gl/gl_context_osmesa.h index 31a2ff7..649b8c2 100644 --- a/app/gfx/gl/gl_context_osmesa.h +++ b/app/gfx/gl/gl_context_osmesa.h @@ -23,6 +23,14 @@ class OSMesaGLContext : public GLContext { // Initialize an OSMesa GL context with the default 1 x 1 initial size. bool Initialize(GLuint format, GLContext* shared_context); + // Resize the back buffer, preserving the old content. Does nothing if the + // size is unchanged. + void Resize(const gfx::Size& new_size); + + const void* buffer() const { + return buffer_.get(); + } + // Implement GLContext. virtual void Destroy(); virtual bool MakeCurrent(); @@ -33,14 +41,6 @@ class OSMesaGLContext : public GLContext { virtual void* GetHandle(); virtual void SetSwapInterval(int interval); - // Resize the back buffer, preserving the old content. Does nothing if the - // size is unchanged. - void Resize(const gfx::Size& new_size); - - const void* buffer() const { - return buffer_.get(); - } - private: gfx::Size size_; scoped_array<int32> buffer_; diff --git a/app/gfx/gl/gl_context_stub.h b/app/gfx/gl/gl_context_stub.h index d4a1e18..907d8459 100644 --- a/app/gfx/gl/gl_context_stub.h +++ b/app/gfx/gl/gl_context_stub.h @@ -17,6 +17,8 @@ class StubGLContext : public gfx::GLContext { public: virtual ~StubGLContext(); + void SetSize(const gfx::Size& size) { size_ = size; } + // Implement GLContext. virtual void Destroy() {} virtual bool MakeCurrent(); @@ -28,8 +30,6 @@ class StubGLContext : public gfx::GLContext { virtual void SetSwapInterval(int interval) {} virtual std::string GetExtensions(); - void SetSize(const gfx::Size& size) { size_ = size; } - private: gfx::Size size_; }; |