| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "platform/graphics/gpu/DrawingBuffer.h" | 31 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 32 | 32 |
| 33 #include <memory> | 33 #include <memory> |
| 34 #include "cc/resources/single_release_callback.h" | 34 #include "cc/resources/single_release_callback.h" |
| 35 #include "cc/resources/texture_mailbox.h" | 35 #include "cc/resources/texture_mailbox.h" |
| 36 #include "cc/test/test_gpu_memory_buffer_manager.h" | 36 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 37 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 37 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
| 38 #include "gpu/command_buffer/common/mailbox.h" | 38 #include "gpu/command_buffer/common/mailbox.h" |
| 39 #include "gpu/command_buffer/common/sync_token.h" | 39 #include "gpu/command_buffer/common/sync_token.h" |
| 40 #include "platform/graphics/CanvasColorParams.h" |
| 40 #include "platform/graphics/ImageBuffer.h" | 41 #include "platform/graphics/ImageBuffer.h" |
| 41 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 42 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 42 #include "platform/graphics/gpu/DrawingBufferTestHelpers.h" | 43 #include "platform/graphics/gpu/DrawingBufferTestHelpers.h" |
| 43 #include "platform/wtf/PtrUtil.h" | 44 #include "platform/wtf/PtrUtil.h" |
| 44 #include "platform/wtf/RefPtr.h" | 45 #include "platform/wtf/RefPtr.h" |
| 45 #include "public/platform/Platform.h" | 46 #include "public/platform/Platform.h" |
| 46 #include "testing/gtest/include/gtest/gtest.h" | 47 #include "testing/gtest/include/gtest/gtest.h" |
| 47 #include "third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h" | 48 #include "third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h" |
| 48 | 49 |
| 49 using testing::Test; | 50 using testing::Test; |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 | 647 |
| 647 bool premultiplied_alpha = false; | 648 bool premultiplied_alpha = false; |
| 648 bool want_alpha_channel = true; | 649 bool want_alpha_channel = true; |
| 649 bool want_depth_buffer = cases[i].request_depth; | 650 bool want_depth_buffer = cases[i].request_depth; |
| 650 bool want_stencil_buffer = cases[i].request_stencil; | 651 bool want_stencil_buffer = cases[i].request_stencil; |
| 651 bool want_antialiasing = false; | 652 bool want_antialiasing = false; |
| 652 RefPtr<DrawingBuffer> drawing_buffer = DrawingBuffer::Create( | 653 RefPtr<DrawingBuffer> drawing_buffer = DrawingBuffer::Create( |
| 653 std::move(provider), nullptr, IntSize(10, 10), premultiplied_alpha, | 654 std::move(provider), nullptr, IntSize(10, 10), premultiplied_alpha, |
| 654 want_alpha_channel, want_depth_buffer, want_stencil_buffer, | 655 want_alpha_channel, want_depth_buffer, want_stencil_buffer, |
| 655 want_antialiasing, preserve, DrawingBuffer::kWebGL1, | 656 want_antialiasing, preserve, DrawingBuffer::kWebGL1, |
| 656 DrawingBuffer::kAllowChromiumImage); | 657 DrawingBuffer::kAllowChromiumImage, CanvasColorParams()); |
| 657 | 658 |
| 658 // When we request a depth or a stencil buffer, we will get both. | 659 // When we request a depth or a stencil buffer, we will get both. |
| 659 EXPECT_EQ(cases[i].request_depth || cases[i].request_stencil, | 660 EXPECT_EQ(cases[i].request_depth || cases[i].request_stencil, |
| 660 drawing_buffer->HasDepthBuffer()); | 661 drawing_buffer->HasDepthBuffer()); |
| 661 EXPECT_EQ(cases[i].request_depth || cases[i].request_stencil, | 662 EXPECT_EQ(cases[i].request_depth || cases[i].request_stencil, |
| 662 drawing_buffer->HasStencilBuffer()); | 663 drawing_buffer->HasStencilBuffer()); |
| 663 EXPECT_EQ(cases[i].expected_render_buffers, | 664 EXPECT_EQ(cases[i].expected_render_buffers, |
| 664 tracking_gl->NumAllocatedRenderBuffer()); | 665 tracking_gl->NumAllocatedRenderBuffer()); |
| 665 if (cases[i].request_depth || cases[i].request_stencil) { | 666 if (cases[i].request_depth || cases[i].request_stencil) { |
| 666 EXPECT_NE(0u, tracking_gl->DepthStencilAttachment()); | 667 EXPECT_NE(0u, tracking_gl->DepthStencilAttachment()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 drawing_buffer_->SetIsHidden(true); | 709 drawing_buffer_->SetIsHidden(true); |
| 709 release_callback->Run(wait_sync_token, false /* lostResource */); | 710 release_callback->Run(wait_sync_token, false /* lostResource */); |
| 710 // m_drawingBuffer deletes mailbox immediately when hidden. | 711 // m_drawingBuffer deletes mailbox immediately when hidden. |
| 711 | 712 |
| 712 EXPECT_EQ(wait_sync_token, gl_->MostRecentlyWaitedSyncToken()); | 713 EXPECT_EQ(wait_sync_token, gl_->MostRecentlyWaitedSyncToken()); |
| 713 | 714 |
| 714 drawing_buffer_->BeginDestruction(); | 715 drawing_buffer_->BeginDestruction(); |
| 715 } | 716 } |
| 716 | 717 |
| 717 } // namespace blink | 718 } // namespace blink |
| OLD | NEW |