OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/gl/gl_surface_osmesa.h" | 5 #include "ui/gfx/gl/gl_surface_osmesa.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "ui/gfx/gl/gl_bindings.h" | 7 #include "ui/gfx/gl/gl_bindings.h" |
8 | 8 |
9 namespace gfx { | 9 namespace gfx { |
10 | 10 |
11 GLSurfaceOSMesa::GLSurfaceOSMesa(const gfx::Size& size) : size_(size) { | 11 GLSurfaceOSMesa::GLSurfaceOSMesa(unsigned format, const gfx::Size& size) |
| 12 : format_(format), |
| 13 size_(size) { |
12 } | 14 } |
13 | 15 |
14 GLSurfaceOSMesa::~GLSurfaceOSMesa() { | 16 GLSurfaceOSMesa::~GLSurfaceOSMesa() { |
15 Destroy(); | 17 Destroy(); |
16 } | 18 } |
17 | 19 |
18 void GLSurfaceOSMesa::Resize(const gfx::Size& new_size) { | 20 void GLSurfaceOSMesa::Resize(const gfx::Size& new_size) { |
19 if (new_size == size_) | 21 if (new_size == size_) |
20 return; | 22 return; |
21 | 23 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 58 } |
57 | 59 |
58 gfx::Size GLSurfaceOSMesa::GetSize() { | 60 gfx::Size GLSurfaceOSMesa::GetSize() { |
59 return size_; | 61 return size_; |
60 } | 62 } |
61 | 63 |
62 void* GLSurfaceOSMesa::GetHandle() { | 64 void* GLSurfaceOSMesa::GetHandle() { |
63 return buffer_.get(); | 65 return buffer_.get(); |
64 } | 66 } |
65 | 67 |
| 68 unsigned GLSurfaceOSMesa::GetFormat() { |
| 69 return format_; |
| 70 } |
| 71 |
66 void GLSurfaceOSMesa::AllocateBuffer(const Size& size) { | 72 void GLSurfaceOSMesa::AllocateBuffer(const Size& size) { |
67 buffer_.reset(new int32[size.GetArea()]); | 73 buffer_.reset(new int32[size.GetArea()]); |
68 memset(buffer_.get(), 0, size.GetArea() * sizeof(buffer_[0])); | 74 memset(buffer_.get(), 0, size.GetArea() * sizeof(buffer_[0])); |
69 } | 75 } |
70 | 76 |
71 } // namespace gfx | 77 } // namespace gfx |
OLD | NEW |