Chromium Code Reviews| Index: cc/CCRendererSoftware.cpp |
| diff --git a/cc/CCRendererSoftware.cpp b/cc/CCRendererSoftware.cpp |
| index 89a758b4f55c6cc6c9cff52b4bc678512d089a13..2cd65360fd6eba1efc5e8c55b6159d23c23c6f9a 100644 |
| --- a/cc/CCRendererSoftware.cpp |
| +++ b/cc/CCRendererSoftware.cpp |
| @@ -19,6 +19,7 @@ |
| #include <public/WebImage.h> |
| #include <public/WebSize.h> |
| #include <public/WebTransformationMatrix.h> |
| +#include <limits> |
| using WebKit::WebCompositorSoftwareOutputDevice; |
| using WebKit::WebImage; |
| @@ -53,6 +54,20 @@ void toSkMatrix(SkMatrix* flattened, const WebTransformationMatrix& m) |
| flattened->set(8, m.m44()); |
| } |
| +bool isZero(float f) |
|
aelias_OOO_until_Jul13
2012/10/12 21:26:56
No need for this method. You can use SkScalarNear
|
| +{ |
| + return abs(f) < std::numeric_limits<float>::epsilon(); |
|
danakj
2012/10/12 21:24:37
thanks! i think this should be std::abs() as well
|
| +} |
| + |
| +bool isScaleAndTranslate(const SkMatrix& matrix) |
| +{ |
| + return isZero(matrix[SkMatrix::kMSkewX]) && |
| + isZero(matrix[SkMatrix::kMSkewY]) && |
| + isZero(matrix[SkMatrix::kMPersp0]) && |
| + isZero(matrix[SkMatrix::kMPersp1]) && |
| + isZero(matrix[SkMatrix::kMPersp2] - 1.0f); |
| +} |
| + |
| } // anonymous namespace |
| PassOwnPtr<CCRendererSoftware> CCRendererSoftware::create(CCRendererClient* client, CCResourceProvider* resourceProvider, WebCompositorSoftwareOutputDevice* outputDevice) |
| @@ -178,6 +193,10 @@ void CCRendererSoftware::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) |
| m_skCurrentCanvas->setMatrix(skDeviceMatrix); |
| m_skCurrentPaint.reset(); |
| + if (!isScaleAndTranslate(skDeviceMatrix)) { |
| + m_skCurrentPaint.setAntiAlias(true); |
| + m_skCurrentPaint.setFilterBitmap(true); |
| + } |
| if (quad->needsBlending()) { |
| m_skCurrentPaint.setAlpha(quad->opacity() * 255); |
| m_skCurrentPaint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |