Index: content/common/gpu/image_transport_surface.cc |
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc |
index 2f12e7bb444705e2b25bcf0692c82d9da6c6c1e5..3160abb7fb4fc804bb76f0b65272c95f79b0034c 100644 |
--- a/content/common/gpu/image_transport_surface.cc |
+++ b/content/common/gpu/image_transport_surface.cc |
@@ -22,6 +22,42 @@ ImageTransportSurface::ImageTransportSurface() { |
ImageTransportSurface::~ImageTransportSurface() { |
} |
+void ImageTransportSurface::GetRegionsToCopy( |
+ const gfx::Rect& previous_damage_rect, |
+ const gfx::Rect& new_damage_rect, |
+ std::vector<gfx::Rect>* regions) { |
+ gfx::Rect intersection = previous_damage_rect.Intersect(new_damage_rect); |
+ |
+ if (intersection.IsEmpty()) { |
+ regions->push_back(previous_damage_rect); |
+ return; |
+ } |
+ |
+ // Top (above the intersection). |
+ regions->push_back(gfx::Rect(previous_damage_rect.x(), |
+ previous_damage_rect.y(), |
+ previous_damage_rect.width(), |
+ intersection.y() - previous_damage_rect.y())); |
+ |
+ // Left (of the intersection). |
+ regions->push_back(gfx::Rect(previous_damage_rect.x(), |
+ intersection.y(), |
+ intersection.x() - previous_damage_rect.x(), |
+ intersection.height())); |
+ |
+ // Right (of the intersection). |
+ regions->push_back(gfx::Rect(intersection.right(), |
+ intersection.y(), |
+ previous_damage_rect.right() - intersection.right(), |
+ intersection.height())); |
+ |
+ // Bottom (below the intersection). |
+ regions->push_back(gfx::Rect(previous_damage_rect.x(), |
+ intersection.bottom(), |
+ previous_damage_rect.width(), |
+ previous_damage_rect.bottom() - intersection.bottom())); |
+} |
+ |
ImageTransportHelper::ImageTransportHelper(ImageTransportSurface* surface, |
GpuChannelManager* manager, |
GpuCommandBufferStub* stub, |