OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerTreeHostImpl.h" | 7 #include "CCLayerTreeHostImpl.h" |
8 | 8 |
9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
10 #include "CCDelegatedRendererLayerImpl.h" | 10 #include "CCDelegatedRendererLayerImpl.h" |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 943 |
944 private: | 944 private: |
945 explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDr
aw, bool animating, CCResourceProvider* resourceProvider) | 945 explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDr
aw, bool animating, CCResourceProvider* resourceProvider) |
946 : DidDrawCheckLayer(id) | 946 : DidDrawCheckLayer(id) |
947 { | 947 { |
948 OwnPtr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize
(10, 10), CCLayerTilingData::NoBorderTexels); | 948 OwnPtr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize
(10, 10), CCLayerTilingData::NoBorderTexels); |
949 tilingData->setBounds(bounds()); | 949 tilingData->setBounds(bounds()); |
950 setTilingData(*tilingData.get()); | 950 setTilingData(*tilingData.get()); |
951 setSkipsDraw(skipsDraw); | 951 setSkipsDraw(skipsDraw); |
952 if (!tileMissing) { | 952 if (!tileMissing) { |
953 CCResourceProvider::ResourceId resource = resourceProvider->createRe
source(CCRenderer::ContentPool, IntSize(), GraphicsContext3D::RGBA, CCResourcePr
ovider::TextureUsageAny); | 953 CCResourceProvider::ResourceId resource = resourceProvider->createRe
source(CCRenderer::ContentPool, IntSize(), GL_RGBA, CCResourceProvider::TextureU
sageAny); |
954 pushTileProperties(0, 0, resource, IntRect()); | 954 pushTileProperties(0, 0, resource, IntRect()); |
955 } | 955 } |
956 if (animating) | 956 if (animating) |
957 addAnimatedTransformToLayer(*this, 10, 3, 0); | 957 addAnimatedTransformToLayer(*this, 10, 3, 0); |
958 } | 958 } |
959 }; | 959 }; |
960 | 960 |
961 TEST_P(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) | 961 TEST_P(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
962 { | 962 { |
963 // When the texture is not missing, we draw as usual. | 963 // When the texture is not missing, we draw as usual. |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 scrollInfo = m_hostImpl->processScrollDeltas(); | 1488 scrollInfo = m_hostImpl->processScrollDeltas(); |
1489 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScroll
Delta); | 1489 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScroll
Delta); |
1490 } | 1490 } |
1491 | 1491 |
1492 class BlendStateTrackerContext: public FakeWebGraphicsContext3D { | 1492 class BlendStateTrackerContext: public FakeWebGraphicsContext3D { |
1493 public: | 1493 public: |
1494 BlendStateTrackerContext() : m_blend(false) { } | 1494 BlendStateTrackerContext() : m_blend(false) { } |
1495 | 1495 |
1496 virtual void enable(WGC3Denum cap) | 1496 virtual void enable(WGC3Denum cap) |
1497 { | 1497 { |
1498 if (cap == GraphicsContext3D::BLEND) | 1498 if (cap == GL_BLEND) |
1499 m_blend = true; | 1499 m_blend = true; |
1500 } | 1500 } |
1501 | 1501 |
1502 virtual void disable(WGC3Denum cap) | 1502 virtual void disable(WGC3Denum cap) |
1503 { | 1503 { |
1504 if (cap == GraphicsContext3D::BLEND) | 1504 if (cap == GL_BLEND) |
1505 m_blend = false; | 1505 m_blend = false; |
1506 } | 1506 } |
1507 | 1507 |
1508 bool blend() const { return m_blend; } | 1508 bool blend() const { return m_blend; } |
1509 | 1509 |
1510 private: | 1510 private: |
1511 bool m_blend; | 1511 bool m_blend; |
1512 }; | 1512 }; |
1513 | 1513 |
1514 class BlendStateCheckLayer : public CCLayerImpl { | 1514 class BlendStateCheckLayer : public CCLayerImpl { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect;
} | 1547 void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect;
} |
1548 | 1548 |
1549 private: | 1549 private: |
1550 explicit BlendStateCheckLayer(int id, CCResourceProvider* resourceProvider) | 1550 explicit BlendStateCheckLayer(int id, CCResourceProvider* resourceProvider) |
1551 : CCLayerImpl(id) | 1551 : CCLayerImpl(id) |
1552 , m_blend(false) | 1552 , m_blend(false) |
1553 , m_hasRenderSurface(false) | 1553 , m_hasRenderSurface(false) |
1554 , m_quadsAppended(false) | 1554 , m_quadsAppended(false) |
1555 , m_quadRect(5, 5, 5, 5) | 1555 , m_quadRect(5, 5, 5, 5) |
1556 , m_quadVisibleRect(5, 5, 5, 5) | 1556 , m_quadVisibleRect(5, 5, 5, 5) |
1557 , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool,
IntSize(1, 1), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) | 1557 , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool,
IntSize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny)) |
1558 { | 1558 { |
1559 setAnchorPoint(FloatPoint(0, 0)); | 1559 setAnchorPoint(FloatPoint(0, 0)); |
1560 setBounds(IntSize(10, 10)); | 1560 setBounds(IntSize(10, 10)); |
1561 setContentBounds(IntSize(10, 10)); | 1561 setContentBounds(IntSize(10, 10)); |
1562 setDrawsContent(true); | 1562 setDrawsContent(true); |
1563 } | 1563 } |
1564 | 1564 |
1565 bool m_blend; | 1565 bool m_blend; |
1566 bool m_hasRenderSurface; | 1566 bool m_hasRenderSurface; |
1567 bool m_quadsAppended; | 1567 bool m_quadsAppended; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 | 1896 |
1897 class PartialSwapTrackerContext : public FakeWebGraphicsContext3D { | 1897 class PartialSwapTrackerContext : public FakeWebGraphicsContext3D { |
1898 public: | 1898 public: |
1899 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) | 1899 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) |
1900 { | 1900 { |
1901 m_partialSwapRect = IntRect(x, y, width, height); | 1901 m_partialSwapRect = IntRect(x, y, width, height); |
1902 } | 1902 } |
1903 | 1903 |
1904 virtual WebString getString(WGC3Denum name) | 1904 virtual WebString getString(WGC3Denum name) |
1905 { | 1905 { |
1906 if (name == GraphicsContext3D::EXTENSIONS) | 1906 if (name == GL_EXTENSIONS) |
1907 return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibi
lity"); | 1907 return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibi
lity"); |
1908 | 1908 |
1909 return WebString(); | 1909 return WebString(); |
1910 } | 1910 } |
1911 | 1911 |
1912 IntRect partialSwapRect() const { return m_partialSwapRect; } | 1912 IntRect partialSwapRect() const { return m_partialSwapRect; } |
1913 | 1913 |
1914 private: | 1914 private: |
1915 IntRect m_partialSwapRect; | 1915 IntRect m_partialSwapRect; |
1916 }; | 1916 }; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 .WillRepeatedly(Return()); | 2073 .WillRepeatedly(Return()); |
2074 | 2074 |
2075 EXPECT_CALL(*m_context, uniform4f(_, _, _, _, _)) | 2075 EXPECT_CALL(*m_context, uniform4f(_, _, _, _, _)) |
2076 .WillRepeatedly(Return()); | 2076 .WillRepeatedly(Return()); |
2077 | 2077 |
2078 // Any other strings are empty | 2078 // Any other strings are empty |
2079 EXPECT_CALL(*m_context, getString(_)) | 2079 EXPECT_CALL(*m_context, getString(_)) |
2080 .WillRepeatedly(Return(WebString())); | 2080 .WillRepeatedly(Return(WebString())); |
2081 | 2081 |
2082 // Support for partial swap, if needed | 2082 // Support for partial swap, if needed |
2083 EXPECT_CALL(*m_context, getString(GraphicsContext3D::EXTENSIONS)) | 2083 EXPECT_CALL(*m_context, getString(GL_EXTENSIONS)) |
2084 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); | 2084 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); |
2085 | 2085 |
2086 EXPECT_CALL(*m_context, getRequestableExtensionsCHROMIUM()) | 2086 EXPECT_CALL(*m_context, getRequestableExtensionsCHROMIUM()) |
2087 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); | 2087 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); |
2088 | 2088 |
2089 // Any un-sanctioned calls to enable() are OK | 2089 // Any un-sanctioned calls to enable() are OK |
2090 EXPECT_CALL(*m_context, enable(_)) | 2090 EXPECT_CALL(*m_context, enable(_)) |
2091 .WillRepeatedly(Return()); | 2091 .WillRepeatedly(Return()); |
2092 | 2092 |
2093 // Any un-sanctioned calls to disable() are OK | 2093 // Any un-sanctioned calls to disable() are OK |
2094 EXPECT_CALL(*m_context, disable(_)) | 2094 EXPECT_CALL(*m_context, disable(_)) |
2095 .WillRepeatedly(Return()); | 2095 .WillRepeatedly(Return()); |
2096 } | 2096 } |
2097 | 2097 |
2098 void mustDrawSolidQuad() | 2098 void mustDrawSolidQuad() |
2099 { | 2099 { |
2100 EXPECT_CALL(*m_context, drawElements(GraphicsContext3D::TRIANGLES, 6, Gr
aphicsContext3D::UNSIGNED_SHORT, 0)) | 2100 EXPECT_CALL(*m_context, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT,
0)) |
2101 .WillOnce(Return()) | 2101 .WillOnce(Return()) |
2102 .RetiresOnSaturation(); | 2102 .RetiresOnSaturation(); |
2103 | 2103 |
2104 // 1 is hardcoded return value of fake createProgram() | 2104 // 1 is hardcoded return value of fake createProgram() |
2105 EXPECT_CALL(*m_context, useProgram(1)) | 2105 EXPECT_CALL(*m_context, useProgram(1)) |
2106 .WillOnce(Return()) | 2106 .WillOnce(Return()) |
2107 .RetiresOnSaturation(); | 2107 .RetiresOnSaturation(); |
2108 | 2108 |
2109 } | 2109 } |
2110 | 2110 |
2111 void mustSetScissor(int x, int y, int width, int height) | 2111 void mustSetScissor(int x, int y, int width, int height) |
2112 { | 2112 { |
2113 EXPECT_CALL(*m_context, enable(GraphicsContext3D::SCISSOR_TEST)) | 2113 EXPECT_CALL(*m_context, enable(GL_SCISSOR_TEST)) |
2114 .WillRepeatedly(Return()); | 2114 .WillRepeatedly(Return()); |
2115 | 2115 |
2116 EXPECT_CALL(*m_context, scissor(x, y, width, height)) | 2116 EXPECT_CALL(*m_context, scissor(x, y, width, height)) |
2117 .Times(AtLeast(1)) | 2117 .Times(AtLeast(1)) |
2118 .WillRepeatedly(Return()); | 2118 .WillRepeatedly(Return()); |
2119 } | 2119 } |
2120 | 2120 |
2121 void mustSetNoScissor() | 2121 void mustSetNoScissor() |
2122 { | 2122 { |
2123 EXPECT_CALL(*m_context, disable(GraphicsContext3D::SCISSOR_TEST)) | 2123 EXPECT_CALL(*m_context, disable(GL_SCISSOR_TEST)) |
2124 .WillRepeatedly(Return()); | 2124 .WillRepeatedly(Return()); |
2125 | 2125 |
2126 EXPECT_CALL(*m_context, enable(GraphicsContext3D::SCISSOR_TEST)) | 2126 EXPECT_CALL(*m_context, enable(GL_SCISSOR_TEST)) |
2127 .Times(0); | 2127 .Times(0); |
2128 | 2128 |
2129 EXPECT_CALL(*m_context, scissor(_, _, _, _)) | 2129 EXPECT_CALL(*m_context, scissor(_, _, _, _)) |
2130 .Times(0); | 2130 .Times(0); |
2131 } | 2131 } |
2132 }; | 2132 }; |
2133 | 2133 |
2134 TEST_P(CCLayerTreeHostImplTest, noPartialSwap) | 2134 TEST_P(CCLayerTreeHostImplTest, noPartialSwap) |
2135 { | 2135 { |
2136 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new MockContext)).PassAs<CCGraphicsContext>(); | 2136 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new MockContext)).PassAs<CCGraphicsContext>(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 myHostImpl->drawLayers(frame); | 2181 myHostImpl->drawLayers(frame); |
2182 myHostImpl->didDrawAllLayers(frame); | 2182 myHostImpl->didDrawAllLayers(frame); |
2183 } | 2183 } |
2184 Mock::VerifyAndClearExpectations(&mockContext); | 2184 Mock::VerifyAndClearExpectations(&mockContext); |
2185 } | 2185 } |
2186 | 2186 |
2187 class PartialSwapContext : public FakeWebGraphicsContext3D { | 2187 class PartialSwapContext : public FakeWebGraphicsContext3D { |
2188 public: | 2188 public: |
2189 WebString getString(WGC3Denum name) | 2189 WebString getString(WGC3Denum name) |
2190 { | 2190 { |
2191 if (name == GraphicsContext3D::EXTENSIONS) | 2191 if (name == GL_EXTENSIONS) |
2192 return WebString("GL_CHROMIUM_post_sub_buffer"); | 2192 return WebString("GL_CHROMIUM_post_sub_buffer"); |
2193 return WebString(); | 2193 return WebString(); |
2194 } | 2194 } |
2195 | 2195 |
2196 WebString getRequestableExtensionsCHROMIUM() | 2196 WebString getRequestableExtensionsCHROMIUM() |
2197 { | 2197 { |
2198 return WebString("GL_CHROMIUM_post_sub_buffer"); | 2198 return WebString("GL_CHROMIUM_post_sub_buffer"); |
2199 } | 2199 } |
2200 | 2200 |
2201 // Unlimited texture size. | 2201 // Unlimited texture size. |
2202 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) | 2202 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) |
2203 { | 2203 { |
2204 if (pname == cc::GraphicsContext3D::MAX_TEXTURE_SIZE) | 2204 if (pname == GL_MAX_TEXTURE_SIZE) |
2205 *value = 8192; | 2205 *value = 8192; |
2206 } | 2206 } |
2207 }; | 2207 }; |
2208 | 2208 |
2209 static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) | 2209 static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) |
2210 { | 2210 { |
2211 CCSettings::setPartialSwapEnabled(partialSwap); | 2211 CCSettings::setPartialSwapEnabled(partialSwap); |
2212 | 2212 |
2213 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); | 2213 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); |
2214 | 2214 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2522 public: | 2522 public: |
2523 FakeVideoFrame() : m_textureId(0) { memset(m_data, 0x80, sizeof(m_data)); } | 2523 FakeVideoFrame() : m_textureId(0) { memset(m_data, 0x80, sizeof(m_data)); } |
2524 virtual ~FakeVideoFrame() { } | 2524 virtual ~FakeVideoFrame() { } |
2525 virtual Format format() const { return m_textureId ? FormatNativeTexture : F
ormatYV12; } | 2525 virtual Format format() const { return m_textureId ? FormatNativeTexture : F
ormatYV12; } |
2526 virtual unsigned width() const { return 4; } | 2526 virtual unsigned width() const { return 4; } |
2527 virtual unsigned height() const { return 4; } | 2527 virtual unsigned height() const { return 4; } |
2528 virtual unsigned planes() const { return 3; } | 2528 virtual unsigned planes() const { return 3; } |
2529 virtual int stride(unsigned plane) const { return 4; } | 2529 virtual int stride(unsigned plane) const { return 4; } |
2530 virtual const void* data(unsigned plane) const { return m_data; } | 2530 virtual const void* data(unsigned plane) const { return m_data; } |
2531 virtual unsigned textureId() const { return m_textureId; } | 2531 virtual unsigned textureId() const { return m_textureId; } |
2532 virtual unsigned textureTarget() const { return m_textureId ? GraphicsContex
t3D::TEXTURE_2D : 0; } | 2532 virtual unsigned textureTarget() const { return m_textureId ? GL_TEXTURE_2D
: 0; } |
2533 | 2533 |
2534 void setTextureId(unsigned id) { m_textureId = id; } | 2534 void setTextureId(unsigned id) { m_textureId = id; } |
2535 | 2535 |
2536 private: | 2536 private: |
2537 char m_data[16]; | 2537 char m_data[16]; |
2538 unsigned m_textureId; | 2538 unsigned m_textureId; |
2539 }; | 2539 }; |
2540 | 2540 |
2541 // Fake video frame provider that always provides the same FakeVideoFrame. | 2541 // Fake video frame provider that always provides the same FakeVideoFrame. |
2542 class FakeVideoFrameProvider: public WebVideoFrameProvider { | 2542 class FakeVideoFrameProvider: public WebVideoFrameProvider { |
(...skipping 13 matching lines...) Expand all Loading... |
2556 | 2556 |
2557 private: | 2557 private: |
2558 WebVideoFrame* m_frame; | 2558 WebVideoFrame* m_frame; |
2559 Client* m_client; | 2559 Client* m_client; |
2560 }; | 2560 }; |
2561 | 2561 |
2562 class StrictWebGraphicsContext3DWithIOSurface : public StrictWebGraphicsContext3
D { | 2562 class StrictWebGraphicsContext3DWithIOSurface : public StrictWebGraphicsContext3
D { |
2563 public: | 2563 public: |
2564 virtual WebString getString(WGC3Denum name) OVERRIDE | 2564 virtual WebString getString(WGC3Denum name) OVERRIDE |
2565 { | 2565 { |
2566 if (name == cc::GraphicsContext3D::EXTENSIONS) | 2566 if (name == GL_EXTENSIONS) |
2567 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); | 2567 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); |
2568 | 2568 |
2569 return WebString(); | 2569 return WebString(); |
2570 } | 2570 } |
2571 }; | 2571 }; |
2572 | 2572 |
2573 class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D { | 2573 class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D { |
2574 public: | 2574 public: |
2575 virtual WebString getString(WGC3Denum name) OVERRIDE | 2575 virtual WebString getString(WGC3Denum name) OVERRIDE |
2576 { | 2576 { |
2577 if (name == cc::GraphicsContext3D::EXTENSIONS) | 2577 if (name == GL_EXTENSIONS) |
2578 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); | 2578 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); |
2579 | 2579 |
2580 return WebString(); | 2580 return WebString(); |
2581 } | 2581 } |
2582 }; | 2582 }; |
2583 | 2583 |
2584 class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet
ry { | 2584 class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet
ry { |
2585 virtual WebRect trackRect(WebScrollbar*) OVERRIDE { return WebRect(0, 0, 10,
10); } | 2585 virtual WebRect trackRect(WebScrollbar*) OVERRIDE { return WebRect(0, 0, 10,
10); } |
2586 virtual WebRect thumbRect(WebScrollbar*) OVERRIDE { return WebRect(0, 5, 5,
2); } | 2586 virtual WebRect thumbRect(WebScrollbar*) OVERRIDE { return WebRect(0, 5, 5,
2); } |
2587 virtual void splitTrack(WebScrollbar*, const WebRect& track, WebRect& startT
rack, WebRect& thumb, WebRect& endTrack) OVERRIDE | 2587 virtual void splitTrack(WebScrollbar*, const WebRect& track, WebRect& startT
rack, WebRect& thumb, WebRect& endTrack) OVERRIDE |
2588 { | 2588 { |
2589 thumb = WebRect(0, 5, 5, 2); | 2589 thumb = WebRect(0, 5, 5, 2); |
2590 startTrack = WebRect(0, 5, 0, 5); | 2590 startTrack = WebRect(0, 5, 0, 5); |
2591 endTrack = WebRect(0, 0, 0, 5); | 2591 endTrack = WebRect(0, 0, 0, 5); |
2592 } | 2592 } |
2593 }; | 2593 }; |
2594 | 2594 |
2595 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { | 2595 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { |
2596 public: | 2596 public: |
2597 static scoped_ptr<FakeScrollbarLayerImpl> create(int id) | 2597 static scoped_ptr<FakeScrollbarLayerImpl> create(int id) |
2598 { | 2598 { |
2599 return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); | 2599 return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); |
2600 } | 2600 } |
2601 | 2601 |
2602 void createResources(CCResourceProvider* provider) | 2602 void createResources(CCResourceProvider* provider) |
2603 { | 2603 { |
2604 ASSERT(provider); | 2604 ASSERT(provider); |
2605 int pool = 0; | 2605 int pool = 0; |
2606 IntSize size(10, 10); | 2606 IntSize size(10, 10); |
2607 GC3Denum format = GraphicsContext3D::RGBA; | 2607 GLenum format = GL_RGBA; |
2608 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU
sageAny; | 2608 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU
sageAny; |
2609 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll
barThemeGeometryNonEmpty::create())); | 2609 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll
barThemeGeometryNonEmpty::create())); |
2610 | 2610 |
2611 setBackTrackResourceId(provider->createResource(pool, size, format, hint
)); | 2611 setBackTrackResourceId(provider->createResource(pool, size, format, hint
)); |
2612 setForeTrackResourceId(provider->createResource(pool, size, format, hint
)); | 2612 setForeTrackResourceId(provider->createResource(pool, size, format, hint
)); |
2613 setThumbResourceId(provider->createResource(pool, size, format, hint)); | 2613 setThumbResourceId(provider->createResource(pool, size, format, hint)); |
2614 } | 2614 } |
2615 | 2615 |
2616 protected: | 2616 protected: |
2617 explicit FakeScrollbarLayerImpl(int id) | 2617 explicit FakeScrollbarLayerImpl(int id) |
2618 : CCScrollbarLayerImpl(id) | 2618 : CCScrollbarLayerImpl(id) |
2619 { | 2619 { |
2620 } | 2620 } |
2621 }; | 2621 }; |
2622 | 2622 |
2623 static inline scoped_ptr<CCRenderPass> createRenderPassWithResource(CCResourcePr
ovider* provider) | 2623 static inline scoped_ptr<CCRenderPass> createRenderPassWithResource(CCResourcePr
ovider* provider) |
2624 { | 2624 { |
2625 CCResourceProvider::ResourceId resourceId = provider->createResource(0, IntS
ize(1, 1), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); | 2625 CCResourceProvider::ResourceId resourceId = provider->createResource(0, IntS
ize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny); |
2626 | 2626 |
2627 scoped_ptr<CCRenderPass> pass = CCRenderPass::create(CCRenderPass::Id(1, 1),
IntRect(0, 0, 1, 1), WebTransformationMatrix()); | 2627 scoped_ptr<CCRenderPass> pass = CCRenderPass::create(CCRenderPass::Id(1, 1),
IntRect(0, 0, 1, 1), WebTransformationMatrix()); |
2628 scoped_ptr<CCSharedQuadState> sharedState = CCSharedQuadState::create(WebTra
nsformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false); | 2628 scoped_ptr<CCSharedQuadState> sharedState = CCSharedQuadState::create(WebTra
nsformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false); |
2629 scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedState.g
et(), IntRect(0, 0, 1, 1), resourceId, false, FloatRect(0, 0, 1, 1), false); | 2629 scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedState.g
et(), IntRect(0, 0, 1, 1), resourceId, false, FloatRect(0, 0, 1, 1), false); |
2630 | 2630 |
2631 static_cast<CCTestRenderPass*>(pass.get())->appendSharedQuadState(sharedStat
e.Pass()); | 2631 static_cast<CCTestRenderPass*>(pass.get())->appendSharedQuadState(sharedStat
e.Pass()); |
2632 static_cast<CCTestRenderPass*>(pass.get())->appendQuad(quad.PassAs<CCDrawQua
d>()); | 2632 static_cast<CCTestRenderPass*>(pass.get())->appendQuad(quad.PassAs<CCDrawQua
d>()); |
2633 | 2633 |
2634 return pass.Pass(); | 2634 return pass.Pass(); |
2635 } | 2635 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 { | 2801 { |
2802 if (!m_textures.get(id)) | 2802 if (!m_textures.get(id)) |
2803 return; | 2803 return; |
2804 | 2804 |
2805 m_textures.set(id, false); | 2805 m_textures.set(id, false); |
2806 --m_numTextures; | 2806 --m_numTextures; |
2807 } | 2807 } |
2808 | 2808 |
2809 virtual WebString getString(WGC3Denum name) OVERRIDE | 2809 virtual WebString getString(WGC3Denum name) OVERRIDE |
2810 { | 2810 { |
2811 if (name == cc::GraphicsContext3D::EXTENSIONS) | 2811 if (name == GL_EXTENSIONS) |
2812 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); | 2812 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); |
2813 | 2813 |
2814 return WebString(); | 2814 return WebString(); |
2815 } | 2815 } |
2816 | 2816 |
2817 unsigned numTextures() const { return m_numTextures; } | 2817 unsigned numTextures() const { return m_numTextures; } |
2818 | 2818 |
2819 private: | 2819 private: |
2820 HashMap<WebGLId, bool> m_textures; | 2820 HashMap<WebGLId, bool> m_textures; |
2821 unsigned m_numTextures; | 2821 unsigned m_numTextures; |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4338 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4338 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
4339 testCaseIndex++; | 4339 testCaseIndex++; |
4340 } | 4340 } |
4341 } | 4341 } |
4342 | 4342 |
4343 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, | 4343 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, |
4344 CCLayerTreeHostImplTest, | 4344 CCLayerTreeHostImplTest, |
4345 ::testing::Values(false, true)); | 4345 ::testing::Values(false, true)); |
4346 | 4346 |
4347 } // namespace | 4347 } // namespace |
OLD | NEW |