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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 static const int initialWidth = 100; | 203 static const int initialWidth = 100; |
204 static const int initialHeight = 100; | 204 static const int initialHeight = 100; |
205 static const int alternateHeight = 50; | 205 static const int alternateHeight = 50; |
206 | 206 |
207 class DrawingBufferForTests : public DrawingBuffer { | 207 class DrawingBufferForTests : public DrawingBuffer { |
208 public: | 208 public: |
209 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContex
t3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserv
e) | 209 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContex
t3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserv
e) |
210 { | 210 { |
211 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(conte
xtProvider->contextGL()); | 211 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(conte
xtProvider->contextGL()); |
212 RefPtr<DrawingBufferForTests> drawingBuffer = adoptRef(new DrawingBuffer
ForTests(contextProvider, extensionsUtil.release(), preserve)); | 212 RefPtr<DrawingBufferForTests> drawingBuffer = adoptRef(new DrawingBuffer
ForTests(std::move(contextProvider), extensionsUtil.release(), preserve)); |
213 bool wantDepthBuffer = false; | 213 bool wantDepthBuffer = false; |
214 bool wantStencilBuffer = false; | 214 bool wantStencilBuffer = false; |
215 bool multisampleExtensionSupported = false; | 215 bool multisampleExtensionSupported = false; |
216 if (!drawingBuffer->initialize(size, wantDepthBuffer, wantStencilBuffer,
multisampleExtensionSupported)) { | 216 if (!drawingBuffer->initialize(size, wantDepthBuffer, wantStencilBuffer,
multisampleExtensionSupported)) { |
217 drawingBuffer->beginDestruction(); | 217 drawingBuffer->beginDestruction(); |
218 return nullptr; | 218 return nullptr; |
219 } | 219 } |
220 return drawingBuffer.release(); | 220 return drawingBuffer.release(); |
221 } | 221 } |
222 | 222 |
223 DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3DProvider> contextProvid
er, PassOwnPtr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve) | 223 DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3DProvider> contextProvid
er, PassOwnPtr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve) |
224 : DrawingBuffer(contextProvider, extensionsUtil, false /* discardFramebu
fferSupported */, true /* wantAlphaChannel */, false /* premultipliedAlpha */, p
reserve) | 224 : DrawingBuffer(std::move(contextProvider), std::move(extensionsUtil), f
alse /* discardFramebufferSupported */, true /* wantAlphaChannel */, false /* pr
emultipliedAlpha */, preserve) |
225 , m_live(0) | 225 , m_live(0) |
226 { } | 226 { } |
227 | 227 |
228 ~DrawingBufferForTests() override | 228 ~DrawingBufferForTests() override |
229 { | 229 { |
230 if (m_live) | 230 if (m_live) |
231 *m_live = false; | 231 *m_live = false; |
232 } | 232 } |
233 | 233 |
234 bool* m_live; | 234 bool* m_live; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 m_drawingBuffer->markContentsChanged(); | 762 m_drawingBuffer->markContentsChanged(); |
763 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 763 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
764 EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize()); | 764 EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize()); |
765 EXPECT_FALSE(mailbox.allowOverlay); | 765 EXPECT_FALSE(mailbox.allowOverlay); |
766 | 766 |
767 m_drawingBuffer->mailboxReleased(mailbox, false); | 767 m_drawingBuffer->mailboxReleased(mailbox, false); |
768 m_drawingBuffer->beginDestruction(); | 768 m_drawingBuffer->beginDestruction(); |
769 } | 769 } |
770 | 770 |
771 } // namespace blink | 771 } // namespace blink |
OLD | NEW |