Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h

Issue 2812963003: Add DrawingBuffer multisample resolve unit test. (Closed)
Patch Set: Fix leak. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "gpu/command_buffer/common/capabilities.h" 5 #include "gpu/command_buffer/common/capabilities.h"
6 #include "platform/RuntimeEnabledFeatures.h" 6 #include "platform/RuntimeEnabledFeatures.h"
7 #include "platform/graphics/gpu/DrawingBuffer.h" 7 #include "platform/graphics/gpu/DrawingBuffer.h"
8 #include "platform/graphics/gpu/Extensions3DUtil.h" 8 #include "platform/graphics/gpu/Extensions3DUtil.h"
9 #include "public/platform/WebGraphicsContext3DProvider.h" 9 #include "public/platform/WebGraphicsContext3DProvider.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 enum { 15 enum {
16 kInitialWidth = 100, 16 kInitialWidth = 100,
17 kInitialHeight = 100, 17 kInitialHeight = 100,
18 kAlternateHeight = 50, 18 kAlternateHeight = 50,
19 }; 19 };
20 20
21 class DrawingBufferForTests : public DrawingBuffer { 21 class DrawingBufferForTests : public DrawingBuffer {
22 public: 22 public:
23 static PassRefPtr<DrawingBufferForTests> Create( 23 static PassRefPtr<DrawingBufferForTests> Create(
24 std::unique_ptr<WebGraphicsContext3DProvider> context_provider, 24 std::unique_ptr<WebGraphicsContext3DProvider> context_provider,
25 DrawingBuffer::Client* client, 25 DrawingBuffer::Client* client,
26 const IntSize& size, 26 const IntSize& size,
27 PreserveDrawingBuffer preserve) { 27 PreserveDrawingBuffer preserve,
28 bool multisample_extension_supported) {
Justin Novosad 2017/04/12 19:22:15 Use an enum instead of a bool here. It's rule #10
28 std::unique_ptr<Extensions3DUtil> extensions_util = 29 std::unique_ptr<Extensions3DUtil> extensions_util =
29 Extensions3DUtil::Create(context_provider->ContextGL()); 30 Extensions3DUtil::Create(context_provider->ContextGL());
30 RefPtr<DrawingBufferForTests> drawing_buffer = 31 RefPtr<DrawingBufferForTests> drawing_buffer =
31 AdoptRef(new DrawingBufferForTests(std::move(context_provider), 32 AdoptRef(new DrawingBufferForTests(std::move(context_provider),
32 std::move(extensions_util), client, 33 std::move(extensions_util), client,
33 preserve)); 34 preserve));
34 bool multisample_extension_supported = false;
35 if (!drawing_buffer->Initialize(size, multisample_extension_supported)) { 35 if (!drawing_buffer->Initialize(size, multisample_extension_supported)) {
36 drawing_buffer->BeginDestruction(); 36 drawing_buffer->BeginDestruction();
37 return nullptr; 37 return nullptr;
38 } 38 }
39 return drawing_buffer.Release(); 39 return drawing_buffer.Release();
40 } 40 }
41 41
42 DrawingBufferForTests( 42 DrawingBufferForTests(
43 std::unique_ptr<WebGraphicsContext3DProvider> context_provider, 43 std::unique_ptr<WebGraphicsContext3DProvider> context_provider,
44 std::unique_ptr<Extensions3DUtil> extensions_util, 44 std::unique_ptr<Extensions3DUtil> extensions_util,
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 GLbyte current_mailbox_byte_ = 0; 394 GLbyte current_mailbox_byte_ = 0;
395 IntSize most_recently_produced_size_; 395 IntSize most_recently_produced_size_;
396 bool create_image_chromium_fail_ = false; 396 bool create_image_chromium_fail_ = false;
397 GLuint current_image_id_ = 1; 397 GLuint current_image_id_ = 1;
398 HashMap<GLuint, IntSize> texture_sizes_; 398 HashMap<GLuint, IntSize> texture_sizes_;
399 HashMap<GLuint, IntSize> image_sizes_; 399 HashMap<GLuint, IntSize> image_sizes_;
400 HashMap<GLuint, GLuint> image_to_texture_map_; 400 HashMap<GLuint, GLuint> image_to_texture_map_;
401 }; 401 };
402 402
403 } // blink 403 } // blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698