Chromium Code Reviews| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 current_surface_ = GetNextSurface(); | 54 current_surface_ = GetNextSurface(); |
| 55 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 55 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 56 texture_target_, current_surface_.texture, 0); | 56 texture_target_, current_surface_.texture, 0); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 void BufferQueue::CopyBufferDamage(int texture, | 60 void BufferQueue::CopyBufferDamage(int texture, |
| 61 int source_texture, | 61 int source_texture, |
| 62 const gfx::Rect& new_damage, | 62 const gfx::Rect& new_damage, |
| 63 const gfx::Rect& old_damage) { | 63 const gfx::Rect& old_damage) { |
| 64 // TODO(dnicoara): Remove ARM workaround once partial swap is enabled. | |
| 65 #if defined(ARCH_CPU_ARM_FAMILY) | |
| 66 gl_helper_->CopySubBufferDamage( | |
| 67 texture_target_, texture, source_texture, | |
| 68 SkRegion(SkIRect::MakeXYWH(0, 0, size_.width(), size_.height())), | |
|
danakj
2015/09/23 21:09:26
nit: if i was doing this i'd share as much code as
dnicoara
2015/09/23 21:23:13
Done.
| |
| 69 SkRegion(SkIRect::MakeXYWH(0, 0, 0, 0))); | |
| 70 #else | |
| 64 gl_helper_->CopySubBufferDamage( | 71 gl_helper_->CopySubBufferDamage( |
| 65 texture_target_, texture, source_texture, | 72 texture_target_, texture, source_texture, |
| 66 SkRegion(SkIRect::MakeXYWH(new_damage.x(), new_damage.y(), | 73 SkRegion(SkIRect::MakeXYWH(new_damage.x(), new_damage.y(), |
|
danakj
2015/09/23 21:09:26
btw.. RectToSkIRect: https://code.google.com/p/chr
dnicoara
2015/09/23 21:23:13
Done. Nice, forgot about the helpers.
| |
| 67 new_damage.width(), new_damage.height())), | 74 new_damage.width(), new_damage.height())), |
| 68 SkRegion(SkIRect::MakeXYWH(old_damage.x(), old_damage.y(), | 75 SkRegion(SkIRect::MakeXYWH(old_damage.x(), old_damage.y(), |
| 69 old_damage.width(), old_damage.height()))); | 76 old_damage.width(), old_damage.height()))); |
| 77 #endif | |
| 70 } | 78 } |
| 71 | 79 |
| 72 void BufferQueue::UpdateBufferDamage(const gfx::Rect& damage) { | 80 void BufferQueue::UpdateBufferDamage(const gfx::Rect& damage) { |
| 73 displayed_surface_.damage.Union(damage); | 81 displayed_surface_.damage.Union(damage); |
| 74 for (size_t i = 0; i < available_surfaces_.size(); i++) | 82 for (size_t i = 0; i < available_surfaces_.size(); i++) |
| 75 available_surfaces_[i].damage.Union(damage); | 83 available_surfaces_[i].damage.Union(damage); |
| 76 | 84 |
| 77 for (std::deque<AllocatedSurface>::iterator it = | 85 for (std::deque<AllocatedSurface>::iterator it = |
| 78 in_flight_surfaces_.begin(); | 86 in_flight_surfaces_.begin(); |
| 79 it != in_flight_surfaces_.end(); | 87 it != in_flight_surfaces_.end(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 gl->DeleteTextures(1, &texture); | 242 gl->DeleteTextures(1, &texture); |
| 235 return AllocatedSurface(); | 243 return AllocatedSurface(); |
| 236 } | 244 } |
| 237 allocated_count_++; | 245 allocated_count_++; |
| 238 gl->BindTexture(texture_target_, texture); | 246 gl->BindTexture(texture_target_, texture); |
| 239 gl->BindTexImage2DCHROMIUM(texture_target_, id); | 247 gl->BindTexImage2DCHROMIUM(texture_target_, id); |
| 240 return AllocatedSurface(texture, id, gfx::Rect(size_)); | 248 return AllocatedSurface(texture, id, gfx::Rect(size_)); |
| 241 } | 249 } |
| 242 | 250 |
| 243 } // namespace content | 251 } // namespace content |
| OLD | NEW |