summaryrefslogtreecommitdiffstats
path: root/app/gfx/gl/gl_context_osmesa.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-10 20:38:51 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-10 20:38:51 +0000
commit24864e4e13f014b00340d37e9328b479b3c7e887 (patch)
tree86576e4ec0f364750b0318f7fb8e55c95a8a8f7c /app/gfx/gl/gl_context_osmesa.cc
parent3bcd52f1e8d8e8ddd086d71d9ef36a2016b62947 (diff)
downloadchromium_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/gl/gl_context_osmesa.cc')
-rw-r--r--app/gfx/gl/gl_context_osmesa.cc52
1 files changed, 26 insertions, 26 deletions
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