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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { | 57 class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { |
58 public: | 58 public: |
59 WebGraphicsContext3DForTests() | 59 WebGraphicsContext3DForTests() |
60 : MockWebGraphicsContext3D() | 60 : MockWebGraphicsContext3D() |
61 , m_boundTexture(0) | 61 , m_boundTexture(0) |
62 , m_currentMailboxByte(0) { } | 62 , m_currentMailboxByte(0) { } |
63 | 63 |
64 virtual void bindTexture(WGC3Denum target, WebGLId texture) | 64 virtual void bindTexture(WGC3Denum target, WebGLId texture) |
65 { | 65 { |
66 if (target == GraphicsContext3D::TEXTURE_2D) { | 66 if (target == GL_TEXTURE_2D) { |
67 m_boundTexture = texture; | 67 m_boundTexture = texture; |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internal
format, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format,
WGC3Denum type, const void* pixels) | 71 virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internal
format, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format,
WGC3Denum type, const void* pixels) |
72 { | 72 { |
73 if (target == GraphicsContext3D::TEXTURE_2D && !level) { | 73 if (target == GL_TEXTURE_2D && !level) { |
74 m_textureSizes.set(m_boundTexture, IntSize(width, height)); | 74 m_textureSizes.set(m_boundTexture, IntSize(width, height)); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) | 78 virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) |
79 { | 79 { |
80 ++m_currentMailboxByte; | 80 ++m_currentMailboxByte; |
81 WebExternalTextureMailbox temp; | 81 WebExternalTextureMailbox temp; |
82 memset(mailbox, m_currentMailboxByte, sizeof(temp.name)); | 82 memset(mailbox, m_currentMailboxByte, sizeof(temp.name)); |
83 } | 83 } |
84 | 84 |
85 virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailb
ox) | 85 virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailb
ox) |
86 { | 86 { |
87 ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); | 87 ASSERT_EQ(target, static_cast<WGC3Denum>(GL_TEXTURE_2D)); |
88 m_mostRecentlyProducedSize = m_textureSizes.get(m_boundTexture); | 88 m_mostRecentlyProducedSize = m_textureSizes.get(m_boundTexture); |
89 } | 89 } |
90 | 90 |
91 IntSize mostRecentlyProducedSize() | 91 IntSize mostRecentlyProducedSize() |
92 { | 92 { |
93 return m_mostRecentlyProducedSize; | 93 return m_mostRecentlyProducedSize; |
94 } | 94 } |
95 | 95 |
96 private: | 96 private: |
97 WebGLId m_boundTexture; | 97 WebGLId m_boundTexture; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 166 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
167 | 167 |
168 // Prepare one final mailbox and verify that it's the correct size. | 168 // Prepare one final mailbox and verify that it's the correct size. |
169 m_drawingBuffer->mailboxReleased(mailbox); | 169 m_drawingBuffer->mailboxReleased(mailbox); |
170 m_drawingBuffer->markContentsChanged(); | 170 m_drawingBuffer->markContentsChanged(); |
171 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 171 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
172 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 172 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
173 } | 173 } |
174 | 174 |
175 } // namespace | 175 } // namespace |
OLD | NEW |