OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/test_web_graphics_context_3d.h" | 5 #include "cc/test/test_web_graphics_context_3d.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <string> | 11 #include <string> |
9 | 12 |
10 #include "base/bind.h" | 13 #include "base/bind.h" |
11 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 15 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
14 #include "base/numerics/safe_conversions.h" | 17 #include "base/numerics/safe_conversions.h" |
15 #include "cc/test/test_context_support.h" | 18 #include "cc/test/test_context_support.h" |
16 #include "gpu/GLES2/gl2extchromium.h" | 19 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 544 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
542 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); | 545 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); |
543 Buffer* buffer = buffers.get(bound_buffer_); | 546 Buffer* buffer = buffers.get(bound_buffer_); |
544 if (context_lost_) { | 547 if (context_lost_) { |
545 buffer->pixels = nullptr; | 548 buffer->pixels = nullptr; |
546 return; | 549 return; |
547 } | 550 } |
548 | 551 |
549 size_t old_size = buffer->size; | 552 size_t old_size = buffer->size; |
550 | 553 |
551 buffer->pixels.reset(new uint8[size]); | 554 buffer->pixels.reset(new uint8_t[size]); |
552 buffer->size = size; | 555 buffer->size = size; |
553 if (data != NULL) | 556 if (data != NULL) |
554 memcpy(buffer->pixels.get(), data, size); | 557 memcpy(buffer->pixels.get(), data, size); |
555 if (buffer->target == GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM) | 558 if (buffer->target == GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM) |
556 current_used_transfer_buffer_usage_bytes_ += | 559 current_used_transfer_buffer_usage_bytes_ += |
557 base::checked_cast<int>(buffer->size) - | 560 base::checked_cast<int>(buffer->size) - |
558 base::checked_cast<int>(old_size); | 561 base::checked_cast<int>(old_size); |
559 max_used_transfer_buffer_usage_bytes_ = | 562 max_used_transfer_buffer_usage_bytes_ = |
560 std::max(max_used_transfer_buffer_usage_bytes_, | 563 std::max(max_used_transfer_buffer_usage_bytes_, |
561 current_used_transfer_buffer_usage_bytes_); | 564 current_used_transfer_buffer_usage_bytes_); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 822 |
820 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} | 823 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} |
821 | 824 |
822 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 825 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
823 | 826 |
824 TestWebGraphicsContext3D::Image::Image() {} | 827 TestWebGraphicsContext3D::Image::Image() {} |
825 | 828 |
826 TestWebGraphicsContext3D::Image::~Image() {} | 829 TestWebGraphicsContext3D::Image::~Image() {} |
827 | 830 |
828 } // namespace cc | 831 } // namespace cc |
OLD | NEW |