diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-20 04:12:41 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-20 04:12:41 +0000 |
commit | 1fea814130ff23de709fe242819d67b9d4344e07 (patch) | |
tree | 6b9f06266db7ea814bc597ffb7fea731fb77904e /cc/software_renderer.cc | |
parent | efd25e631eba64162229c4aee56413a4a0fd7549 (diff) | |
download | chromium_src-1fea814130ff23de709fe242819d67b9d4344e07.zip chromium_src-1fea814130ff23de709fe242819d67b9d4344e07.tar.gz chromium_src-1fea814130ff23de709fe242819d67b9d4344e07.tar.bz2 |
cc: Use ui/gfx geometry types for the CCRenderPass and CCDrawQuad classes.
We use these geometry types for CCDrawQuad types and in CCRenderPass, and so
we also make use of them in the CCRenderer classes.
A minor number of copies back to cc:: (WebCore) geometry types do occur in
the renderer implementations for now until we migrate the rest of the compositor.
Covered by existing tests.
BUG=152473
R=enne,jamesr
Review URL: https://chromiumcodereview.appspot.com/10984053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/software_renderer.cc')
-rw-r--r-- | cc/software_renderer.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc index 4b427e8..3eda904 100644 --- a/cc/software_renderer.cc +++ b/cc/software_renderer.cc @@ -16,6 +16,7 @@ #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/core/SkShader.h" #include "third_party/skia/include/effects/SkLayerRasterizer.h" +#include "ui/gfx/rect_conversions.h" #include <public/WebImage.h> #include <public/WebSize.h> #include <public/WebTransformationMatrix.h> @@ -29,12 +30,12 @@ namespace cc { namespace { -SkRect toSkRect(const FloatRect& rect) +SkRect toSkRect(const gfx::RectF& rect) { return SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()); } -SkIRect toSkIRect(const IntRect& rect) +SkIRect toSkIRect(const gfx::Rect& rect) { return SkIRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()); } @@ -127,7 +128,7 @@ void CCRendererSoftware::bindFramebufferToOutputSurface(DrawingFrame& frame) m_skCurrentCanvas = m_skRootCanvas.get(); } -bool CCRendererSoftware::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) +bool CCRendererSoftware::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const gfx::Rect& framebufferRect) { m_currentFramebufferLock = make_scoped_ptr(new CCResourceProvider::ScopedWriteLockSoftware(m_resourceProvider, texture->id())); m_skCurrentCanvas = m_currentFramebufferLock->skCanvas(); @@ -137,14 +138,14 @@ bool CCRendererSoftware::bindFramebufferToTexture(DrawingFrame& frame, const CCS return true; } -void CCRendererSoftware::enableScissorTestRect(const IntRect& scissorRect) +void CCRendererSoftware::enableScissorTestRect(const gfx::Rect& scissorRect) { m_skCurrentCanvas->clipRect(toSkRect(scissorRect), SkRegion::kReplace_Op); } void CCRendererSoftware::disableScissorTest() { - IntRect canvasRect(IntPoint(), viewportSize()); + gfx::Rect canvasRect(gfx::Point(), viewportSize()); m_skCurrentCanvas->clipRect(toSkRect(canvasRect), SkRegion::kReplace_Op); } @@ -160,7 +161,7 @@ void CCRendererSoftware::clearFramebuffer(DrawingFrame& frame) } } -void CCRendererSoftware::setDrawViewportSize(const IntSize& viewportSize) +void CCRendererSoftware::setDrawViewportSize(const gfx::Size& viewportSize) { } @@ -254,9 +255,8 @@ void CCRendererSoftware::drawTextureQuad(const DrawingFrame& frame, const CCText // FIXME: Add support for non-premultiplied alpha. CCResourceProvider::ScopedReadLockSoftware quadResourceLock(m_resourceProvider, quad->resourceId()); - FloatRect uvRect = quad->uvRect(); - uvRect.scale(quad->quadRect().width(), quad->quadRect().height()); - SkIRect skUvRect = toSkIRect(enclosingIntRect(uvRect)); + gfx::RectF uvRect = quad->uvRect().Scale(quad->quadRect().width(), quad->quadRect().height()); + SkIRect skUvRect = toSkIRect(gfx::ToEnclosingRect(uvRect)); if (quad->flipped()) m_skCurrentCanvas->scale(1, -1); m_skCurrentCanvas->drawBitmapRect(*quadResourceLock.skBitmap(), &skUvRect, toSkRect(quadVertexRect()), &m_skCurrentPaint); @@ -267,7 +267,7 @@ void CCRendererSoftware::drawTileQuad(const DrawingFrame& frame, const CCTileDra DCHECK(isSoftwareResource(quad->resourceId())); CCResourceProvider::ScopedReadLockSoftware quadResourceLock(m_resourceProvider, quad->resourceId()); - SkIRect uvRect = toSkIRect(IntRect(quad->textureOffset(), quad->quadRect().size())); + SkIRect uvRect = toSkIRect(gfx::Rect(quad->textureOffset(), quad->quadRect().size())); m_skCurrentCanvas->drawBitmapRect(*quadResourceLock.skBitmap(), &uvRect, toSkRect(quadVertexRect()), &m_skCurrentPaint); } |