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

Unified Diff: cc/software_renderer.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to tip of tree and addressed feedback Created 8 years, 1 month 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
Index: cc/software_renderer.cc
diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc
index 58c54253f443409f29285f6f0676b889135335c1..9526a781a69ebc38317c1eaf8ea26149c54646fb 100644
--- a/cc/software_renderer.cc
+++ b/cc/software_renderer.cc
@@ -4,8 +4,13 @@
#include "cc/software_renderer.h"
+#include <public/WebCompositorSoftwareOutputDevice.h>
+#include <public/WebImage.h>
+#include <public/WebSize.h>
+
#include "base/debug/trace_event.h"
#include "cc/debug_border_draw_quad.h"
+#include "cc/math_util.h"
#include "cc/render_pass_draw_quad.h"
#include "cc/solid_color_draw_quad.h"
#include "cc/texture_draw_quad.h"
@@ -17,31 +22,28 @@
#include "third_party/skia/include/effects/SkLayerRasterizer.h"
#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/skia_util.h"
-#include <public/WebCompositorSoftwareOutputDevice.h>
-#include <public/WebImage.h>
-#include <public/WebSize.h>
-#include <public/WebTransformationMatrix.h>
+#include "ui/gfx/transform.h"
using WebKit::WebCompositorSoftwareOutputDevice;
using WebKit::WebSize;
-using WebKit::WebTransformationMatrix;
+using gfx::Transform;
namespace cc {
namespace {
-void toSkMatrix(SkMatrix* flattened, const WebTransformationMatrix& m)
+void toSkMatrix(SkMatrix* flattened, const Transform& m)
{
// Convert from 4x4 to 3x3 by dropping the third row and column.
- flattened->set(0, SkDoubleToScalar(m.m11()));
- flattened->set(1, SkDoubleToScalar(m.m21()));
- flattened->set(2, SkDoubleToScalar(m.m41()));
- flattened->set(3, SkDoubleToScalar(m.m12()));
- flattened->set(4, SkDoubleToScalar(m.m22()));
- flattened->set(5, SkDoubleToScalar(m.m42()));
- flattened->set(6, SkDoubleToScalar(m.m14()));
- flattened->set(7, SkDoubleToScalar(m.m24()));
- flattened->set(8, SkDoubleToScalar(m.m44()));
+ flattened->set(0, SkDoubleToScalar(m.matrix().getDouble(0, 0)));
+ flattened->set(1, SkDoubleToScalar(m.matrix().getDouble(0, 1)));
+ flattened->set(2, SkDoubleToScalar(m.matrix().getDouble(0, 3)));
+ flattened->set(3, SkDoubleToScalar(m.matrix().getDouble(1, 0)));
+ flattened->set(4, SkDoubleToScalar(m.matrix().getDouble(1, 1)));
+ flattened->set(5, SkDoubleToScalar(m.matrix().getDouble(1, 3)));
+ flattened->set(6, SkDoubleToScalar(m.matrix().getDouble(3, 0)));
+ flattened->set(7, SkDoubleToScalar(m.matrix().getDouble(3, 1)));
+ flattened->set(8, SkDoubleToScalar(m.matrix().getDouble(3, 3)));
}
bool isScaleAndTranslate(const SkMatrix& matrix)
@@ -184,9 +186,9 @@ bool SoftwareRenderer::isSoftwareResource(ResourceProvider::ResourceId id) const
void SoftwareRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad)
{
TRACE_EVENT0("cc", "SoftwareRenderer::drawQuad");
- WebTransformationMatrix quadRectMatrix;
+ Transform quadRectMatrix;
quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect);
- WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * frame.projectionMatrix * quadRectMatrix).to2dTransform();
+ Transform contentsDeviceTransform = MathUtil::to2dTransform(frame.windowMatrix * frame.projectionMatrix * quadRectMatrix);
SkMatrix skDeviceMatrix;
toSkMatrix(&skDeviceMatrix, contentsDeviceTransform);
m_skCurrentCanvas->setMatrix(skDeviceMatrix);

Powered by Google App Engine
This is Rietveld 408576698