| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 GLboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM( | 532 GLboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM( |
| 533 GLenum target) { | 533 GLenum target) { |
| 534 base::AutoLock lock(namespace_->lock); | 534 base::AutoLock lock(namespace_->lock); |
| 535 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; | 535 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; |
| 536 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 536 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
| 537 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); | 537 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); |
| 538 buffers.get(bound_buffer_)->pixels.reset(); | 538 buffers.get(bound_buffer_)->pixels.reset(); |
| 539 return true; | 539 return true; |
| 540 } | 540 } |
| 541 | 541 |
| 542 GLuint TestWebGraphicsContext3D::createImageCHROMIUM( | 542 GLuint TestWebGraphicsContext3D::createImageCHROMIUM(GLsizei width, |
| 543 GLsizei width, GLsizei height, | 543 GLsizei height, |
| 544 GLenum internalformat) { | 544 GLenum internalformat, |
| 545 GLenum usage) { |
| 545 DCHECK_EQ(GL_RGBA8_OES, static_cast<int>(internalformat)); | 546 DCHECK_EQ(GL_RGBA8_OES, static_cast<int>(internalformat)); |
| 546 GLuint image_id = NextImageId(); | 547 GLuint image_id = NextImageId(); |
| 547 base::AutoLock lock(namespace_->lock); | 548 base::AutoLock lock(namespace_->lock); |
| 548 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; | 549 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; |
| 549 images.set(image_id, make_scoped_ptr(new Image).Pass()); | 550 images.set(image_id, make_scoped_ptr(new Image).Pass()); |
| 550 images.get(image_id)->pixels.reset(new uint8[width * height * 4]); | 551 images.get(image_id)->pixels.reset(new uint8[width * height * 4]); |
| 551 return image_id; | 552 return image_id; |
| 552 } | 553 } |
| 553 | 554 |
| 554 void TestWebGraphicsContext3D::destroyImageCHROMIUM( | 555 void TestWebGraphicsContext3D::destroyImageCHROMIUM( |
| 555 GLuint id) { | 556 GLuint id) { |
| 556 RetireImageId(id); | 557 RetireImageId(id); |
| 557 } | 558 } |
| 558 | 559 |
| 559 void TestWebGraphicsContext3D::getImageParameterivCHROMIUM( | 560 void TestWebGraphicsContext3D::getImageParameterivCHROMIUM( |
| 560 GLuint image_id, | 561 GLuint image_id, |
| 561 GLenum pname, | 562 GLenum pname, |
| 562 GLint* params) { | 563 GLint* params) { |
| 563 base::AutoLock lock(namespace_->lock); | 564 base::AutoLock lock(namespace_->lock); |
| 564 DCHECK_GT(namespace_->images.count(image_id), 0u); | 565 DCHECK_GT(namespace_->images.count(image_id), 0u); |
| 565 DCHECK_EQ(GL_IMAGE_ROWBYTES_CHROMIUM, static_cast<int>(pname)); | 566 DCHECK_EQ(GL_IMAGE_ROWBYTES_CHROMIUM, static_cast<int>(pname)); |
| 566 *params = 0; | 567 *params = 0; |
| 567 } | 568 } |
| 568 | 569 |
| 569 void* TestWebGraphicsContext3D::mapImageCHROMIUM(GLuint image_id, | 570 void* TestWebGraphicsContext3D::mapImageCHROMIUM(GLuint image_id) { |
| 570 GLenum access) { | |
| 571 base::AutoLock lock(namespace_->lock); | 571 base::AutoLock lock(namespace_->lock); |
| 572 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; | 572 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; |
| 573 DCHECK_GT(images.count(image_id), 0u); | 573 DCHECK_GT(images.count(image_id), 0u); |
| 574 if (times_map_image_chromium_succeeds_ >= 0) { | 574 if (times_map_image_chromium_succeeds_ >= 0) { |
| 575 if (!times_map_image_chromium_succeeds_) { | 575 if (!times_map_image_chromium_succeeds_) { |
| 576 return NULL; | 576 return NULL; |
| 577 } | 577 } |
| 578 --times_map_image_chromium_succeeds_; | 578 --times_map_image_chromium_succeeds_; |
| 579 } | 579 } |
| 580 return images.get(image_id)->pixels.get(); | 580 return images.get(image_id)->pixels.get(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 732 |
| 733 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} | 733 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} |
| 734 | 734 |
| 735 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 735 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
| 736 | 736 |
| 737 TestWebGraphicsContext3D::Image::Image() {} | 737 TestWebGraphicsContext3D::Image::Image() {} |
| 738 | 738 |
| 739 TestWebGraphicsContext3D::Image::~Image() {} | 739 TestWebGraphicsContext3D::Image::~Image() {} |
| 740 | 740 |
| 741 } // namespace cc | 741 } // namespace cc |
| OLD | NEW |