| Index: cc/CCRendererGL.cpp
|
| diff --git a/cc/CCRendererGL.cpp b/cc/CCRendererGL.cpp
|
| index 50fed7abcf40c750d65b5087d4ec73b8e9b4c65e..6a096a249d4d1bb26c0287acbcd8cf2c8fb7c05f 100644
|
| --- a/cc/CCRendererGL.cpp
|
| +++ b/cc/CCRendererGL.cpp
|
| @@ -208,7 +208,7 @@ void CCRendererGL::beginDrawingFrame(DrawingFrame& frame)
|
| // FIXME: Remove this once framebuffer is automatically recreated on first use
|
| ensureFramebuffer();
|
|
|
| - if (viewportSize().isEmpty())
|
| + if (viewportSize().IsEmpty())
|
| return;
|
|
|
| TRACE_EVENT0("cc", "CCRendererGL::drawLayers");
|
| @@ -284,7 +284,7 @@ void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheck
|
| ASSERT(program && program->initialized());
|
| GLC(context(), context()->useProgram(program->program()));
|
|
|
| - IntRect tileRect = quad->quadRect();
|
| + ccmath::IntRect tileRect = quad->quadRect();
|
| float texOffsetX = tileRect.x();
|
| float texOffsetY = tileRect.y();
|
| float texScaleX = tileRect.width();
|
| @@ -308,7 +308,7 @@ void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB
|
| GLC(context(), context()->useProgram(program->program()));
|
|
|
| // Use the full quadRect for debug quads to not move the edges based on partial swaps.
|
| - const IntRect& layerRect = quad->quadRect();
|
| + const ccmath::IntRect& layerRect = quad->quadRect();
|
| WebTransformationMatrix renderMatrix = quad->quadTransform();
|
| renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y());
|
| renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height());
|
| @@ -372,17 +372,19 @@ PassOwnPtr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr
|
| ASSERT(!frame.currentTexture);
|
|
|
| // FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused).
|
| - IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox()));
|
| + ccmath::IntRect deviceRect = ccmath::FloatRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox())).EnclosingIntRect();
|
|
|
| int top, right, bottom, left;
|
| filters.getOutsets(top, right, bottom, left);
|
| - deviceRect.move(-left, -top);
|
| - deviceRect.expand(left + right, top + bottom);
|
| + deviceRect.InflateX(-left);
|
| + deviceRect.InflateY(-top);
|
| + deviceRect.InflateWidth(left + right);
|
| + deviceRect.InflateHeight(top + bottom);
|
|
|
| - deviceRect.intersect(frame.currentRenderPass->outputRect());
|
| + deviceRect.Intersect(frame.currentRenderPass->outputRect());
|
|
|
| OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_resourceProvider);
|
| - if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect))
|
| + if (!getFramebufferTexture(deviceBackgroundTexture.get(), cc::IntRect(deviceRect)))
|
| return nullptr;
|
|
|
| SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get());
|
| @@ -393,7 +395,7 @@ PassOwnPtr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr
|
| int filteredDeviceBackgroundTextureId = texture->getTextureHandle();
|
|
|
| OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resourceProvider);
|
| - if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer))
|
| + if (!backgroundTexture->allocate(CCRenderer::ImplPool, cc::IntSize(quad->quadRect().size()), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer))
|
| return nullptr;
|
|
|
| const CCRenderPass* targetRenderPass = frame.currentRenderPass;
|
| @@ -598,9 +600,9 @@ static void tileUniformLocation(T program, TileProgramUniforms& uniforms)
|
|
|
| void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad)
|
| {
|
| - IntRect tileRect = quad->quadVisibleRect();
|
| + ccmath::IntRect tileRect = quad->quadVisibleRect();
|
|
|
| - FloatRect clampRect(tileRect);
|
| + ccmath::FloatRect clampRect(tileRect);
|
| // Clamp texture coordinates to avoid sampling outside the layer
|
| // by deflating the tile region half a texel or half a texel
|
| // minus epsilon for one pixel layers. The resulting clamp region
|
| @@ -610,12 +612,12 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
|
| const float epsilon = 1 / 1024.0f;
|
| float clampX = min(0.5, clampRect.width() / 2.0 - epsilon);
|
| float clampY = min(0.5, clampRect.height() / 2.0 - epsilon);
|
| - clampRect.inflateX(-clampX);
|
| - clampRect.inflateY(-clampY);
|
| - FloatSize clampOffset = clampRect.minXMinYCorner() - FloatRect(tileRect).minXMinYCorner();
|
| + clampRect.InflateX(-clampX);
|
| + clampRect.InflateY(-clampY);
|
| + ccmath::FloatVector2d clampOffset = clampRect.location() - tileRect.location();
|
|
|
| - FloatPoint textureOffset = quad->textureOffset() + clampOffset +
|
| - IntPoint(tileRect.location() - quad->quadRect().location());
|
| + ccmath::FloatPoint textureOffset = quad->textureOffset() + clampOffset +
|
| + (tileRect.location() - quad->quadRect().location());
|
|
|
| // Map clamping rectangle to unit square.
|
| float vertexTexTranslateX = -clampRect.x() / clampRect.width();
|
| @@ -624,7 +626,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
|
| float vertexTexScaleY = tileRect.height() / clampRect.height();
|
|
|
| // Map to normalized texture coordinates.
|
| - const IntSize& textureSize = quad->textureSize();
|
| + const ccmath::IntSize& textureSize = quad->textureSize();
|
| float fragmentTexTranslateX = textureOffset.x() / textureSize.width();
|
| float fragmentTexTranslateY = textureOffset.y() / textureSize.height();
|
| float fragmentTexScaleX = clampRect.width() / textureSize.width();
|
| @@ -637,7 +639,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
|
| return;
|
|
|
| bool clipped = false;
|
| - FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped);
|
| + FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(cc::IntRect(quad->visibleContentRect())), clipped);
|
| ASSERT(!clipped);
|
|
|
| TileProgramUniforms uniforms;
|
| @@ -686,10 +688,10 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
|
| GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
|
| GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocation, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexScaleY));
|
|
|
| - FloatPoint bottomRight(tileRect.maxX(), tileRect.maxY());
|
| - FloatPoint bottomLeft(tileRect.x(), tileRect.maxY());
|
| + FloatPoint bottomRight(tileRect.max_x(), tileRect.max_y());
|
| + FloatPoint bottomLeft(tileRect.x(), tileRect.max_y());
|
| FloatPoint topLeft(tileRect.x(), tileRect.y());
|
| - FloatPoint topRight(tileRect.maxX(), tileRect.y());
|
| + FloatPoint topRight(tileRect.max_x(), tileRect.y());
|
|
|
| // Map points to device space.
|
| bottomRight = CCMathUtil::mapPoint(deviceTransform, bottomRight, clipped);
|
| @@ -711,12 +713,12 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
|
| topEdge = deviceLayerEdges.top();
|
| if (quad->leftEdgeAA() && tileRect.x() == quad->quadRect().x())
|
| leftEdge = deviceLayerEdges.left();
|
| - if (quad->rightEdgeAA() && tileRect.maxX() == quad->quadRect().maxX())
|
| + if (quad->rightEdgeAA() && tileRect.max_x() == quad->quadRect().max_x())
|
| rightEdge = deviceLayerEdges.right();
|
| - if (quad->bottomEdgeAA() && tileRect.maxY() == quad->quadRect().maxY())
|
| + if (quad->bottomEdgeAA() && tileRect.max_y() == quad->quadRect().max_y())
|
| bottomEdge = deviceLayerEdges.bottom();
|
|
|
| - float sign = FloatQuad(tileRect).isCounterclockwise() ? -1 : 1;
|
| + float sign = FloatQuad(cc::IntRect(tileRect)).isCounterclockwise() ? -1 : 1;
|
| bottomEdge.scale(sign);
|
| leftEdge.scale(sign);
|
| topEdge.scale(sign);
|
| @@ -759,7 +761,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
|
| // un-antialiased quad should have and which vertex this is and the float
|
| // quad passed in via uniform is the actual geometry that gets used to draw
|
| // it. This is why this centered rect is used and not the original quadRect.
|
| - FloatRect centeredRect(FloatPoint(-0.5 * tileRect.width(), -0.5 * tileRect.height()), tileRect.size());
|
| + ccmath::FloatRect centeredRect(ccmath::FloatPoint(-0.5 * tileRect.width(), -0.5 * tileRect.height()), tileRect.size());
|
| drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrixLocation);
|
| }
|
|
|
| @@ -879,7 +881,7 @@ void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDra
|
| binding.set(textureProgram());
|
| GLC(context(), context()->useProgram(binding.programId));
|
| GLC(context(), context()->uniform1i(binding.samplerLocation, 0));
|
| - const FloatRect& uvRect = quad->uvRect();
|
| + const ccmath::FloatRect& uvRect = quad->uvRect();
|
| GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x(), uvRect.y(), uvRect.width(), uvRect.height()));
|
|
|
| GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0));
|
| @@ -937,7 +939,7 @@ void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfac
|
| void CCRendererGL::finishDrawingFrame(DrawingFrame& frame)
|
| {
|
| m_currentFramebufferLock.clear();
|
| - m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect));
|
| + m_swapBufferRect.Unite(frame.rootDamageRect.EnclosingIntRect());
|
|
|
| GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
|
| GLC(m_context, m_context->disable(GraphicsContext3D::BLEND));
|
| @@ -991,7 +993,7 @@ void CCRendererGL::setShaderOpacity(float opacity, int alphaLocation)
|
| GLC(m_context, m_context->uniform1f(alphaLocation, opacity));
|
| }
|
|
|
| -void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation)
|
| +void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const ccmath::FloatRect& quadRect, int matrixLocation)
|
| {
|
| WebTransformationMatrix quadRectMatrix;
|
| quadRectTransform(&quadRectMatrix, drawTransform, quadRect);
|
| @@ -1002,7 +1004,7 @@ void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::Web
|
| GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0));
|
| }
|
|
|
| -void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix)
|
| +void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const ccmath::IntRect& rect, const WebTransformationMatrix& drawMatrix)
|
| {
|
| const RenderPassProgram* program = renderPassProgram();
|
|
|
| @@ -1035,7 +1037,7 @@ bool CCRendererGL::swapBuffers()
|
|
|
| if (m_capabilities.usingPartialSwap) {
|
| // If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport)
|
| - m_swapBufferRect.intersect(IntRect(IntPoint(), viewportSize()));
|
| + m_swapBufferRect.Intersect(ccmath::IntRect(ccmath::IntPoint(), viewportSize()));
|
| int flippedYPosOfRectBottom = viewportHeight() - m_swapBufferRect.y() - m_swapBufferRect.height();
|
| m_context->postSubBufferCHROMIUM(m_swapBufferRect.x(), flippedYPosOfRectBottom, m_swapBufferRect.width(), m_swapBufferRect.height());
|
| } else {
|
| @@ -1044,7 +1046,7 @@ bool CCRendererGL::swapBuffers()
|
| m_context->prepareTexture();
|
| }
|
|
|
| - m_swapBufferRect = IntRect();
|
| + m_swapBufferRect = ccmath::IntRect();
|
|
|
| return true;
|
| }
|
| @@ -1117,7 +1119,7 @@ void CCRendererGL::onContextLost()
|
| }
|
|
|
|
|
| -void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect)
|
| +void CCRendererGL::getFramebufferPixels(void *pixels, const cc::IntRect& rect)
|
| {
|
| ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight());
|
|
|
| @@ -1194,7 +1196,7 @@ bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect
|
| {
|
| ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB));
|
|
|
| - if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny))
|
| + if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, cc::IntSize(deviceRect.size()), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny))
|
| return false;
|
|
|
| CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id());
|
| @@ -1204,7 +1206,7 @@ bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect
|
| return true;
|
| }
|
|
|
| -bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect)
|
| +bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const ccmath::IntRect& viewportRect)
|
| {
|
| ASSERT(texture->id());
|
| frame.currentRenderPass = 0;
|
| @@ -1219,7 +1221,7 @@ void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame)
|
| GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
|
| }
|
|
|
| -bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect)
|
| +bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const ccmath::IntRect& framebufferRect)
|
| {
|
| ASSERT(texture->id());
|
|
|
| @@ -1241,7 +1243,7 @@ bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedT
|
| return true;
|
| }
|
|
|
| -void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect)
|
| +void CCRendererGL::enableScissorTestRect(const ccmath::IntRect& scissorRect)
|
| {
|
| GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST));
|
| GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorRect.width(), scissorRect.height()));
|
| @@ -1252,7 +1254,7 @@ void CCRendererGL::disableScissorTest()
|
| GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
|
| }
|
|
|
| -void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize)
|
| +void CCRendererGL::setDrawViewportSize(const ccmath::IntSize& viewportSize)
|
| {
|
| GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.height()));
|
| }
|
|
|