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 "CCDelegatedRendererLayerImpl.h" | 9 #include "CCDelegatedRendererLayerImpl.h" |
10 #include "CCHeadsUpDisplayLayerImpl.h" | 10 #include "CCHeadsUpDisplayLayerImpl.h" |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 | 958 |
959 private: | 959 private: |
960 explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDr
aw, bool animating, CCResourceProvider* resourceProvider) | 960 explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDr
aw, bool animating, CCResourceProvider* resourceProvider) |
961 : DidDrawCheckLayer(id) | 961 : DidDrawCheckLayer(id) |
962 { | 962 { |
963 scoped_ptr<CCLayerTilingData> tilingData = CCLayerTilingData::create(Int
Size(10, 10), CCLayerTilingData::NoBorderTexels); | 963 scoped_ptr<CCLayerTilingData> tilingData = CCLayerTilingData::create(Int
Size(10, 10), CCLayerTilingData::NoBorderTexels); |
964 tilingData->setBounds(bounds()); | 964 tilingData->setBounds(bounds()); |
965 setTilingData(*tilingData.get()); | 965 setTilingData(*tilingData.get()); |
966 setSkipsDraw(skipsDraw); | 966 setSkipsDraw(skipsDraw); |
967 if (!tileMissing) { | 967 if (!tileMissing) { |
968 CCResourceProvider::ResourceId resource = resourceProvider->createRe
source(CCRenderer::ContentPool, IntSize(), GraphicsContext3D::RGBA, CCResourcePr
ovider::TextureUsageAny); | 968 CCResourceProvider::ResourceId resource = resourceProvider->createRe
source(CCRenderer::ContentPool, IntSize(), GL_RGBA, CCResourceProvider::TextureU
sageAny); |
969 pushTileProperties(0, 0, resource, IntRect()); | 969 pushTileProperties(0, 0, resource, IntRect()); |
970 } | 970 } |
971 if (animating) | 971 if (animating) |
972 addAnimatedTransformToLayer(*this, 10, 3, 0); | 972 addAnimatedTransformToLayer(*this, 10, 3, 0); |
973 } | 973 } |
974 }; | 974 }; |
975 | 975 |
976 TEST_P(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) | 976 TEST_P(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
977 { | 977 { |
978 // When the texture is not missing, we draw as usual. | 978 // When the texture is not missing, we draw as usual. |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 scrollInfo = m_hostImpl->processScrollDeltas(); | 1503 scrollInfo = m_hostImpl->processScrollDeltas(); |
1504 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScroll
Delta); | 1504 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScroll
Delta); |
1505 } | 1505 } |
1506 | 1506 |
1507 class BlendStateTrackerContext: public FakeWebGraphicsContext3D { | 1507 class BlendStateTrackerContext: public FakeWebGraphicsContext3D { |
1508 public: | 1508 public: |
1509 BlendStateTrackerContext() : m_blend(false) { } | 1509 BlendStateTrackerContext() : m_blend(false) { } |
1510 | 1510 |
1511 virtual void enable(WGC3Denum cap) | 1511 virtual void enable(WGC3Denum cap) |
1512 { | 1512 { |
1513 if (cap == GraphicsContext3D::BLEND) | 1513 if (cap == GL_BLEND) |
1514 m_blend = true; | 1514 m_blend = true; |
1515 } | 1515 } |
1516 | 1516 |
1517 virtual void disable(WGC3Denum cap) | 1517 virtual void disable(WGC3Denum cap) |
1518 { | 1518 { |
1519 if (cap == GraphicsContext3D::BLEND) | 1519 if (cap == GL_BLEND) |
1520 m_blend = false; | 1520 m_blend = false; |
1521 } | 1521 } |
1522 | 1522 |
1523 bool blend() const { return m_blend; } | 1523 bool blend() const { return m_blend; } |
1524 | 1524 |
1525 private: | 1525 private: |
1526 bool m_blend; | 1526 bool m_blend; |
1527 }; | 1527 }; |
1528 | 1528 |
1529 class BlendStateCheckLayer : public CCLayerImpl { | 1529 class BlendStateCheckLayer : public CCLayerImpl { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect;
} | 1562 void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect;
} |
1563 | 1563 |
1564 private: | 1564 private: |
1565 explicit BlendStateCheckLayer(int id, CCResourceProvider* resourceProvider) | 1565 explicit BlendStateCheckLayer(int id, CCResourceProvider* resourceProvider) |
1566 : CCLayerImpl(id) | 1566 : CCLayerImpl(id) |
1567 , m_blend(false) | 1567 , m_blend(false) |
1568 , m_hasRenderSurface(false) | 1568 , m_hasRenderSurface(false) |
1569 , m_quadsAppended(false) | 1569 , m_quadsAppended(false) |
1570 , m_quadRect(5, 5, 5, 5) | 1570 , m_quadRect(5, 5, 5, 5) |
1571 , m_quadVisibleRect(5, 5, 5, 5) | 1571 , m_quadVisibleRect(5, 5, 5, 5) |
1572 , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool,
IntSize(1, 1), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) | 1572 , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool,
IntSize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny)) |
1573 { | 1573 { |
1574 setAnchorPoint(FloatPoint(0, 0)); | 1574 setAnchorPoint(FloatPoint(0, 0)); |
1575 setBounds(IntSize(10, 10)); | 1575 setBounds(IntSize(10, 10)); |
1576 setContentBounds(IntSize(10, 10)); | 1576 setContentBounds(IntSize(10, 10)); |
1577 setDrawsContent(true); | 1577 setDrawsContent(true); |
1578 } | 1578 } |
1579 | 1579 |
1580 bool m_blend; | 1580 bool m_blend; |
1581 bool m_hasRenderSurface; | 1581 bool m_hasRenderSurface; |
1582 bool m_quadsAppended; | 1582 bool m_quadsAppended; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 | 1911 |
1912 class PartialSwapTrackerContext : public FakeWebGraphicsContext3D { | 1912 class PartialSwapTrackerContext : public FakeWebGraphicsContext3D { |
1913 public: | 1913 public: |
1914 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) | 1914 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) |
1915 { | 1915 { |
1916 m_partialSwapRect = IntRect(x, y, width, height); | 1916 m_partialSwapRect = IntRect(x, y, width, height); |
1917 } | 1917 } |
1918 | 1918 |
1919 virtual WebString getString(WGC3Denum name) | 1919 virtual WebString getString(WGC3Denum name) |
1920 { | 1920 { |
1921 if (name == GraphicsContext3D::EXTENSIONS) | 1921 if (name == GL_EXTENSIONS) |
1922 return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibi
lity"); | 1922 return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibi
lity"); |
1923 | 1923 |
1924 return WebString(); | 1924 return WebString(); |
1925 } | 1925 } |
1926 | 1926 |
1927 IntRect partialSwapRect() const { return m_partialSwapRect; } | 1927 IntRect partialSwapRect() const { return m_partialSwapRect; } |
1928 | 1928 |
1929 private: | 1929 private: |
1930 IntRect m_partialSwapRect; | 1930 IntRect m_partialSwapRect; |
1931 }; | 1931 }; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 .WillRepeatedly(Return()); | 2088 .WillRepeatedly(Return()); |
2089 | 2089 |
2090 EXPECT_CALL(*m_context, uniform4f(_, _, _, _, _)) | 2090 EXPECT_CALL(*m_context, uniform4f(_, _, _, _, _)) |
2091 .WillRepeatedly(Return()); | 2091 .WillRepeatedly(Return()); |
2092 | 2092 |
2093 // Any other strings are empty | 2093 // Any other strings are empty |
2094 EXPECT_CALL(*m_context, getString(_)) | 2094 EXPECT_CALL(*m_context, getString(_)) |
2095 .WillRepeatedly(Return(WebString())); | 2095 .WillRepeatedly(Return(WebString())); |
2096 | 2096 |
2097 // Support for partial swap, if needed | 2097 // Support for partial swap, if needed |
2098 EXPECT_CALL(*m_context, getString(GraphicsContext3D::EXTENSIONS)) | 2098 EXPECT_CALL(*m_context, getString(GL_EXTENSIONS)) |
2099 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); | 2099 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); |
2100 | 2100 |
2101 EXPECT_CALL(*m_context, getRequestableExtensionsCHROMIUM()) | 2101 EXPECT_CALL(*m_context, getRequestableExtensionsCHROMIUM()) |
2102 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); | 2102 .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); |
2103 | 2103 |
2104 // Any un-sanctioned calls to enable() are OK | 2104 // Any un-sanctioned calls to enable() are OK |
2105 EXPECT_CALL(*m_context, enable(_)) | 2105 EXPECT_CALL(*m_context, enable(_)) |
2106 .WillRepeatedly(Return()); | 2106 .WillRepeatedly(Return()); |
2107 | 2107 |
2108 // Any un-sanctioned calls to disable() are OK | 2108 // Any un-sanctioned calls to disable() are OK |
2109 EXPECT_CALL(*m_context, disable(_)) | 2109 EXPECT_CALL(*m_context, disable(_)) |
2110 .WillRepeatedly(Return()); | 2110 .WillRepeatedly(Return()); |
2111 } | 2111 } |
2112 | 2112 |
2113 void mustDrawSolidQuad() | 2113 void mustDrawSolidQuad() |
2114 { | 2114 { |
2115 EXPECT_CALL(*m_context, drawElements(GraphicsContext3D::TRIANGLES, 6, Gr
aphicsContext3D::UNSIGNED_SHORT, 0)) | 2115 EXPECT_CALL(*m_context, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT,
0)) |
2116 .WillOnce(Return()) | 2116 .WillOnce(Return()) |
2117 .RetiresOnSaturation(); | 2117 .RetiresOnSaturation(); |
2118 | 2118 |
2119 // 1 is hardcoded return value of fake createProgram() | 2119 // 1 is hardcoded return value of fake createProgram() |
2120 EXPECT_CALL(*m_context, useProgram(1)) | 2120 EXPECT_CALL(*m_context, useProgram(1)) |
2121 .WillOnce(Return()) | 2121 .WillOnce(Return()) |
2122 .RetiresOnSaturation(); | 2122 .RetiresOnSaturation(); |
2123 | 2123 |
2124 } | 2124 } |
2125 | 2125 |
2126 void mustSetScissor(int x, int y, int width, int height) | 2126 void mustSetScissor(int x, int y, int width, int height) |
2127 { | 2127 { |
2128 EXPECT_CALL(*m_context, enable(GraphicsContext3D::SCISSOR_TEST)) | 2128 EXPECT_CALL(*m_context, enable(GL_SCISSOR_TEST)) |
2129 .WillRepeatedly(Return()); | 2129 .WillRepeatedly(Return()); |
2130 | 2130 |
2131 EXPECT_CALL(*m_context, scissor(x, y, width, height)) | 2131 EXPECT_CALL(*m_context, scissor(x, y, width, height)) |
2132 .Times(AtLeast(1)) | 2132 .Times(AtLeast(1)) |
2133 .WillRepeatedly(Return()); | 2133 .WillRepeatedly(Return()); |
2134 } | 2134 } |
2135 | 2135 |
2136 void mustSetNoScissor() | 2136 void mustSetNoScissor() |
2137 { | 2137 { |
2138 EXPECT_CALL(*m_context, disable(GraphicsContext3D::SCISSOR_TEST)) | 2138 EXPECT_CALL(*m_context, disable(GL_SCISSOR_TEST)) |
2139 .WillRepeatedly(Return()); | 2139 .WillRepeatedly(Return()); |
2140 | 2140 |
2141 EXPECT_CALL(*m_context, enable(GraphicsContext3D::SCISSOR_TEST)) | 2141 EXPECT_CALL(*m_context, enable(GL_SCISSOR_TEST)) |
2142 .Times(0); | 2142 .Times(0); |
2143 | 2143 |
2144 EXPECT_CALL(*m_context, scissor(_, _, _, _)) | 2144 EXPECT_CALL(*m_context, scissor(_, _, _, _)) |
2145 .Times(0); | 2145 .Times(0); |
2146 } | 2146 } |
2147 }; | 2147 }; |
2148 | 2148 |
2149 TEST_P(CCLayerTreeHostImplTest, noPartialSwap) | 2149 TEST_P(CCLayerTreeHostImplTest, noPartialSwap) |
2150 { | 2150 { |
2151 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<CCGraphicsContext>(
); | 2151 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<CCGraphicsContext>(
); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2196 myHostImpl->drawLayers(frame); | 2196 myHostImpl->drawLayers(frame); |
2197 myHostImpl->didDrawAllLayers(frame); | 2197 myHostImpl->didDrawAllLayers(frame); |
2198 } | 2198 } |
2199 Mock::VerifyAndClearExpectations(&mockContext); | 2199 Mock::VerifyAndClearExpectations(&mockContext); |
2200 } | 2200 } |
2201 | 2201 |
2202 class PartialSwapContext : public FakeWebGraphicsContext3D { | 2202 class PartialSwapContext : public FakeWebGraphicsContext3D { |
2203 public: | 2203 public: |
2204 WebString getString(WGC3Denum name) | 2204 WebString getString(WGC3Denum name) |
2205 { | 2205 { |
2206 if (name == GraphicsContext3D::EXTENSIONS) | 2206 if (name == GL_EXTENSIONS) |
2207 return WebString("GL_CHROMIUM_post_sub_buffer"); | 2207 return WebString("GL_CHROMIUM_post_sub_buffer"); |
2208 return WebString(); | 2208 return WebString(); |
2209 } | 2209 } |
2210 | 2210 |
2211 WebString getRequestableExtensionsCHROMIUM() | 2211 WebString getRequestableExtensionsCHROMIUM() |
2212 { | 2212 { |
2213 return WebString("GL_CHROMIUM_post_sub_buffer"); | 2213 return WebString("GL_CHROMIUM_post_sub_buffer"); |
2214 } | 2214 } |
2215 | 2215 |
2216 // Unlimited texture size. | 2216 // Unlimited texture size. |
2217 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) | 2217 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) |
2218 { | 2218 { |
2219 if (pname == cc::GraphicsContext3D::MAX_TEXTURE_SIZE) | 2219 if (pname == GL_MAX_TEXTURE_SIZE) |
2220 *value = 8192; | 2220 *value = 8192; |
2221 } | 2221 } |
2222 }; | 2222 }; |
2223 | 2223 |
2224 static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) | 2224 static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) |
2225 { | 2225 { |
2226 CCSettings::setPartialSwapEnabled(partialSwap); | 2226 CCSettings::setPartialSwapEnabled(partialSwap); |
2227 | 2227 |
2228 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGr
aphicsContext>(); | 2228 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGr
aphicsContext>(); |
2229 | 2229 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 public: | 2537 public: |
2538 FakeVideoFrame() : m_textureId(0) { memset(m_data, 0x80, sizeof(m_data)); } | 2538 FakeVideoFrame() : m_textureId(0) { memset(m_data, 0x80, sizeof(m_data)); } |
2539 virtual ~FakeVideoFrame() { } | 2539 virtual ~FakeVideoFrame() { } |
2540 virtual Format format() const { return m_textureId ? FormatNativeTexture : F
ormatYV12; } | 2540 virtual Format format() const { return m_textureId ? FormatNativeTexture : F
ormatYV12; } |
2541 virtual unsigned width() const { return 4; } | 2541 virtual unsigned width() const { return 4; } |
2542 virtual unsigned height() const { return 4; } | 2542 virtual unsigned height() const { return 4; } |
2543 virtual unsigned planes() const { return 3; } | 2543 virtual unsigned planes() const { return 3; } |
2544 virtual int stride(unsigned plane) const { return 4; } | 2544 virtual int stride(unsigned plane) const { return 4; } |
2545 virtual const void* data(unsigned plane) const { return m_data; } | 2545 virtual const void* data(unsigned plane) const { return m_data; } |
2546 virtual unsigned textureId() const { return m_textureId; } | 2546 virtual unsigned textureId() const { return m_textureId; } |
2547 virtual unsigned textureTarget() const { return m_textureId ? GraphicsContex
t3D::TEXTURE_2D : 0; } | 2547 virtual unsigned textureTarget() const { return m_textureId ? GL_TEXTURE_2D
: 0; } |
2548 | 2548 |
2549 void setTextureId(unsigned id) { m_textureId = id; } | 2549 void setTextureId(unsigned id) { m_textureId = id; } |
2550 | 2550 |
2551 private: | 2551 private: |
2552 char m_data[16]; | 2552 char m_data[16]; |
2553 unsigned m_textureId; | 2553 unsigned m_textureId; |
2554 }; | 2554 }; |
2555 | 2555 |
2556 // Fake video frame provider that always provides the same FakeVideoFrame. | 2556 // Fake video frame provider that always provides the same FakeVideoFrame. |
2557 class FakeVideoFrameProvider: public WebVideoFrameProvider { | 2557 class FakeVideoFrameProvider: public WebVideoFrameProvider { |
(...skipping 13 matching lines...) Expand all Loading... |
2571 | 2571 |
2572 private: | 2572 private: |
2573 WebVideoFrame* m_frame; | 2573 WebVideoFrame* m_frame; |
2574 Client* m_client; | 2574 Client* m_client; |
2575 }; | 2575 }; |
2576 | 2576 |
2577 class StrictWebGraphicsContext3DWithIOSurface : public StrictWebGraphicsContext3
D { | 2577 class StrictWebGraphicsContext3DWithIOSurface : public StrictWebGraphicsContext3
D { |
2578 public: | 2578 public: |
2579 virtual WebString getString(WGC3Denum name) OVERRIDE | 2579 virtual WebString getString(WGC3Denum name) OVERRIDE |
2580 { | 2580 { |
2581 if (name == cc::GraphicsContext3D::EXTENSIONS) | 2581 if (name == GL_EXTENSIONS) |
2582 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); | 2582 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); |
2583 | 2583 |
2584 return WebString(); | 2584 return WebString(); |
2585 } | 2585 } |
2586 }; | 2586 }; |
2587 | 2587 |
2588 class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D { | 2588 class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D { |
2589 public: | 2589 public: |
2590 virtual WebString getString(WGC3Denum name) OVERRIDE | 2590 virtual WebString getString(WGC3Denum name) OVERRIDE |
2591 { | 2591 { |
2592 if (name == cc::GraphicsContext3D::EXTENSIONS) | 2592 if (name == GL_EXTENSIONS) |
2593 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); | 2593 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); |
2594 | 2594 |
2595 return WebString(); | 2595 return WebString(); |
2596 } | 2596 } |
2597 }; | 2597 }; |
2598 | 2598 |
2599 class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet
ry { | 2599 class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet
ry { |
2600 virtual WebRect trackRect(WebScrollbar*) OVERRIDE { return WebRect(0, 0, 10,
10); } | 2600 virtual WebRect trackRect(WebScrollbar*) OVERRIDE { return WebRect(0, 0, 10,
10); } |
2601 virtual WebRect thumbRect(WebScrollbar*) OVERRIDE { return WebRect(0, 5, 5,
2); } | 2601 virtual WebRect thumbRect(WebScrollbar*) OVERRIDE { return WebRect(0, 5, 5,
2); } |
2602 virtual void splitTrack(WebScrollbar*, const WebRect& track, WebRect& startT
rack, WebRect& thumb, WebRect& endTrack) OVERRIDE | 2602 virtual void splitTrack(WebScrollbar*, const WebRect& track, WebRect& startT
rack, WebRect& thumb, WebRect& endTrack) OVERRIDE |
2603 { | 2603 { |
2604 thumb = WebRect(0, 5, 5, 2); | 2604 thumb = WebRect(0, 5, 5, 2); |
2605 startTrack = WebRect(0, 5, 0, 5); | 2605 startTrack = WebRect(0, 5, 0, 5); |
2606 endTrack = WebRect(0, 0, 0, 5); | 2606 endTrack = WebRect(0, 0, 0, 5); |
2607 } | 2607 } |
2608 }; | 2608 }; |
2609 | 2609 |
2610 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { | 2610 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { |
2611 public: | 2611 public: |
2612 static scoped_ptr<FakeScrollbarLayerImpl> create(int id) | 2612 static scoped_ptr<FakeScrollbarLayerImpl> create(int id) |
2613 { | 2613 { |
2614 return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); | 2614 return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); |
2615 } | 2615 } |
2616 | 2616 |
2617 void createResources(CCResourceProvider* provider) | 2617 void createResources(CCResourceProvider* provider) |
2618 { | 2618 { |
2619 DCHECK(provider); | 2619 DCHECK(provider); |
2620 int pool = 0; | 2620 int pool = 0; |
2621 IntSize size(10, 10); | 2621 IntSize size(10, 10); |
2622 GC3Denum format = GraphicsContext3D::RGBA; | 2622 GLenum format = GL_RGBA; |
2623 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU
sageAny; | 2623 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU
sageAny; |
2624 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll
barThemeGeometryNonEmpty::create())); | 2624 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll
barThemeGeometryNonEmpty::create())); |
2625 | 2625 |
2626 setBackTrackResourceId(provider->createResource(pool, size, format, hint
)); | 2626 setBackTrackResourceId(provider->createResource(pool, size, format, hint
)); |
2627 setForeTrackResourceId(provider->createResource(pool, size, format, hint
)); | 2627 setForeTrackResourceId(provider->createResource(pool, size, format, hint
)); |
2628 setThumbResourceId(provider->createResource(pool, size, format, hint)); | 2628 setThumbResourceId(provider->createResource(pool, size, format, hint)); |
2629 } | 2629 } |
2630 | 2630 |
2631 protected: | 2631 protected: |
2632 explicit FakeScrollbarLayerImpl(int id) | 2632 explicit FakeScrollbarLayerImpl(int id) |
2633 : CCScrollbarLayerImpl(id) | 2633 : CCScrollbarLayerImpl(id) |
2634 { | 2634 { |
2635 } | 2635 } |
2636 }; | 2636 }; |
2637 | 2637 |
2638 static inline scoped_ptr<CCRenderPass> createRenderPassWithResource(CCResourcePr
ovider* provider) | 2638 static inline scoped_ptr<CCRenderPass> createRenderPassWithResource(CCResourcePr
ovider* provider) |
2639 { | 2639 { |
2640 CCResourceProvider::ResourceId resourceId = provider->createResource(0, IntS
ize(1, 1), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); | 2640 CCResourceProvider::ResourceId resourceId = provider->createResource(0, IntS
ize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny); |
2641 | 2641 |
2642 scoped_ptr<CCRenderPass> pass = CCRenderPass::create(CCRenderPass::Id(1, 1),
IntRect(0, 0, 1, 1), WebTransformationMatrix()); | 2642 scoped_ptr<CCRenderPass> pass = CCRenderPass::create(CCRenderPass::Id(1, 1),
IntRect(0, 0, 1, 1), WebTransformationMatrix()); |
2643 scoped_ptr<CCSharedQuadState> sharedState = CCSharedQuadState::create(WebTra
nsformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false); | 2643 scoped_ptr<CCSharedQuadState> sharedState = CCSharedQuadState::create(WebTra
nsformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false); |
2644 scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedState.g
et(), IntRect(0, 0, 1, 1), resourceId, false, FloatRect(0, 0, 1, 1), false); | 2644 scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedState.g
et(), IntRect(0, 0, 1, 1), resourceId, false, FloatRect(0, 0, 1, 1), false); |
2645 | 2645 |
2646 static_cast<CCTestRenderPass*>(pass.get())->appendSharedQuadState(sharedStat
e.Pass()); | 2646 static_cast<CCTestRenderPass*>(pass.get())->appendSharedQuadState(sharedStat
e.Pass()); |
2647 static_cast<CCTestRenderPass*>(pass.get())->appendQuad(quad.PassAs<CCDrawQua
d>()); | 2647 static_cast<CCTestRenderPass*>(pass.get())->appendQuad(quad.PassAs<CCDrawQua
d>()); |
2648 | 2648 |
2649 return pass.Pass(); | 2649 return pass.Pass(); |
2650 } | 2650 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 { | 2816 { |
2817 if (m_textures.find(id) == m_textures.end()) | 2817 if (m_textures.find(id) == m_textures.end()) |
2818 return; | 2818 return; |
2819 | 2819 |
2820 m_textures[id] = false; | 2820 m_textures[id] = false; |
2821 --m_numTextures; | 2821 --m_numTextures; |
2822 } | 2822 } |
2823 | 2823 |
2824 virtual WebString getString(WGC3Denum name) OVERRIDE | 2824 virtual WebString getString(WGC3Denum name) OVERRIDE |
2825 { | 2825 { |
2826 if (name == cc::GraphicsContext3D::EXTENSIONS) | 2826 if (name == GL_EXTENSIONS) |
2827 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); | 2827 return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); |
2828 | 2828 |
2829 return WebString(); | 2829 return WebString(); |
2830 } | 2830 } |
2831 | 2831 |
2832 unsigned numTextures() const { return m_numTextures; } | 2832 unsigned numTextures() const { return m_numTextures; } |
2833 | 2833 |
2834 private: | 2834 private: |
2835 base::hash_map<WebGLId, bool> m_textures; | 2835 base::hash_map<WebGLId, bool> m_textures; |
2836 unsigned m_numTextures; | 2836 unsigned m_numTextures; |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4374 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4374 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
4375 testCaseIndex++; | 4375 testCaseIndex++; |
4376 } | 4376 } |
4377 } | 4377 } |
4378 | 4378 |
4379 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, | 4379 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, |
4380 CCLayerTreeHostImplTest, | 4380 CCLayerTreeHostImplTest, |
4381 ::testing::Values(false, true)); | 4381 ::testing::Values(false, true)); |
4382 | 4382 |
4383 } // namespace | 4383 } // namespace |
OLD | NEW |