Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Unified Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 323013004: Clean up transform methods in GraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2nd Attempt Mac build fix Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | Source/platform/graphics/GraphicsContextTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsContext.cpp
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
index b1e34caf093615323edccf25486fdb917ac6c834..8231eb354c79a2ea4f7d265d3e449df5d5a5f742 100644
--- a/Source/platform/graphics/GraphicsContext.cpp
+++ b/Source/platform/graphics/GraphicsContext.cpp
@@ -846,7 +846,7 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& pt, float widt
if (deviceScaleFactor == 2) {
save();
- scale(FloatSize(0.5, 0.5));
+ scale(0.5, 0.5);
}
drawRect(rect, paint);
if (deviceScaleFactor == 2)
@@ -1469,30 +1469,30 @@ void GraphicsContext::rotate(float angleInRadians)
m_canvas->rotate(WebCoreFloatToSkScalar(angleInRadians * (180.0f / 3.14159265f)));
}
-void GraphicsContext::translate(float w, float h)
+void GraphicsContext::translate(float x, float y)
{
if (contextDisabled())
return;
- if (!w && !h)
+ if (!x && !y)
return;
realizeCanvasSave();
- m_canvas->translate(WebCoreFloatToSkScalar(w), WebCoreFloatToSkScalar(h));
+ m_canvas->translate(WebCoreFloatToSkScalar(x), WebCoreFloatToSkScalar(y));
}
-void GraphicsContext::scale(const FloatSize& size)
+void GraphicsContext::scale(float x, float y)
{
if (contextDisabled())
return;
- if (size.width() == 1.0f && size.height() == 1.0f)
+ if (x == 1.0f && y == 1.0f)
return;
realizeCanvasSave();
- m_canvas->scale(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(size.height()));
+ m_canvas->scale(WebCoreFloatToSkScalar(x), WebCoreFloatToSkScalar(y));
}
void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect)
@@ -1522,7 +1522,7 @@ void GraphicsContext::addURLTargetAtPoint(const String& name, const IntPoint& po
SkAnnotateNamedDestination(m_canvas, SkPoint::Make(pos.x(), pos.y()), nameData);
}
-AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
+AffineTransform GraphicsContext::getCTM() const
{
if (contextDisabled())
return AffineTransform();
@@ -1629,7 +1629,7 @@ PassOwnPtr<ImageBuffer> GraphicsContext::createCompatibleBuffer(const IntSize& s
// resolution than one pixel per unit. Also set up a corresponding scale factor on the
// graphics context.
- AffineTransform transform = getCTM(DefinitelyIncludeDeviceScale);
+ AffineTransform transform = getCTM();
IntSize scaledSize(static_cast<int>(ceil(size.width() * transform.xScale())), static_cast<int>(ceil(size.height() * transform.yScale())));
SkAlphaType alphaType = (opacityMode == Opaque) ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
@@ -1641,8 +1641,8 @@ PassOwnPtr<ImageBuffer> GraphicsContext::createCompatibleBuffer(const IntSize& s
ASSERT(surface->isValid());
OwnPtr<ImageBuffer> buffer = adoptPtr(new ImageBuffer(surface.release()));
- buffer->context()->scale(FloatSize(static_cast<float>(scaledSize.width()) / size.width(),
- static_cast<float>(scaledSize.height()) / size.height()));
+ buffer->context()->scale(static_cast<float>(scaledSize.width()) / size.width(),
+ static_cast<float>(scaledSize.height()) / size.height());
return buffer.release();
}
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | Source/platform/graphics/GraphicsContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698