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

Issue 1693683002: Change ScalarTo256 to more efficient implementation. (Closed)

Created:
4 years, 10 months ago by dogben
Modified:
4 years, 10 months ago
Reviewers:
mtklein, reed1
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Change ScalarTo256 to more efficient implementation. The previous implementation was likely more efficient when SkScalar was SkFixed. BUG=skia:4632 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1693683002 Committed: https://skia.googlesource.com/skia/+/e6af96a88901b3c6f0c27575197a93db6cb04042

Patch Set 1 #

Total comments: 2

Patch Set 2 : Assume SkScalar is floating point. #

Total comments: 1

Patch Set 3 : Indent. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -8 lines) Patch
M src/core/SkDraw.cpp View 1 2 1 chunk +1 line, -8 lines 0 comments Download

Messages

Total messages: 26 (12 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1693683002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1693683002/1
4 years, 10 months ago (2016-02-12 00:23:47 UTC) #3
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 10 months ago (2016-02-12 00:46:21 UTC) #5
dogben
4 years, 10 months ago (2016-02-12 16:14:04 UTC) #7
mtklein
https://codereview.chromium.org/1693683002/diff/1/src/core/SkDraw.cpp File src/core/SkDraw.cpp (right): https://codereview.chromium.org/1693683002/diff/1/src/core/SkDraw.cpp#newcode1764 src/core/SkDraw.cpp:1764: return SkScalarTruncToInt(SkScalarMul(SkScalarPin(v, 0, SK_Scalar1), Let's write (int)(SkScalarPin(v,0,1) * 256) ...
4 years, 10 months ago (2016-02-12 17:19:57 UTC) #8
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1693683002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1693683002/20001
4 years, 10 months ago (2016-02-12 17:52:12 UTC) #10
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 10 months ago (2016-02-12 18:28:43 UTC) #12
dogben
https://codereview.chromium.org/1693683002/diff/1/src/core/SkDraw.cpp File src/core/SkDraw.cpp (right): https://codereview.chromium.org/1693683002/diff/1/src/core/SkDraw.cpp#newcode1764 src/core/SkDraw.cpp:1764: return SkScalarTruncToInt(SkScalarMul(SkScalarPin(v, 0, SK_Scalar1), On 2016/02/12 at 17:19:57, mtklein ...
4 years, 10 months ago (2016-02-12 18:32:29 UTC) #13
mtklein
lgtm https://codereview.chromium.org/1693683002/diff/20001/src/core/SkDraw.cpp File src/core/SkDraw.cpp (right): https://codereview.chromium.org/1693683002/diff/20001/src/core/SkDraw.cpp#newcode1764 src/core/SkDraw.cpp:1764: return static_cast<int>(SkScalarPin(v, 0, 1) * 256); 4 space ...
4 years, 10 months ago (2016-02-12 18:34:44 UTC) #14
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1693683002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1693683002/40001
4 years, 10 months ago (2016-02-12 18:43:16 UTC) #16
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 10 months ago (2016-02-12 19:08:19 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1693683002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1693683002/40001
4 years, 10 months ago (2016-02-12 20:15:16 UTC) #21
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://skia.googlesource.com/skia/+/e6af96a88901b3c6f0c27575197a93db6cb04042
4 years, 10 months ago (2016-02-12 20:19:17 UTC) #23
reed1
what are the differences between the impls? Should we consider either of these... (int)(x * ...
4 years, 10 months ago (2016-02-13 12:04:15 UTC) #25
dogben
4 years, 10 months ago (2016-02-16 18:37:21 UTC) #26
Message was sent while issue was closed.
On 2016/02/13 at 12:04:15, reed wrote:
> what are the differences between the impls?
> 
> Should we consider either of these...
> 
> (int)(x * 256.999f)
> (int)(x * 256 + 0.5f)

Here are the outputs from each of these impls:
https://x20web.corp.google.com/~benjaminwagner/review/1693683002/

to-fixed-shift8-p1 = before this CL
x256 = after this CL
x256.999 = static_cast<int>(SkScalarPin(v, 0, 1) * 256.999f)
x256p0.5 = static_cast<int>(SkScalarPin(v, 0, 1) * 256 + 0.5f)

The differences are most noticeable in the saddles of 565/gm/patch_grid.png, and
somewhat in the center of 565/gm/patch_primitive.png.

To my eye, there's very little difference between the three x256* impls.

Powered by Google App Engine
This is Rietveld 408576698