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

Issue 1315633002: gfx: Converge scale precision related differences to single class.

Created:
5 years, 4 months ago by prashant.n
Modified:
5 years, 3 months ago
Reviewers:
danakj, vmpstr, enne (OOO)
CC:
chromium-reviews, cc-bugs_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

gfx: Converge scale precision related differences to single class. Different scale factors which are almost equal (i.e. differ by some threshold magnitude of floating point epsilon) create different tilings when content is rigourously zoomed. e.g. If scales are 7.33907556533813f and 7.33907508850098f, different tilings get created, when scale is changed from one to other. Although tiles are shared between different tilings, the contents at previous scale needs to be re-rastered with new scale. This causes unnecessary performance hit. This patch adds gfx::Scale class, which converts the scale factor with given floating point to fixed precision floating point. This makes above two scale factors appear as equal. The above two scales will get converted as given below, when precision is set as 3. 7.33907556533813 -> 7.339000225067138671875 7.33907508850098 -> 7.339000225067138671875 This patch just adds Scale class and its unit test. Using gfx::Scale class the precision related differences can be brought into single class and in it by converting the scale to fixed precision, the peformance hit could be solved. BUG=327166

Patch Set 1 #

Patch Set 2 : Corrected simple nit. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+180 lines, -0 lines) Patch
M ui/gfx/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M ui/gfx/geometry/BUILD.gn View 2 chunks +4 lines, -0 lines 0 comments Download
A ui/gfx/geometry/scale.h View 1 1 chunk +39 lines, -0 lines 0 comments Download
A ui/gfx/geometry/scale.cc View 1 chunk +84 lines, -0 lines 0 comments Download
A ui/gfx/geometry/scale_unittest.cc View 1 chunk +41 lines, -0 lines 0 comments Download
M ui/gfx/gfx.gyp View 2 chunks +4 lines, -0 lines 0 comments Download
M ui/gfx/gfx_tests.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M ui/gfx/switches.h View 1 chunk +1 line, -0 lines 0 comments Download
M ui/gfx/switches.cc View 1 chunk +5 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 11 (1 generated)
prashant.n
PTAL.
5 years, 4 months ago (2015-08-24 17:07:35 UTC) #2
enne (OOO)
This seems a bit like overkill. I think this could just be a few lines ...
5 years, 4 months ago (2015-08-24 18:57:59 UTC) #3
prashant.n
On 2015/08/24 18:57:59, enne wrote: > This seems a bit like overkill. I think this ...
5 years, 4 months ago (2015-08-25 00:08:16 UTC) #4
enne (OOO)
Using gfx::Scale elsewhere is also overkill. The only place that needs this snapping is really ...
5 years, 4 months ago (2015-08-25 00:11:43 UTC) #5
danakj
Ya I'm not sure. Can you give other examples that would be useful to have ...
5 years, 4 months ago (2015-08-25 00:20:55 UTC) #6
prashant.n
On 2015/08/25 00:20:55, danakj wrote: > Ya I'm not sure. Can you give other examples ...
5 years, 4 months ago (2015-08-25 15:46:52 UTC) #7
danakj
On 2015/08/25 15:46:52, prashant.n wrote: > On 2015/08/25 00:20:55, danakj wrote: > > Ya I'm ...
5 years, 4 months ago (2015-08-25 18:30:12 UTC) #8
prashant.n
> > If you're worried about making a different method for applying scale here, maybe ...
5 years, 4 months ago (2015-08-26 04:37:22 UTC) #9
prashant.n
> > I'll put the patch for local fix in PictureLayerImpl and will check for ...
5 years, 3 months ago (2015-08-26 16:31:12 UTC) #10
prashant.n
5 years, 3 months ago (2015-08-27 17:03:43 UTC) #11
The problems I've mentioned are very rare edge cases as based on following
assumption.

1.f / scale_factor, will give float value which will have decimal places more
than 4,
which can result into different float numbers.

Another quick fix pushed, fixes the issue mentioned in the bug 327166. So kindly
review
that CL.

Powered by Google App Engine
This is Rietveld 408576698