OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" | 5 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 void OffscreenBrowserCompositorOutputSurface::EnsureBackbuffer() { | 57 void OffscreenBrowserCompositorOutputSurface::EnsureBackbuffer() { |
58 is_backbuffer_discarded_ = false; | 58 is_backbuffer_discarded_ = false; |
59 | 59 |
60 if (!reflector_texture_.get()) { | 60 if (!reflector_texture_.get()) { |
61 reflector_texture_.reset(new ReflectorTexture(context_provider())); | 61 reflector_texture_.reset(new ReflectorTexture(context_provider())); |
62 | 62 |
63 GLES2Interface* gl = context_provider_->ContextGL(); | 63 GLES2Interface* gl = context_provider_->ContextGL(); |
64 | 64 |
65 int max_texture_size = | 65 const int max_texture_size = |
66 context_provider_->ContextCapabilities().gpu.max_texture_size; | 66 context_provider_->ContextCapabilities().max_texture_size; |
67 int texture_width = std::min(max_texture_size, surface_size_.width()); | 67 int texture_width = std::min(max_texture_size, surface_size_.width()); |
68 int texture_height = std::min(max_texture_size, surface_size_.height()); | 68 int texture_height = std::min(max_texture_size, surface_size_.height()); |
69 | 69 |
70 cc::ResourceFormat format = cc::RGBA_8888; | 70 cc::ResourceFormat format = cc::RGBA_8888; |
71 gl->BindTexture(GL_TEXTURE_2D, reflector_texture_->texture_id()); | 71 gl->BindTexture(GL_TEXTURE_2D, reflector_texture_->texture_id()); |
72 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 72 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
73 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 73 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
74 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 74 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
75 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 75 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
76 gl->TexImage2D(GL_TEXTURE_2D, 0, GLInternalFormat(format), | 76 gl->TexImage2D(GL_TEXTURE_2D, 0, GLInternalFormat(format), |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 #if defined(OS_MACOSX) | 168 #if defined(OS_MACOSX) |
169 | 169 |
170 bool OffscreenBrowserCompositorOutputSurface:: | 170 bool OffscreenBrowserCompositorOutputSurface:: |
171 SurfaceShouldNotShowFramesAfterSuspendForRecycle() const { | 171 SurfaceShouldNotShowFramesAfterSuspendForRecycle() const { |
172 return true; | 172 return true; |
173 } | 173 } |
174 | 174 |
175 #endif | 175 #endif |
176 | 176 |
177 } // namespace content | 177 } // namespace content |
OLD | NEW |