| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 current_surface_ = GetNextSurface(); | 55 current_surface_ = GetNextSurface(); |
| 56 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 56 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 57 texture_target_, current_surface_.texture, 0); | 57 texture_target_, current_surface_.texture, 0); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 void BufferQueue::CopyBufferDamage(int texture, | 61 void BufferQueue::CopyBufferDamage(int texture, |
| 62 int source_texture, | 62 int source_texture, |
| 63 const gfx::Rect& new_damage, | 63 const gfx::Rect& new_damage, |
| 64 const gfx::Rect& old_damage) { | 64 const gfx::Rect& old_damage) { |
| 65 gfx::Rect new_damage_mutable = new_damage; | |
| 66 gfx::Rect old_damage_mutable = old_damage; | |
| 67 #if defined(ARCH_CPU_ARM_FAMILY) | |
| 68 // TODO(dnicoara): Remove ARM workaround once partial swap is enabled. | |
| 69 new_damage_mutable = gfx::Rect(size_); | |
| 70 old_damage_mutable = gfx::Rect(); | |
| 71 #endif | |
| 72 | |
| 73 gl_helper_->CopySubBufferDamage( | 65 gl_helper_->CopySubBufferDamage( |
| 74 texture_target_, texture, source_texture, | 66 texture_target_, texture, source_texture, |
| 75 SkRegion(gfx::RectToSkIRect(new_damage_mutable)), | 67 SkRegion(gfx::RectToSkIRect(new_damage)), |
| 76 SkRegion(gfx::RectToSkIRect(old_damage_mutable))); | 68 SkRegion(gfx::RectToSkIRect(old_damage))); |
| 77 } | 69 } |
| 78 | 70 |
| 79 void BufferQueue::UpdateBufferDamage(const gfx::Rect& damage) { | 71 void BufferQueue::UpdateBufferDamage(const gfx::Rect& damage) { |
| 80 displayed_surface_.damage.Union(damage); | 72 displayed_surface_.damage.Union(damage); |
| 81 for (size_t i = 0; i < available_surfaces_.size(); i++) | 73 for (size_t i = 0; i < available_surfaces_.size(); i++) |
| 82 available_surfaces_[i].damage.Union(damage); | 74 available_surfaces_[i].damage.Union(damage); |
| 83 | 75 |
| 84 for (std::deque<AllocatedSurface>::iterator it = | 76 for (std::deque<AllocatedSurface>::iterator it = |
| 85 in_flight_surfaces_.begin(); | 77 in_flight_surfaces_.begin(); |
| 86 it != in_flight_surfaces_.end(); | 78 it != in_flight_surfaces_.end(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 gl->DeleteTextures(1, &texture); | 233 gl->DeleteTextures(1, &texture); |
| 242 return AllocatedSurface(); | 234 return AllocatedSurface(); |
| 243 } | 235 } |
| 244 allocated_count_++; | 236 allocated_count_++; |
| 245 gl->BindTexture(texture_target_, texture); | 237 gl->BindTexture(texture_target_, texture); |
| 246 gl->BindTexImage2DCHROMIUM(texture_target_, id); | 238 gl->BindTexImage2DCHROMIUM(texture_target_, id); |
| 247 return AllocatedSurface(texture, id, gfx::Rect(size_)); | 239 return AllocatedSurface(texture, id, gfx::Rect(size_)); |
| 248 } | 240 } |
| 249 | 241 |
| 250 } // namespace content | 242 } // namespace content |
| OLD | NEW |