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

Unified Diff: cc/software_renderer.cc

Issue 11121008: Use antialiasing and bitmap filtering when needed in software compositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/software_renderer.cc
diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc
index 6ea015113ca3babd0a363143adc4f8a6ee377b26..ba7b2f4714228c06404e03c277babe5902b8c58f 100644
--- a/cc/software_renderer.cc
+++ b/cc/software_renderer.cc
@@ -53,6 +53,15 @@ void toSkMatrix(SkMatrix* flattened, const WebTransformationMatrix& m)
flattened->set(8, m.m44());
}
+bool isScaleAndTranslate(const SkMatrix& matrix)
+{
+ return SkScalarNearlyZero(matrix[SkMatrix::kMSkewX]) &&
+ SkScalarNearlyZero(matrix[SkMatrix::kMSkewY]) &&
+ SkScalarNearlyZero(matrix[SkMatrix::kMPersp0]) &&
+ SkScalarNearlyZero(matrix[SkMatrix::kMPersp1]) &&
+ SkScalarNearlyZero(matrix[SkMatrix::kMPersp2] - 1.0f);
+}
+
} // anonymous namespace
PassOwnPtr<CCRendererSoftware> CCRendererSoftware::create(CCRendererClient* client, CCResourceProvider* resourceProvider, WebCompositorSoftwareOutputDevice* outputDevice)
@@ -178,6 +187,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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698