diff options
author | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 12:18:30 +0000 |
---|---|---|
committer | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 12:18:30 +0000 |
commit | d1a56f05be296acedfab104659f042395804c0b2 (patch) | |
tree | 0f6f04d4e736c79080ade2db6722045b014274ab /ui/gfx/transform.cc | |
parent | 364aaef8112e73e370b759e7a45bb0bd6164ada1 (diff) | |
download | chromium_src-d1a56f05be296acedfab104659f042395804c0b2.zip chromium_src-d1a56f05be296acedfab104659f042395804c0b2.tar.gz chromium_src-d1a56f05be296acedfab104659f042395804c0b2.tar.bz2 |
Use nearest neighbor filtering for non-translated quads
Draw tiled layer quads that only have a translation transformation
component using nearest neighbor filtering instead of bilinear
filtering. This has two advantages:
1. On some GPUs this can reduce memory bandwidth usage due to increased
texture cache hit rate.
2. Linear filtering is known to give slightly different results on
different GPUs because of differences in the texture sampling
hardware. Avoiding bilinear filtering in the common case (i.e., when
CSS transformation aren't used) makes WebKit layout test pixel dumps
better comparable across different devices.
TEST=ResourceProviderTest.ScopedSampler, GLRendererTest2.activeTextureState, manual testing with composited websites.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11358181
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/transform.cc')
-rw-r--r-- | ui/gfx/transform.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc index 8fe4373..54793ea 100644 --- a/ui/gfx/transform.cc +++ b/ui/gfx/transform.cc @@ -248,6 +248,18 @@ bool Transform::IsIdentityOrTranslation() const { return has_no_perspective && has_no_rotation_or_skew && has_no_scale; } +bool Transform::IsIdentityOrIntegerTranslation() const { + if (!IsIdentityOrTranslation()) + return false; + + bool no_fractional_translation = + static_cast<int>(matrix_.getDouble(0, 3)) == matrix_.getDouble(0, 3) && + static_cast<int>(matrix_.getDouble(1, 3)) == matrix_.getDouble(1, 3) && + static_cast<int>(matrix_.getDouble(2, 3)) == matrix_.getDouble(2, 3); + + return no_fractional_translation; +} + bool Transform::IsScaleOrTranslation() const { if (matrix_.isIdentity()) return true; |