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

Issue 23444049: Implement transform snapping for gfx::Transforms. (Closed)

Created:
7 years, 3 months ago by avallee
Modified:
7 years, 2 months ago
Reviewers:
Ian Vollick, danakj
CC:
chromium-reviews, cc-bugs_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Implement transform snapping for gfx::Transforms. Implement SnapTransform which takes a decomposed transform and viewport and tries to nudge the rotation, scale and translation values. It tries applying the inverse of the transform to the viewport. (Objects in this rect having the transform applied will end up in the viewport) If the transform maps the corners onto integer points and the corners are no more than 1 pixel away we will return success and the decomposed transform with the new rotation value. R=vollick@chromium.org BUG=280280 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=230849

Patch Set 1 #

Total comments: 14

Patch Set 2 : Fix test case to back-map correctly. Address danajk@ comments. #

Total comments: 12

Patch Set 3 : Add a test and fixed comments by vollick@. #

Total comments: 10

Patch Set 4 : Rebase to master. #

Patch Set 5 : Factor out build snapped rotation matrix. #

Patch Set 6 : Remove std::round and make epsilon a float literal. #

Total comments: 6

Patch Set 7 : Snap *ALL* the components of the transform. #

Total comments: 5

Patch Set 8 : Address danakj@ comments. #

Total comments: 2

Patch Set 9 : Add unit tests for snapping translation, scaling and a composite of all components. #

Total comments: 10

Patch Set 10 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+343 lines, -40 lines) Patch
M ui/gfx/transform_util.h View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
M ui/gfx/transform_util.cc View 1 2 3 4 5 6 7 8 9 4 chunks +192 lines, -40 lines 0 comments Download
M ui/gfx/transform_util_unittest.cc View 1 2 3 4 5 6 7 8 9 2 chunks +146 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
avallee
7 years, 3 months ago (2013-09-10 20:24:32 UTC) #1
danakj
Just some quick style nits before ian looks at it. https://codereview.chromium.org/23444049/diff/1/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/1/ui/gfx/transform_util.cc#newcode18 ...
7 years, 3 months ago (2013-09-10 20:29:51 UTC) #2
avallee
Addressed Dana's nits. Discovered that my initial test case would map the (0,0) to something ...
7 years, 3 months ago (2013-09-10 21:30:12 UTC) #3
Ian Vollick
https://codereview.chromium.org/23444049/diff/1/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/1/ui/gfx/transform_util.cc#newcode18 ui/gfx/transform_util.cc:18: const float NEAR_INT_ESPILON = 1e-10; On 2013/09/10 20:29:51, danakj ...
7 years, 3 months ago (2013-09-11 12:19:48 UTC) #4
avallee
Fixed issues. PTAL. https://codereview.chromium.org/23444049/diff/9004/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/9004/ui/gfx/transform_util.cc#newcode19 ui/gfx/transform_util.cc:19: const float kNearIntEpsilon = 1e-8; On ...
7 years, 3 months ago (2013-09-14 01:32:25 UTC) #5
Ian Vollick
https://codereview.chromium.org/23444049/diff/17001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/17001/ui/gfx/transform_util.cc#newcode198 ui/gfx/transform_util.cc:198: bool CheckTansformPoint(const PointF& point, nit: typo, but even still, ...
7 years, 3 months ago (2013-09-14 23:45:31 UTC) #6
avallee
https://codereview.chromium.org/23444049/diff/17001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/17001/ui/gfx/transform_util.cc#newcode198 ui/gfx/transform_util.cc:198: bool CheckTansformPoint(const PointF& point, On 2013/09/14 23:45:31, Ian Vollick ...
7 years, 2 months ago (2013-10-15 19:22:47 UTC) #7
avallee
Ping.
7 years, 2 months ago (2013-10-18 14:16:48 UTC) #8
Ian Vollick
https://codereview.chromium.org/23444049/diff/45001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/45001/ui/gfx/transform_util.cc#newcode26 ui/gfx/transform_util.cc:26: return (std::abs(f - std::floor(f + 0.5f)) < kNearIntEpsilon); We ...
7 years, 2 months ago (2013-10-18 14:54:45 UTC) #9
avallee
PTAL. https://codereview.chromium.org/23444049/diff/45001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/45001/ui/gfx/transform_util.cc#newcode26 ui/gfx/transform_util.cc:26: return (std::abs(f - std::floor(f + 0.5f)) < kNearIntEpsilon); ...
7 years, 2 months ago (2013-10-21 15:15:44 UTC) #10
danakj
Some driveby styleish things. https://codereview.chromium.org/23444049/diff/74001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/74001/ui/gfx/transform_util.cc#newcode124 ui/gfx/transform_util.cc:124: matrix->setTranslate(SkDoubleToMScalar(decomp.translate[0]), I find it a ...
7 years, 2 months ago (2013-10-21 15:28:42 UTC) #11
avallee
danakj@, fixed according to your comments. https://codereview.chromium.org/23444049/diff/74001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/74001/ui/gfx/transform_util.cc#newcode124 ui/gfx/transform_util.cc:124: matrix->setTranslate(SkDoubleToMScalar(decomp.translate[0]), On 2013/10/21 ...
7 years, 2 months ago (2013-10-21 15:55:55 UTC) #12
Ian Vollick
lgtm, modulo some unit tests for the new snapping functionality added in these latest patch ...
7 years, 2 months ago (2013-10-21 18:36:30 UTC) #13
avallee
https://codereview.chromium.org/23444049/diff/134001/ui/gfx/transform_util_unittest.cc File ui/gfx/transform_util_unittest.cc (right): https://codereview.chromium.org/23444049/diff/134001/ui/gfx/transform_util_unittest.cc#newcode35 ui/gfx/transform_util_unittest.cc:35: TEST(TransformUtilTest, SnapTransform) { On 2013/10/21 18:36:30, Ian Vollick wrote: ...
7 years, 2 months ago (2013-10-23 14:48:23 UTC) #14
danakj
Some last style comments, otherwise LGTM when Ian is happy. https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc#newcode207 ...
7 years, 2 months ago (2013-10-23 14:57:19 UTC) #15
danakj
On 2013/10/23 14:57:19, danakj wrote: > Some last style comments, otherwise LGTM when Ian is ...
7 years, 2 months ago (2013-10-23 14:57:45 UTC) #16
Ian Vollick
lgtm2 Thanks for the new tests. https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc#newcode133 ui/gfx/transform_util.cc:133: std::floor(decomp.translate[0] + SkDoubleToMScalar(0.5)); ...
7 years, 2 months ago (2013-10-23 19:03:13 UTC) #17
avallee
https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc#newcode133 ui/gfx/transform_util.cc:133: std::floor(decomp.translate[0] + SkDoubleToMScalar(0.5)); On 2013/10/23 19:03:13, Ian Vollick wrote: ...
7 years, 2 months ago (2013-10-23 19:44:14 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/avallee@chromium.org/23444049/284001
7 years, 2 months ago (2013-10-23 19:46:22 UTC) #19
danakj
https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc File ui/gfx/transform_util.cc (right): https://codereview.chromium.org/23444049/diff/184001/ui/gfx/transform_util.cc#newcode133 ui/gfx/transform_util.cc:133: std::floor(decomp.translate[0] + SkDoubleToMScalar(0.5)); On 2013/10/23 19:44:15, avallee wrote: > ...
7 years, 2 months ago (2013-10-23 19:49:19 UTC) #20
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 2 months ago (2013-10-23 20:19:24 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/avallee@chromium.org/23444049/494001
7 years, 2 months ago (2013-10-24 18:45:50 UTC) #22
commit-bot: I haz the power
7 years, 2 months ago (2013-10-24 22:33:26 UTC) #23
Message was sent while issue was closed.
Change committed as 230849

Powered by Google App Engine
This is Rietveld 408576698