OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/buffer_queue.h" | 5 #include "content/browser/compositor/buffer_queue.h" |
6 | 6 |
7 #include "content/browser/compositor/image_transport_factory.h" | 7 #include "content/browser/compositor/image_transport_factory.h" |
8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
9 #include "content/common/gpu/client/context_provider_command_buffer.h" | 9 #include "content/common/gpu/client/context_provider_command_buffer.h" |
10 #include "content/common/gpu/client/gl_helper.h" | 10 #include "content/common/gpu/client/gl_helper.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 available_surfaces_[i].damage.Union(damage); | 74 available_surfaces_[i].damage.Union(damage); |
75 | 75 |
76 for (std::deque<AllocatedSurface>::iterator it = | 76 for (std::deque<AllocatedSurface>::iterator it = |
77 in_flight_surfaces_.begin(); | 77 in_flight_surfaces_.begin(); |
78 it != in_flight_surfaces_.end(); | 78 it != in_flight_surfaces_.end(); |
79 ++it) | 79 ++it) |
80 it->damage.Union(damage); | 80 it->damage.Union(damage); |
81 } | 81 } |
82 | 82 |
83 void BufferQueue::SwapBuffers(const gfx::Rect& damage) { | 83 void BufferQueue::SwapBuffers(const gfx::Rect& damage) { |
84 if (damage != gfx::Rect(size_)) { | 84 if (!damage.IsEmpty() && damage != gfx::Rect(size_)) { |
85 // We must have a frame available to copy from. | 85 // We must have a frame available to copy from. |
86 DCHECK(!in_flight_surfaces_.empty() || displayed_surface_.texture); | 86 DCHECK(!in_flight_surfaces_.empty() || displayed_surface_.texture); |
87 unsigned int texture_id = !in_flight_surfaces_.empty() | 87 unsigned int texture_id = !in_flight_surfaces_.empty() |
88 ? in_flight_surfaces_.back().texture | 88 ? in_flight_surfaces_.back().texture |
89 : displayed_surface_.texture; | 89 : displayed_surface_.texture; |
90 | 90 |
91 CopyBufferDamage(current_surface_.texture, texture_id, damage, | 91 CopyBufferDamage(current_surface_.texture, texture_id, damage, |
92 current_surface_.damage); | 92 current_surface_.damage); |
93 } | 93 } |
94 UpdateBufferDamage(damage); | 94 UpdateBufferDamage(damage); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 BufferQueue::AllocatedSurface::AllocatedSurface( | 244 BufferQueue::AllocatedSurface::AllocatedSurface( |
245 scoped_ptr<gfx::GpuMemoryBuffer> buffer, | 245 scoped_ptr<gfx::GpuMemoryBuffer> buffer, |
246 unsigned int texture, | 246 unsigned int texture, |
247 unsigned int image, | 247 unsigned int image, |
248 const gfx::Rect& rect) | 248 const gfx::Rect& rect) |
249 : buffer(buffer.release()), texture(texture), image(image), damage(rect) {} | 249 : buffer(buffer.release()), texture(texture), image(image), damage(rect) {} |
250 | 250 |
251 BufferQueue::AllocatedSurface::~AllocatedSurface() {} | 251 BufferQueue::AllocatedSurface::~AllocatedSurface() {} |
252 | 252 |
253 } // namespace content | 253 } // namespace content |
OLD | NEW |