diff options
33 files changed, 203 insertions, 206 deletions
diff --git a/cc/animation_curve.h b/cc/animation_curve.h index 50dde07..386d703 100644 --- a/cc/animation_curve.h +++ b/cc/animation_curve.h @@ -12,7 +12,6 @@ namespace cc { class FloatAnimationCurve; class TransformAnimationCurve; -class IntSize; class TransformOperations; // An animation curve is a function that returns a value given a time. diff --git a/cc/draw_quad_unittest.cc b/cc/draw_quad_unittest.cc index 9cc99c1..9b86791 100644 --- a/cc/draw_quad_unittest.cc +++ b/cc/draw_quad_unittest.cc @@ -280,19 +280,19 @@ TEST(DrawQuadTest, copyYUVVideoDrawQuad) { VideoLayerImpl::FramePlane yPlane; yPlane.resourceId = 45; - yPlane.size = IntSize(34, 23); + yPlane.size = gfx::Size(34, 23); yPlane.format = 8; - yPlane.visibleSize = IntSize(623, 235); + yPlane.visibleSize = gfx::Size(623, 235); VideoLayerImpl::FramePlane uPlane; uPlane.resourceId = 532; - uPlane.size = IntSize(134, 16); + uPlane.size = gfx::Size(134, 16); uPlane.format = 2; - uPlane.visibleSize = IntSize(126, 27); + uPlane.visibleSize = gfx::Size(126, 27); VideoLayerImpl::FramePlane vPlane; vPlane.resourceId = 4; - vPlane.size = IntSize(456, 486); + vPlane.size = gfx::Size(456, 486); vPlane.format = 46; - vPlane.visibleSize = IntSize(19, 45); + vPlane.visibleSize = gfx::Size(19, 45); CREATE_SHARED_STATE(); CREATE_QUAD_3(YUVVideoDrawQuad, yPlane, uPlane, vPlane); diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc index e760587..e9215ba 100644 --- a/cc/gl_renderer.cc +++ b/cc/gl_renderer.cc @@ -373,7 +373,7 @@ static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilte renderer->context()->flush(); ResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourceTexture->id()); - SkBitmap source = RenderSurfaceFilters::apply(filters, lock.textureId(), cc::IntSize(sourceTexture->size()), filterContext, filterGrContext); + SkBitmap source = RenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext); return source; } @@ -477,7 +477,7 @@ scoped_ptr<ScopedTexture> GLRenderer::drawBackgroundFilters(DrawingFrame& frame, int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); scoped_ptr<ScopedTexture> backgroundTexture = ScopedTexture::create(m_resourceProvider); - if (!backgroundTexture->allocate(Renderer::ImplPool, cc::IntSize(quad->quadRect().size()), GL_RGBA, ResourceProvider::TextureUsageFramebuffer)) + if (!backgroundTexture->allocate(Renderer::ImplPool, quad->quadRect().size(), GL_RGBA, ResourceProvider::TextureUsageFramebuffer)) return scoped_ptr<ScopedTexture>(); const RenderPass* targetRenderPass = frame.currentRenderPass; diff --git a/cc/heads_up_display_layer.cc b/cc/heads_up_display_layer.cc index 4be91ce..2e46740 100644 --- a/cc/heads_up_display_layer.cc +++ b/cc/heads_up_display_layer.cc @@ -21,7 +21,7 @@ HeadsUpDisplayLayer::HeadsUpDisplayLayer() : Layer() { - setBounds(IntSize(512, 128)); + setBounds(gfx::Size(512, 128)); } HeadsUpDisplayLayer::~HeadsUpDisplayLayer() @@ -33,13 +33,13 @@ void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, const LayerTreeSettings& settings = layerTreeHost()->settings(); int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; - IntSize bounds; + gfx::Size bounds; if (settings.showPlatformLayerTree || settings.showDebugRects()) { - bounds.setWidth(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().width())); - bounds.setHeight(std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().height())); + int width = std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().width()); + int height = std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().height()); + bounds = gfx::Size(width, height); } else { - bounds.setWidth(512); - bounds.setHeight(128); + bounds = gfx::Size(512, 128); } setBounds(bounds); diff --git a/cc/heads_up_display_layer.h b/cc/heads_up_display_layer.h index 7c6061d..dc7b814 100644 --- a/cc/heads_up_display_layer.h +++ b/cc/heads_up_display_layer.h @@ -5,7 +5,6 @@ #ifndef HeadsUpDisplayLayerChromium_h #define HeadsUpDisplayLayerChromium_h -#include "IntSize.h" #include "base/memory/scoped_ptr.h" #include "cc/font_atlas.h" #include "cc/layer.h" diff --git a/cc/heads_up_display_unittest.cc b/cc/heads_up_display_unittest.cc index 5603fc6..2433983 100644 --- a/cc/heads_up_display_unittest.cc +++ b/cc/heads_up_display_unittest.cc @@ -46,8 +46,8 @@ public: virtual void beginTest() OVERRIDE { - m_rootLayer1->setBounds(IntSize(30, 30)); - m_rootLayer2->setBounds(IntSize(30, 30)); + m_rootLayer1->setBounds(gfx::Size(30, 30)); + m_rootLayer2->setBounds(gfx::Size(30, 30)); postSetNeedsCommitToMainThread(); } diff --git a/cc/input_handler.h b/cc/input_handler.h index def6c39..0e27bad 100644 --- a/cc/input_handler.h +++ b/cc/input_handler.h @@ -8,6 +8,10 @@ #include "base/basictypes.h" #include "base/time.h" +namespace gfx { +class Point; +} + namespace cc { class IntPoint; @@ -31,7 +35,7 @@ public: // can be scrolled, ScrollOnMainThread if the scroll event should instead be // delegated to the main thread, or ScrollIgnored if there is nothing to be // scrolled at the given coordinates. - virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0; + virtual ScrollStatus scrollBegin(const gfx::Point&, ScrollInputType) = 0; // Scroll the selected layer starting at the given position. If the scroll // type given to scrollBegin was a gesture, then the scroll point and delta @@ -40,7 +44,7 @@ public: // layer in the requested direction, its first ancestor layer that can be // scrolled will be moved instead. Should only be called if scrollBegin() // returned ScrollStarted. - virtual void scrollBy(const IntPoint&, const IntSize&) = 0; + virtual void scrollBy(const gfx::Point&, const IntSize&) = 0; // Stop scrolling the selected layer. Should only be called if scrollBegin() // returned ScrollStarted. diff --git a/cc/io_surface_layer.cc b/cc/io_surface_layer.cc index 786a632..a1f3bb8 100644 --- a/cc/io_surface_layer.cc +++ b/cc/io_surface_layer.cc @@ -25,7 +25,7 @@ IOSurfaceLayer::~IOSurfaceLayer() { } -void IOSurfaceLayer::setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize& size) +void IOSurfaceLayer::setIOSurfaceProperties(uint32_t ioSurfaceId, const gfx::Size& size) { m_ioSurfaceId = ioSurfaceId; m_ioSurfaceSize = size; @@ -46,8 +46,8 @@ void IOSurfaceLayer::pushPropertiesTo(LayerImpl* layer) { Layer::pushPropertiesTo(layer); - IOSurfaceLayerImpl* textureLayer = static_cast<IOSurfaceLayerImpl*>(layer); - textureLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize); + IOSurfaceLayerImpl* ioSurfaceLayer = static_cast<IOSurfaceLayerImpl*>(layer); + ioSurfaceLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize); } } diff --git a/cc/io_surface_layer.h b/cc/io_surface_layer.h index 9d728a0..8045b85 100644 --- a/cc/io_surface_layer.h +++ b/cc/io_surface_layer.h @@ -13,7 +13,7 @@ class IOSurfaceLayer : public Layer { public: static scoped_refptr<IOSurfaceLayer> create(); - void setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize&); + void setIOSurfaceProperties(uint32_t ioSurfaceId, const gfx::Size&); virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; virtual bool drawsContent() const OVERRIDE; @@ -26,7 +26,7 @@ private: virtual ~IOSurfaceLayer(); uint32_t m_ioSurfaceId; - IntSize m_ioSurfaceSize; + gfx::Size m_ioSurfaceSize; }; } diff --git a/cc/layer_animation_controller.h b/cc/layer_animation_controller.h index 25e4c58..b3c08e8 100644 --- a/cc/layer_animation_controller.h +++ b/cc/layer_animation_controller.h @@ -19,7 +19,6 @@ class WebTransformationMatrix; namespace cc { class Animation; -class IntSize; class KeyframeValueList; class LayerAnimationControllerClient { diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index 69a7b64..54e45fad 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -198,7 +198,7 @@ FloatSize LayerImpl::scrollBy(const FloatSize& scroll) return unscrolled; } -InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const gfx::Point& screenSpacePoint, InputHandlerClient::ScrollInputType type) const +InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const gfx::PointF& screenSpacePoint, InputHandlerClient::ScrollInputType type) const { if (shouldScrollOnMainThread()) { TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed shouldScrollOnMainThread"); @@ -212,7 +212,7 @@ InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const gfx::Point& screenSp if (!nonFastScrollableRegion().IsEmpty()) { bool clipped = false; - gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(screenSpaceTransform().inverse(), gfx::PointF(screenSpacePoint), clipped); + gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(screenSpaceTransform().inverse(), screenSpacePoint, clipped); if (!clipped && nonFastScrollableRegion().Contains(gfx::ToFlooredPoint(hitTestPointInLocalSpace))) { TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed nonFastScrollableRegion"); return InputHandlerClient::ScrollOnMainThread; diff --git a/cc/layer_impl.h b/cc/layer_impl.h index 2974808..f9d50ce 100644 --- a/cc/layer_impl.h +++ b/cc/layer_impl.h @@ -217,7 +217,7 @@ public: void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerboardForMissingTiles = checkerboard; } bool drawCheckerboardForMissingTiles() const; - InputHandlerClient::ScrollStatus tryScroll(const gfx::Point& viewportPoint, InputHandlerClient::ScrollInputType) const; + InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoint, InputHandlerClient::ScrollInputType) const; const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleContentRect = visibleContentRect; } diff --git a/cc/layer_quad_unittest.cc b/cc/layer_quad_unittest.cc index 137d179..8aa9adb 100644 --- a/cc/layer_quad_unittest.cc +++ b/cc/layer_quad_unittest.cc @@ -14,10 +14,10 @@ namespace { TEST(LayerQuadTest, FloatQuadConversion) { - FloatPoint p1(-0.5, -0.5); - FloatPoint p2( 0.5, -0.5); - FloatPoint p3( 0.5, 0.5); - FloatPoint p4(-0.5, 0.5); + gfx::PointF p1(-0.5, -0.5); + gfx::PointF p2( 0.5, -0.5); + gfx::PointF p3( 0.5, 0.5); + gfx::PointF p4(-0.5, 0.5); FloatQuad quadCW(p1, p2, p3, p4); LayerQuad layerQuadCW(quadCW); @@ -30,10 +30,10 @@ TEST(LayerQuadTest, FloatQuadConversion) TEST(LayerQuadTest, Inflate) { - FloatPoint p1(-0.5, -0.5); - FloatPoint p2( 0.5, -0.5); - FloatPoint p3( 0.5, 0.5); - FloatPoint p4(-0.5, 0.5); + gfx::PointF p1(-0.5, -0.5); + gfx::PointF p2( 0.5, -0.5); + gfx::PointF p3( 0.5, 0.5); + gfx::PointF p4(-0.5, 0.5); FloatQuad quad(p1, p2, p3, p4); LayerQuad layerQuad(quad); diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc index 2a41e85..6c54fc5 100644 --- a/cc/layer_sorter_unittest.cc +++ b/cc/layer_sorter_unittest.cc @@ -214,28 +214,28 @@ TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) WebTransformationMatrix FrontMatrix; FrontMatrix.translate3d(0, 0, 1); - layer1->setBounds(IntSize(10, 10)); - layer1->setContentBounds(IntSize(10, 10)); + layer1->setBounds(gfx::Size(10, 10)); + layer1->setContentBounds(gfx::Size(10, 10)); layer1->setDrawTransform(BehindMatrix); layer1->setDrawsContent(true); - layer2->setBounds(IntSize(20, 20)); - layer2->setContentBounds(IntSize(20, 20)); + layer2->setBounds(gfx::Size(20, 20)); + layer2->setContentBounds(gfx::Size(20, 20)); layer2->setDrawTransform(BehindMatrix); layer2->setDrawsContent(true); - layer3->setBounds(IntSize(30, 30)); - layer3->setContentBounds(IntSize(30, 30)); + layer3->setBounds(gfx::Size(30, 30)); + layer3->setContentBounds(gfx::Size(30, 30)); layer3->setDrawTransform(FrontMatrix); layer3->setDrawsContent(true); - layer4->setBounds(IntSize(40, 40)); - layer4->setContentBounds(IntSize(40, 40)); + layer4->setBounds(gfx::Size(40, 40)); + layer4->setContentBounds(gfx::Size(40, 40)); layer4->setDrawTransform(FrontMatrix); layer4->setDrawsContent(true); - layer5->setBounds(IntSize(50, 50)); - layer5->setContentBounds(IntSize(50, 50)); + layer5->setBounds(gfx::Size(50, 50)); + layer5->setContentBounds(gfx::Size(50, 50)); layer5->setDrawTransform(BehindMatrix); layer5->setDrawsContent(true); diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc index e3d4f08..a119b89 100644 --- a/cc/layer_tree_host_common.cc +++ b/cc/layer_tree_host_common.cc @@ -859,7 +859,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const gf DCHECK(rootLayer->renderSurface()); } -static bool pointHitsRect(const gfx::Point& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect) +static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect) { // If the transform is not invertible, then assume that this point doesn't hit this rect. if (!localSpaceToScreenSpaceTransform.isInvertible()) @@ -867,7 +867,7 @@ static bool pointHitsRect(const gfx::Point& screenSpacePoint, const WebTransform // Transform the hit test point from screen space to the local space of the given rect. bool clipped = false; - gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), gfx::PointF(screenSpacePoint), clipped); + gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), screenSpacePoint, clipped); // If projectPoint could not project to a valid value, then we assume that this point doesn't hit this rect. if (clipped) @@ -876,7 +876,7 @@ static bool pointHitsRect(const gfx::Point& screenSpacePoint, const WebTransform return localSpaceRect.Contains(hitTestPointInLocalSpace); } -static bool pointIsClippedBySurfaceOrClipRect(const gfx::Point& screenSpacePoint, LayerImpl* layer) +static bool pointIsClippedBySurfaceOrClipRect(const gfx::PointF& screenSpacePoint, LayerImpl* layer) { LayerImpl* currentLayer = layer; @@ -898,7 +898,7 @@ static bool pointIsClippedBySurfaceOrClipRect(const gfx::Point& screenSpacePoint return false; } -LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::Point& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList) +LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::PointF& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList) { LayerImpl* foundLayer = 0; diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h index 463ebc5..c530c55 100644 --- a/cc/layer_tree_host_common.h +++ b/cc/layer_tree_host_common.h @@ -25,7 +25,7 @@ public: static void calculateDrawTransforms(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter*, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList); // Performs hit testing for a given renderSurfaceLayerList. - static LayerImpl* findLayerThatIsHitByPoint(const gfx::Point& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList); + static LayerImpl* findLayerThatIsHitByPoint(const gfx::PointF& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList); template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID); diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index a9f21d2..a01f821 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -31,6 +31,7 @@ #include "cc/single_thread_proxy.h" #include "cc/software_renderer.h" #include "cc/texture_uploader.h" +#include "ui/gfx/size_conversions.h" #include <algorithm> using WebKit::WebTransformationMatrix; @@ -297,8 +298,7 @@ void LayerTreeHostImpl::startPageScaleAnimation(const IntSize& targetPosition, b IntSize scrollTotal = flooredIntSize(m_rootScrollLayerImpl->scrollPosition() + m_rootScrollLayerImpl->scrollDelta()); scrollTotal.scale(m_pinchZoomViewport.pageScaleDelta()); float scaleTotal = m_pinchZoomViewport.totalPageScaleFactor(); - IntSize scaledContentSize = cc::IntSize(contentSize()); - scaledContentSize.scale(m_pinchZoomViewport.pageScaleDelta()); + gfx::Size scaledContentSize = gfx::ToFlooredSize(contentSize().Scale(m_pinchZoomViewport.pageScaleDelta())); double startTimeSeconds = (startTime - base::TimeTicks()).InSecondsF(); m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, scaleTotal, cc::IntSize(m_deviceViewportSize), scaledContentSize, startTimeSeconds); @@ -1017,7 +1017,7 @@ bool LayerTreeHostImpl::ensureRenderSurfaceLayerList() return m_renderSurfaceLayerList.size(); } -InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(const IntPoint& viewportPoint, InputHandlerClient::ScrollInputType type) +InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(const gfx::Point& viewportPoint, InputHandlerClient::ScrollInputType type) { TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin"); @@ -1027,8 +1027,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(const IntPoint& if (!ensureRenderSurfaceLayerList()) return ScrollIgnored; - IntPoint deviceViewportPoint = viewportPoint; - deviceViewportPoint.scale(m_deviceScaleFactor, m_deviceScaleFactor); + gfx::PointF deviceViewportPoint = viewportPoint.Scale(m_deviceScaleFactor); // First find out which layer was hit from the saved list of visible layers // in the most recent frame. @@ -1071,15 +1070,14 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(const IntPoint& return ScrollIgnored; } -static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport, LayerImpl& layerImpl, float scaleFromViewportToScreenSpace, const FloatPoint& viewportPoint, const FloatSize& viewportDelta) +static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport, LayerImpl& layerImpl, float scaleFromViewportToScreenSpace, const gfx::PointF& viewportPoint, const FloatSize& viewportDelta) { // Layers with non-invertible screen space transforms should not have passed the scroll hit // test in the first place. DCHECK(layerImpl.screenSpaceTransform().isInvertible()); WebTransformationMatrix inverseScreenSpaceTransform = layerImpl.screenSpaceTransform().inverse(); - FloatPoint screenSpacePoint = viewportPoint; - screenSpacePoint.scale(scaleFromViewportToScreenSpace, scaleFromViewportToScreenSpace); + gfx::PointF screenSpacePoint = viewportPoint.Scale(scaleFromViewportToScreenSpace); FloatSize screenSpaceDelta = viewportDelta; screenSpaceDelta.scale(scaleFromViewportToScreenSpace, scaleFromViewportToScreenSpace); @@ -1087,9 +1085,9 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport, // First project the scroll start and end points to local layer space to find the scroll delta // in layer coordinates. bool startClipped, endClipped; - FloatPoint screenSpaceEndPoint = screenSpacePoint + screenSpaceDelta; - FloatPoint localStartPoint = cc::FloatPoint(MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped)); - FloatPoint localEndPoint = cc::FloatPoint(MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped)); + gfx::PointF screenSpaceEndPoint = screenSpacePoint + screenSpaceDelta; + gfx::PointF localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped); + gfx::PointF localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped); // In general scroll point coordinates should not get clipped. DCHECK(!startClipped); @@ -1100,29 +1098,27 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport, // localStartPoint and localEndPoint are in content space but we want to move them to layer space for scrolling. float widthScale = 1 / layerImpl.contentsScaleX(); float heightScale = 1 / layerImpl.contentsScaleY(); - localStartPoint.scale(widthScale, heightScale); - localEndPoint.scale(widthScale, heightScale); + localStartPoint = localStartPoint.Scale(widthScale, heightScale); + localEndPoint = localEndPoint.Scale(widthScale, heightScale); // Apply the scroll delta. FloatSize previousDelta(layerImpl.scrollDelta()); - FloatSize unscrolled = layerImpl.scrollBy(localEndPoint - localStartPoint); + FloatSize unscrolled = layerImpl.scrollBy(cc::FloatSize(localEndPoint - localStartPoint)); if (viewport) viewport->applyScroll(unscrolled); // Get the end point in the layer's content space so we can apply its screenSpaceTransform. - FloatPoint actualLocalEndPoint = localStartPoint + layerImpl.scrollDelta() - previousDelta; - gfx::PointF actualLocalContentEndPoint = actualLocalEndPoint; - actualLocalContentEndPoint = actualLocalContentEndPoint.Scale(1 / widthScale, 1 / heightScale); + gfx::PointF actualLocalEndPoint = localStartPoint + layerImpl.scrollDelta() - previousDelta; + gfx::PointF actualLocalContentEndPoint = actualLocalEndPoint.Scale(1 / widthScale, 1 / heightScale); // Calculate the applied scroll delta in viewport space coordinates. - FloatPoint actualScreenSpaceEndPoint = cc::FloatPoint(MathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped)); + gfx::PointF actualScreenSpaceEndPoint = MathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped); DCHECK(!endClipped); if (endClipped) return FloatSize(); - FloatPoint actualViewportEndPoint = actualScreenSpaceEndPoint; - actualViewportEndPoint.scale(1 / scaleFromViewportToScreenSpace, 1 / scaleFromViewportToScreenSpace); - return actualViewportEndPoint - viewportPoint; + gfx::PointF actualViewportEndPoint = actualScreenSpaceEndPoint.Scale(1 / scaleFromViewportToScreenSpace); + return cc::FloatSize(actualViewportEndPoint - viewportPoint); } static FloatSize scrollLayerWithLocalDelta(LayerImpl& layerImpl, const FloatSize& localDelta) @@ -1132,7 +1128,7 @@ static FloatSize scrollLayerWithLocalDelta(LayerImpl& layerImpl, const FloatSize return layerImpl.scrollDelta() - previousDelta; } -void LayerTreeHostImpl::scrollBy(const IntPoint& viewportPoint, const IntSize& scrollDelta) +void LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint, const IntSize& scrollDelta) { TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBy"); if (!m_currentlyScrollingLayerImpl) diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h index ff34cde..036c6bd 100644 --- a/cc/layer_tree_host_impl.h +++ b/cc/layer_tree_host_impl.h @@ -109,8 +109,8 @@ public: virtual ~LayerTreeHostImpl(); // InputHandlerClient implementation - virtual InputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, InputHandlerClient::ScrollInputType) OVERRIDE; - virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE; + virtual InputHandlerClient::ScrollStatus scrollBegin(const gfx::Point&, InputHandlerClient::ScrollInputType) OVERRIDE; + virtual void scrollBy(const gfx::Point&, const IntSize&) OVERRIDE; virtual void scrollEnd() OVERRIDE; virtual void pinchGestureBegin() OVERRIDE; virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 605d06c..f6c2bff 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -336,8 +336,8 @@ TEST_P(LayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); initializeRendererAndDrawFrame(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); @@ -346,7 +346,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) TEST_P(LayerTreeHostImplTest, scrollWithoutRootLayer) { // We should not crash when trying to scroll an empty layer tree. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); } TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer) @@ -361,7 +361,7 @@ TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer) setupScrollAndContentsLayers(gfx::Size(100, 100)); // We should not crash when trying to scroll after the renderer initialization fails. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); } TEST_P(LayerTreeHostImplTest, replaceTreeWhileScrolling) @@ -373,14 +373,14 @@ TEST_P(LayerTreeHostImplTest, replaceTreeWhileScrolling) initializeRendererAndDrawFrame(); // We should not crash if the tree is replaced while we are scrolling. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); m_hostImpl->detachLayerTree(); setupScrollAndContentsLayers(gfx::Size(100, 100)); // We should still be scrolling, because the scrolled layer also exists in the new tree. IntSize scrollDelta(0, 10); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo, scrollLayerId, scrollDelta); @@ -395,7 +395,7 @@ TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) // We should be able to scroll even if the root layer loses its render surface after the most // recent render. m_hostImpl->rootLayer()->clearRenderSurface(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); } TEST_P(LayerTreeHostImplTest, wheelEventHandlers) @@ -408,10 +408,10 @@ TEST_P(LayerTreeHostImplTest, wheelEventHandlers) root->setHaveWheelEventHandlers(true); // With registered event handlers, wheel scrolls have to go to the main thread. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); // But gesture scrolls can still be handled. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); } TEST_P(LayerTreeHostImplTest, shouldScrollOnMainThread) @@ -423,8 +423,8 @@ TEST_P(LayerTreeHostImplTest, shouldScrollOnMainThread) root->setShouldScrollOnMainThread(true); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread); } TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic) @@ -437,15 +437,15 @@ TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic) root->setNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); // All scroll types inside the non-fast scrollable region should fail. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread); // All scroll types outside this region should succeed. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), IntSize(0, 10)); m_hostImpl->scrollEnd(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), IntSize(0, 10)); m_hostImpl->scrollEnd(); } @@ -460,12 +460,12 @@ TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset) initializeRendererAndDrawFrame(); // This point would fall into the non-fast scrollable region except that we've moved the layer down by 25 pixels. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), IntSize(0, 1)); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(40, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), IntSize(0, 1)); m_hostImpl->scrollEnd(); // This point is still inside the non-fast region. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); } TEST_P(LayerTreeHostImplTest, maxScrollPositionChangedByDeviceScaleFactor) @@ -533,8 +533,8 @@ TEST_P(LayerTreeHostImplTest, implPinchZoom) m_hostImpl->pinchGestureEnd(); IntSize scrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); @@ -785,8 +785,8 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPage // Scrolling during the animation is ignored. const IntSize scrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); // The final page scale and scroll deltas should match what we got @@ -1027,7 +1027,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootIgnored) initializeRendererAndDrawFrame(); // Scroll event is ignored because layer is not scrollable. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); EXPECT_FALSE(m_didRequestRedraw); EXPECT_FALSE(m_didRequestCommit); } @@ -1060,8 +1060,8 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot) m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); @@ -1078,8 +1078,8 @@ TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); @@ -1095,7 +1095,7 @@ TEST_P(LayerTreeHostImplTest, scrollMissesChild) initializeRendererAndDrawFrame(); // Scroll event is ignored because the input coordinate is outside the layer boundaries. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(15, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(15, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); EXPECT_FALSE(m_didRequestRedraw); EXPECT_FALSE(m_didRequestCommit); } @@ -1118,7 +1118,7 @@ TEST_P(LayerTreeHostImplTest, scrollMissesBackfacingChild) // Scroll event is ignored because the scrollable layer is not facing the viewer and there is // nothing scrollable behind it. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored); EXPECT_FALSE(m_didRequestRedraw); EXPECT_FALSE(m_didRequestCommit); } @@ -1138,7 +1138,7 @@ TEST_P(LayerTreeHostImplTest, scrollBlockedByContentLayer) initializeRendererAndDrawFrame(); // Scrolling fails because the content layer is asking to be scrolled on the main thread. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread); } TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) @@ -1153,8 +1153,8 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); // Set new page scale from main thread. @@ -1187,8 +1187,8 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); // Set new page scale on impl thread by pinching. @@ -1274,8 +1274,8 @@ TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) IntSize scrollDelta(0, 10); IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(child->maxScrollPosition()); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); float pageScale = 2; @@ -1319,8 +1319,8 @@ TEST_P(LayerTreeHostImplTest, scrollChildBeyondLimit) initializeRendererAndDrawFrame(); { IntSize scrollDelta(-8, -7); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); @@ -1351,8 +1351,8 @@ TEST_P(LayerTreeHostImplTest, scrollEventBubbling) initializeRendererAndDrawFrame(); { IntSize scrollDelta(0, 4); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); @@ -1375,7 +1375,7 @@ TEST_P(LayerTreeHostImplTest, scrollBeforeRedraw) m_hostImpl->setRootLayer(createScrollableLayer(2, surfaceSize)); // Scrolling should still work even though we did not draw yet. - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); } TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) @@ -1393,8 +1393,8 @@ TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) // Scroll to the right in screen coordinates with a gesture. IntSize gestureScrollDelta(10, 0); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), gestureScrollDelta); m_hostImpl->scrollEnd(); // The layer should have scrolled down in its local coordinates. @@ -1404,8 +1404,8 @@ TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) // Reset and scroll down with the wheel. m_hostImpl->rootLayer()->setScrollDelta(FloatSize()); IntSize wheelScrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), wheelScrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), wheelScrollDelta); m_hostImpl->scrollEnd(); // The layer should have scrolled down in its local coordinates. @@ -1438,8 +1438,8 @@ TEST_P(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) { // Scroll down in screen coordinates with a gesture. IntSize gestureScrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), gestureScrollDelta); m_hostImpl->scrollEnd(); // The child layer should have scrolled down in its local coordinates an amount proportional to @@ -1457,8 +1457,8 @@ TEST_P(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) // Now reset and scroll the same amount horizontally. m_hostImpl->rootLayer()->children()[1]->setScrollDelta(FloatSize()); IntSize gestureScrollDelta(10, 0); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), gestureScrollDelta); m_hostImpl->scrollEnd(); // The child layer should have scrolled down in its local coordinates an amount proportional to @@ -1490,8 +1490,8 @@ TEST_P(LayerTreeHostImplTest, scrollScaledLayer) // Scroll down in screen coordinates with a gesture. IntSize scrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), scrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), scrollDelta); m_hostImpl->scrollEnd(); // The layer should have scrolled down in its local coordinates, but half he amount. @@ -1501,8 +1501,8 @@ TEST_P(LayerTreeHostImplTest, scrollScaledLayer) // Reset and scroll down with the wheel. m_hostImpl->rootLayer()->setScrollDelta(FloatSize()); IntSize wheelScrollDelta(0, 10); - EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntPoint(), wheelScrollDelta); + EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(gfx::Point(), wheelScrollDelta); m_hostImpl->scrollEnd(); // The scale should not have been applied to the scroll delta. diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index 5d63d63..4deb60d 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -1184,7 +1184,7 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); + m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); m_layerTreeHost->rootLayer()->addChild(m_updateCheckLayer); postSetNeedsCommitToMainThread(); @@ -1298,12 +1298,12 @@ public: m_rootLayer->setIsDrawable(true); m_rootLayer->setBounds(gfx::Size(30, 30)); - m_rootLayer->setAnchorPoint(FloatPoint(0, 0)); + m_rootLayer->setAnchorPoint(gfx::PointF(0, 0)); m_childLayer->setIsDrawable(true); m_childLayer->setPosition(gfx::Point(2, 2)); m_childLayer->setBounds(gfx::Size(10, 10)); - m_childLayer->setAnchorPoint(FloatPoint(0, 0)); + m_childLayer->setAnchorPoint(gfx::PointF(0, 0)); m_layerTreeHost->setRootLayer(m_rootLayer); } @@ -2232,18 +2232,17 @@ public: virtual void beginTest() OVERRIDE { - IntSize viewportSize(10, 10); - IntSize deviceViewportSize = viewportSize; - deviceViewportSize.scale(m_deviceScaleFactor, m_deviceScaleFactor); + gfx::Size viewportSize(10, 10); + gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_deviceScaleFactor)); m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); - m_rootScrollLayer->setBounds(IntSize(110, 110)); + m_rootScrollLayer->setBounds(gfx::Size(110, 110)); - m_rootScrollLayer->setPosition(FloatPoint(0, 0)); - m_rootScrollLayer->setAnchorPoint(FloatPoint(0, 0)); + m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); + m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); m_rootScrollLayer->setIsDrawable(true); m_rootScrollLayer->setScrollable(true); @@ -2252,12 +2251,12 @@ public: m_childLayer = ContentLayer::create(&m_mockDelegate); m_childLayer->setLayerScrollClient(this); - m_childLayer->setBounds(IntSize(110, 110)); + m_childLayer->setBounds(gfx::Size(110, 110)); // The scrolls will happen at 5, 5. If they are treated like device pixels, then // they will be at 2.5, 2.5 in logical pixels, and will miss this layer. - m_childLayer->setPosition(FloatPoint(5, 5)); - m_childLayer->setAnchorPoint(FloatPoint(0, 0)); + m_childLayer->setPosition(gfx::PointF(5, 5)); + m_childLayer->setAnchorPoint(gfx::PointF(0, 0)); m_childLayer->setIsDrawable(true); m_childLayer->setScrollable(true); @@ -2317,8 +2316,8 @@ public: switch (impl->sourceFrameNumber()) { case 0: // Gesture scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); - impl->scrollBy(IntPoint(), m_scrollAmount); + EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + impl->scrollBy(gfx::Point(), m_scrollAmount); impl->scrollEnd(); EXPECT_POINT_EQ(m_initialScroll, childLayer->scrollPosition()); @@ -2326,8 +2325,8 @@ public: break; case 1: // Wheel scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - impl->scrollBy(IntPoint(), m_scrollAmount); + EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + impl->scrollBy(gfx::Point(), m_scrollAmount); impl->scrollEnd(); EXPECT_POINT_EQ(m_secondScroll, childLayer->scrollPosition()); @@ -2393,9 +2392,8 @@ public: virtual void beginTest() OVERRIDE { - IntSize viewportSize(10, 10); - IntSize deviceViewportSize = viewportSize; - deviceViewportSize.scale(m_deviceScaleFactor, m_deviceScaleFactor); + gfx::Size viewportSize(10, 10); + gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_deviceScaleFactor)); m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); @@ -2403,8 +2401,8 @@ public: m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); m_rootScrollLayer->setBounds(IntSize(110, 110)); - m_rootScrollLayer->setPosition(FloatPoint(0, 0)); - m_rootScrollLayer->setAnchorPoint(FloatPoint(0, 0)); + m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); + m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); m_rootScrollLayer->setIsDrawable(true); m_rootScrollLayer->setScrollable(true); @@ -2453,8 +2451,8 @@ public: switch (impl->sourceFrameNumber()) { case 0: // Gesture scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); - impl->scrollBy(IntPoint(), m_scrollAmount); + EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted); + impl->scrollBy(gfx::Point(), m_scrollAmount); impl->scrollEnd(); EXPECT_POINT_EQ(m_initialScroll, rootScrollLayer->scrollPosition()); @@ -2462,8 +2460,8 @@ public: break; case 1: // Wheel scroll on impl thread. - EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); - impl->scrollBy(IntPoint(), m_scrollAmount); + EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted); + impl->scrollBy(gfx::Point(), m_scrollAmount); impl->scrollEnd(); EXPECT_POINT_EQ(m_secondScroll, rootScrollLayer->scrollPosition()); @@ -2548,13 +2546,13 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(IntSize(100, 100), IntSize(100, 100)); + m_layerTreeHost->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); - m_rootLayer->setBounds(IntSize(100, 100)); - m_surfaceLayer1->setBounds(IntSize(100, 100)); + m_rootLayer->setBounds(gfx::Size(100, 100)); + m_surfaceLayer1->setBounds(gfx::Size(100, 100)); m_surfaceLayer1->setForceRenderSurface(true); m_surfaceLayer1->setOpacity(0.5); - m_surfaceLayer2->setBounds(IntSize(100, 100)); + m_surfaceLayer2->setBounds(gfx::Size(100, 100)); m_surfaceLayer2->setForceRenderSurface(true); m_surfaceLayer2->setOpacity(0.5); @@ -2639,7 +2637,7 @@ private: if (m_texture.get()) return; m_texture = PrioritizedTexture::create(layerTreeHost()->contentsTextureManager()); - m_texture->setDimensions(IntSize(10, 10), GL_RGBA); + m_texture->setDimensions(gfx::Size(10, 10), GL_RGBA); m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); } @@ -2716,10 +2714,10 @@ public: virtual void beginTest() OVERRIDE { m_layerTreeHost->setRootLayer(m_layer); - m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20)); + m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20)); WebTransformationMatrix identityMatrix; - setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true); + setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true); postSetNeedsCommitToMainThread(); } @@ -2849,10 +2847,10 @@ public: virtual void beginTest() OVERRIDE { m_layerTreeHost->setRootLayer(m_layer); - m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20)); + m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20)); WebTransformationMatrix identityMatrix; - setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true); + setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true); postSetNeedsCommitToMainThread(); } @@ -2974,12 +2972,12 @@ public: virtual void beginTest() { m_layerTreeHost->setRootLayer(m_parent); - m_layerTreeHost->setViewportSize(IntSize(m_numChildren, 1), IntSize(m_numChildren, 1)); + m_layerTreeHost->setViewportSize(gfx::Size(m_numChildren, 1), gfx::Size(m_numChildren, 1)); WebTransformationMatrix identityMatrix; - setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(m_numChildren, 1), true); + setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(m_numChildren, 1), true); for (int i = 0; i < m_numChildren; i++) - setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(i, 0), IntSize(1, 1), false); + setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(i, 0), gfx::Size(1, 1), false); postSetNeedsCommitToMainThread(); } @@ -3022,8 +3020,8 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); - m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); + m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); + m_layerTreeHost->rootLayer()->setBounds(gfx::Size(10, 10)); postSetNeedsCommitToMainThread(); } @@ -3072,8 +3070,8 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); - m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); + m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); + m_layerTreeHost->rootLayer()->setBounds(gfx::Size(10, 10)); m_contentLayer = ContentLayer::create(&m_mockDelegate); m_contentLayer->setBounds(gfx::Size(10, 10)); @@ -3174,8 +3172,8 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); - m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); + m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); + m_layerTreeHost->rootLayer()->setBounds(gfx::Size(10, 10)); postSetNeedsCommitToMainThread(); } diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc index 9c37395..6a26194 100644 --- a/cc/prioritized_texture_unittest.cc +++ b/cc/prioritized_texture_unittest.cc @@ -89,7 +89,7 @@ public: } protected: - const IntSize m_textureSize; + const gfx::Size m_textureSize; const GLenum m_textureFormat; scoped_ptr<GraphicsContext> m_context; scoped_ptr<ResourceProvider> m_resourceProvider; diff --git a/cc/render_surface_filters.cc b/cc/render_surface_filters.cc index b544bb1..6345b34 100644 --- a/cc/render_surface_filters.cc +++ b/cc/render_surface_filters.cc @@ -6,7 +6,6 @@ #include "cc/render_surface_filters.h" -#include "FloatSize.h" #include "base/logging.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/effects/SkBlurImageFilter.h" @@ -14,6 +13,7 @@ #include "third_party/skia/include/effects/SkMagnifierImageFilter.h" #include "third_party/skia/include/gpu/SkGpuDevice.h" #include "third_party/skia/include/gpu/SkGrPixelRef.h" +#include "ui/gfx/size_f.h" #include <public/WebFilterOperation.h> #include <public/WebFilterOperations.h> #include <public/WebGraphicsContext3D.h> @@ -67,8 +67,10 @@ void getSaturateMatrix(float amount, SkScalar matrix[20]) void getHueRotateMatrix(float hue, SkScalar matrix[20]) { - float cosHue = cosf(hue * piFloat / 180); - float sinHue = sinf(hue * piFloat / 180); + const float kPi = 3.1415926535897932384626433832795f; + + float cosHue = cosf(hue * kPi / 180); + float sinHue = sinf(hue * kPi / 180); matrix[0] = 0.213f + cosHue * 0.787f - sinHue * 0.213f; matrix[1] = 0.715f - cosHue * 0.715f - sinHue * 0.715f; matrix[2] = 0.072f - cosHue * 0.072f + sinHue * 0.928f; @@ -236,7 +238,7 @@ bool getColorMatrix(const WebKit::WebFilterOperation& op, SkScalar matrix[20]) class FilterBufferState { public: - FilterBufferState(GrContext* grContext, const FloatSize& size, unsigned textureId) + FilterBufferState(GrContext* grContext, const gfx::SizeF& size, unsigned textureId) : m_grContext(grContext) , m_currentTexture(0) { @@ -365,7 +367,7 @@ WebKit::WebFilterOperations RenderSurfaceFilters::optimize(const WebKit::WebFilt return newList; } -SkBitmap RenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize& size, WebKit::WebGraphicsContext3D* context3D, GrContext* grContext) +SkBitmap RenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const gfx::SizeF& size, WebKit::WebGraphicsContext3D* context3D, GrContext* grContext) { if (!context3D || !grContext) return SkBitmap(); diff --git a/cc/render_surface_filters.h b/cc/render_surface_filters.h index 4ffc9fd..ead04aa 100644 --- a/cc/render_surface_filters.h +++ b/cc/render_surface_filters.h @@ -9,17 +9,20 @@ class GrContext; class SkBitmap; +namespace gfx { +class SizeF; +} + namespace WebKit { class WebFilterOperations; class WebGraphicsContext3D; } namespace cc { -class FloatSize; class RenderSurfaceFilters { public: - static SkBitmap apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize&, WebKit::WebGraphicsContext3D*, GrContext*); + static SkBitmap apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const gfx::SizeF&, WebKit::WebGraphicsContext3D*, GrContext*); static WebKit::WebFilterOperations optimize(const WebKit::WebFilterOperations& filters); private: diff --git a/cc/scoped_texture_unittest.cc b/cc/scoped_texture_unittest.cc index 0be883d..9e5a59e 100644 --- a/cc/scoped_texture_unittest.cc +++ b/cc/scoped_texture_unittest.cc @@ -30,7 +30,7 @@ TEST(ScopedTextureTest, NewScopedTexture) EXPECT_EQ(0u, texture->id()); // New scoped textures do not have a size yet. - EXPECT_EQ(IntSize(), texture->size()); + EXPECT_EQ(gfx::Size(), texture->size()); EXPECT_EQ(0u, texture->bytes()); } @@ -40,7 +40,7 @@ TEST(ScopedTextureTest, CreateScopedTexture) DebugScopedSetImplThread implThread; scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(context.get())); scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); - texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); + texture->allocate(Renderer::ImplPool, gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); // The texture has an allocated byte-size now. size_t expectedBytes = 30 * 30 * 4; @@ -48,7 +48,7 @@ TEST(ScopedTextureTest, CreateScopedTexture) EXPECT_LT(0u, texture->id()); EXPECT_EQ(GL_RGBA, texture->format()); - EXPECT_EQ(IntSize(30, 30), texture->size()); + EXPECT_EQ(gfx::Size(30, 30), texture->size()); } TEST(ScopedTextureTest, ScopedTextureIsDeleted) @@ -61,7 +61,7 @@ TEST(ScopedTextureTest, ScopedTextureIsDeleted) scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); + texture->allocate(Renderer::ImplPool, gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); } @@ -71,7 +71,7 @@ TEST(ScopedTextureTest, ScopedTextureIsDeleted) { scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); + texture->allocate(Renderer::ImplPool, gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); texture->free(); @@ -89,7 +89,7 @@ TEST(ScopedTextureTest, LeakScopedTexture) scoped_ptr<ScopedTexture> texture = ScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(Renderer::ImplPool, IntSize(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); + texture->allocate(Renderer::ImplPool, gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h index 1091582..7b512d7 100644 --- a/cc/test/animation_test_common.h +++ b/cc/test/animation_test_common.h @@ -5,7 +5,6 @@ #ifndef CCAnimationTestCommon_h #define CCAnimationTestCommon_h -#include "IntSize.h" #include "cc/active_animation.h" #include "cc/animation_curve.h" #include "cc/layer_animation_controller.h" diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc index da3f430..65a2904 100644 --- a/cc/test/layer_tree_test_common.cc +++ b/cc/test/layer_tree_test_common.cc @@ -149,7 +149,7 @@ public: layerTreeHost->setRootLayer(rootLayer); // LayerTreeHostImpl won't draw if it has 1x1 viewport. - layerTreeHost->setViewportSize(IntSize(1, 1), IntSize(1, 1)); + layerTreeHost->setViewportSize(gfx::Size(1, 1), gfx::Size(1, 1)); layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks); diff --git a/cc/texture_copier.h b/cc/texture_copier.h index e2b8d17..e60f787 100644 --- a/cc/texture_copier.h +++ b/cc/texture_copier.h @@ -9,8 +9,8 @@ #include "base/memory/scoped_ptr.h" #include "cc/program_binding.h" #include "cc/shader.h" -#include "IntSize.h" #include "third_party/khronos/GLES2/gl2.h" +#include "ui/gfx/size.h" namespace WebKit { class WebGraphicsContext3D; @@ -23,7 +23,7 @@ public: struct Parameters { unsigned sourceTexture; unsigned destTexture; - IntSize size; + gfx::Size size; }; // Copy the base level contents of |sourceTexture| to |destTexture|. Both texture objects // must be complete and have a base level of |size| dimensions. The color formats do not need diff --git a/cc/texture_copier_unittest.cc b/cc/texture_copier_unittest.cc index 0a4c425..5552734 100644 --- a/cc/texture_copier_unittest.cc +++ b/cc/texture_copier_unittest.cc @@ -51,7 +51,7 @@ TEST(TextureCopierTest, testDrawArraysCopy) int sourceTextureId = 1; int destTextureId = 2; - IntSize size(256, 128); + gfx::Size size(256, 128); scoped_ptr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(mockContext.get(), false)); TextureCopier::Parameters copy = { sourceTextureId, destTextureId, size }; copier->copyTexture(copy); diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc index 45f6ed6..24811ba 100644 --- a/cc/video_layer_impl.cc +++ b/cc/video_layer_impl.cc @@ -287,7 +287,7 @@ static bool hasPaddingBytes(const media::VideoFrame& frame, size_t plane) return frame.stride(plane) > videoFrameDimension(frame.data_size().width(), plane, frame.format()); } -IntSize computeVisibleSize(const media::VideoFrame& frame, size_t plane) +gfx::Size computeVisibleSize(const media::VideoFrame& frame, size_t plane) { int visibleWidth = videoFrameDimension(frame.data_size().width(), plane, frame.format()); int originalWidth = visibleWidth; @@ -308,7 +308,7 @@ IntSize computeVisibleSize(const media::VideoFrame& frame, size_t plane) visibleWidth = originalWidth - 2; } - return IntSize(visibleWidth, visibleHeight); + return gfx::Size(visibleWidth, visibleHeight); } bool VideoLayerImpl::FramePlane::allocateData(ResourceProvider* resourceProvider) @@ -336,9 +336,9 @@ bool VideoLayerImpl::allocatePlaneData(ResourceProvider* resourceProvider) for (size_t planeIndex = 0; planeIndex < planeCount; ++planeIndex) { VideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; - IntSize requiredTextureSize(m_frame->stride(planeIndex), videoFrameDimension(m_frame->data_size().height(), planeIndex, m_frame->format())); + gfx::Size requiredTextureSize(m_frame->stride(planeIndex), videoFrameDimension(m_frame->data_size().height(), planeIndex, m_frame->format())); // FIXME: Remove the test against maxTextureSize when tiled layers are implemented. - if (requiredTextureSize.isZero() || requiredTextureSize.width() > maxTextureSize || requiredTextureSize.height() > maxTextureSize) + if (requiredTextureSize.IsEmpty() || requiredTextureSize.width() > maxTextureSize || requiredTextureSize.height() > maxTextureSize) return false; if (plane.size != requiredTextureSize || plane.format != m_format) { diff --git a/cc/video_layer_impl.h b/cc/video_layer_impl.h index 964d35c..079e882 100644 --- a/cc/video_layer_impl.h +++ b/cc/video_layer_impl.h @@ -5,12 +5,12 @@ #ifndef CCVideoLayerImpl_h #define CCVideoLayerImpl_h -#include "IntSize.h" #include "base/callback.h" #include "base/synchronization/lock.h" #include "cc/layer_impl.h" #include "media/base/video_frame.h" #include "third_party/khronos/GLES2/gl2.h" +#include "ui/gfx/size.h" #include <public/WebTransformationMatrix.h> #include <public/WebVideoFrameProvider.h> @@ -56,9 +56,9 @@ public: struct FramePlane { ResourceProvider::ResourceId resourceId; - IntSize size; + gfx::Size size; GLenum format; - IntSize visibleSize; + gfx::Size visibleSize; FramePlane() : resourceId(0) { } diff --git a/webkit/compositor_bindings/web_external_texture_layer_impl.cc b/webkit/compositor_bindings/web_external_texture_layer_impl.cc index e43e4f1..54e71ad 100644 --- a/webkit/compositor_bindings/web_external_texture_layer_impl.cc +++ b/webkit/compositor_bindings/web_external_texture_layer_impl.cc @@ -11,7 +11,6 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" #include "web_layer_impl.h" -#include "webcore_convert.h" using namespace cc; @@ -88,7 +87,7 @@ public: virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE { - TextureCopier::Parameters copy = { sourceTexture, destinationTexture, convert(size) }; + TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size }; m_queue.appendCopy(copy); } diff --git a/webkit/compositor_bindings/web_io_surface_layer_impl.cc b/webkit/compositor_bindings/web_io_surface_layer_impl.cc index ee56546..3469503 100644 --- a/webkit/compositor_bindings/web_io_surface_layer_impl.cc +++ b/webkit/compositor_bindings/web_io_surface_layer_impl.cc @@ -6,7 +6,6 @@ #include "web_io_surface_layer_impl.h" #include "cc/io_surface_layer.h" -#include "webcore_convert.h" #include "web_layer_impl.h" using cc::IOSurfaceLayer; @@ -30,7 +29,7 @@ WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl() void WebIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size) { - static_cast<IOSurfaceLayer*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, convert(size)); + static_cast<IOSurfaceLayer*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, size); } WebLayer* WebIOSurfaceLayerImpl::layer() diff --git a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc index 165a1fb..58794b5 100644 --- a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc +++ b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc @@ -49,12 +49,12 @@ public: virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERRIDE { - return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scrollBegin(convert(point), static_cast<cc::InputHandlerClient::ScrollInputType>(type))); + return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scrollBegin(point, static_cast<cc::InputHandlerClient::ScrollInputType>(type))); } virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE { - m_client->scrollBy(convert(point), convert(offset)); + m_client->scrollBy(point, convert(offset)); } virtual void scrollEnd() OVERRIDE |