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/compositor/compositor_gl.h" | 5 #include "ui/gfx/compositor/compositor_gl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 size_ = overall_size; | 309 size_ = overall_size; |
310 | 310 |
311 glGenTextures(1, &texture_id_); | 311 glGenTextures(1, &texture_id_); |
312 glBindTexture(GL_TEXTURE_2D, texture_id_); | 312 glBindTexture(GL_TEXTURE_2D, texture_id_); |
313 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, | 313 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, |
314 size_.width(), size_.height(), 0, | 314 size_.width(), size_.height(), 0, |
315 GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 315 GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
316 | 316 |
317 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 317 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
318 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 318 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 319 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 320 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
319 } else if (size_ != overall_size) { // Size has changed. | 321 } else if (size_ != overall_size) { // Size has changed. |
320 size_ = overall_size; | 322 size_ = overall_size; |
321 glBindTexture(GL_TEXTURE_2D, texture_id_); | 323 glBindTexture(GL_TEXTURE_2D, texture_id_); |
322 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, | 324 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, |
323 size_.width(), size_.height(), 0, | 325 size_.width(), size_.height(), 0, |
324 GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 326 GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
325 } else { // Uploading partial texture. | 327 } else { // Uploading partial texture. |
326 glBindTexture(GL_TEXTURE_2D, texture_id_); | 328 glBindTexture(GL_TEXTURE_2D, texture_id_); |
327 glTexSubImage2D(GL_TEXTURE_2D, 0, origin.x(), origin.y(), | 329 glTexSubImage2D(GL_TEXTURE_2D, 0, origin.x(), origin.y(), |
328 bitmap.width(), bitmap.height(), | 330 bitmap.width(), bitmap.height(), |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 // on this thread long enough to perform the GL bindings. | 501 // on this thread long enough to perform the GL bindings. |
500 // TODO(wjmaclean) Remove this when GL initialisation cleaned up. | 502 // TODO(wjmaclean) Remove this when GL initialisation cleaned up. |
501 base::ThreadRestrictions::ScopedAllowIO allow_io; | 503 base::ThreadRestrictions::ScopedAllowIO allow_io; |
502 if (gfx::GLSurface::InitializeOneOff() && | 504 if (gfx::GLSurface::InitializeOneOff() && |
503 gfx::GetGLImplementation() != gfx::kGLImplementationNone) | 505 gfx::GetGLImplementation() != gfx::kGLImplementationNone) |
504 return new CompositorGL(widget, size); | 506 return new CompositorGL(widget, size); |
505 return NULL; | 507 return NULL; |
506 } | 508 } |
507 | 509 |
508 } // namespace ui | 510 } // namespace ui |
OLD | NEW |