| 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 "cc/raster/one_copy_tile_task_worker_pool.h" | 5 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 std::max(1, max_bytes_per_copy_operation_ / bytes_per_row); | 437 std::max(1, max_bytes_per_copy_operation_ / bytes_per_row); |
| 438 // Align chunk size to 4. Required to support compressed texture formats. | 438 // Align chunk size to 4. Required to support compressed texture formats. |
| 439 chunk_size_in_rows = MathUtil::UncheckedRoundUp(chunk_size_in_rows, 4); | 439 chunk_size_in_rows = MathUtil::UncheckedRoundUp(chunk_size_in_rows, 4); |
| 440 int y = 0; | 440 int y = 0; |
| 441 int height = resource->size().height(); | 441 int height = resource->size().height(); |
| 442 while (y < height) { | 442 while (y < height) { |
| 443 // Copy at most |chunk_size_in_rows|. | 443 // Copy at most |chunk_size_in_rows|. |
| 444 int rows_to_copy = std::min(chunk_size_in_rows, height - y); | 444 int rows_to_copy = std::min(chunk_size_in_rows, height - y); |
| 445 DCHECK_GT(rows_to_copy, 0); | 445 DCHECK_GT(rows_to_copy, 0); |
| 446 | 446 |
| 447 gl->CopySubTextureCHROMIUM(GL_TEXTURE_2D, staging_buffer->texture_id, | 447 gl->CopySubTextureCHROMIUM( |
| 448 resource_lock->texture_id(), 0, y, 0, y, | 448 staging_buffer->texture_id, resource_lock->texture_id(), 0, y, 0, y, |
| 449 resource->size().width(), rows_to_copy, false, | 449 resource->size().width(), rows_to_copy, false, false, false); |
| 450 false, false); | |
| 451 y += rows_to_copy; | 450 y += rows_to_copy; |
| 452 | 451 |
| 453 // Increment |bytes_scheduled_since_last_flush_| by the amount of memory | 452 // Increment |bytes_scheduled_since_last_flush_| by the amount of memory |
| 454 // used for this copy operation. | 453 // used for this copy operation. |
| 455 bytes_scheduled_since_last_flush_ += rows_to_copy * bytes_per_row; | 454 bytes_scheduled_since_last_flush_ += rows_to_copy * bytes_per_row; |
| 456 | 455 |
| 457 if (bytes_scheduled_since_last_flush_ >= max_bytes_per_copy_operation_) { | 456 if (bytes_scheduled_since_last_flush_ >= max_bytes_per_copy_operation_) { |
| 458 gl->ShallowFlushCHROMIUM(); | 457 gl->ShallowFlushCHROMIUM(); |
| 459 bytes_scheduled_since_last_flush_ = 0; | 458 bytes_scheduled_since_last_flush_ = 0; |
| 460 } | 459 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 return; | 722 return; |
| 724 | 723 |
| 725 busy_buffers_.front()->DestroyGLResources(gl); | 724 busy_buffers_.front()->DestroyGLResources(gl); |
| 726 RemoveStagingBuffer(busy_buffers_.front().get()); | 725 RemoveStagingBuffer(busy_buffers_.front().get()); |
| 727 busy_buffers_.pop_front(); | 726 busy_buffers_.pop_front(); |
| 728 } | 727 } |
| 729 } | 728 } |
| 730 } | 729 } |
| 731 | 730 |
| 732 } // namespace cc | 731 } // namespace cc |
| OLD | NEW |