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

Issue 151923006: Add rotation APIs in radians to SkCanvas, SkMatrix

Created:
6 years, 10 months ago by zino
Modified:
6 years, 10 months ago
Reviewers:
bsalomon, rmistry, reed1
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlesource.com/skia.git@master
Visibility:
Public.

Description

Add rotation APIs in radians to SkCanvas, SkMatrix Rotation matrix APIs in skia side accept an argument in degrees currently. However, Looking inside SkMatrix::setRotate, The degree value is changed to radian value by SkDegreesToRadians in order to calculate sin and cos. Others, such as GraphicsContext in blink are generally often used radian value instead of degree value. If we can support new rotation APIs in radians, we will be able to reduce unnecessary operations. There was already a similar case in WebKit. (https://bugs.webkit.org/show_bug.cgi?id=87317) Also, There are already two version methods in SkMatrix44. (setRotateAbout and setRotateDegreesAbout) BUG=none

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -4 lines) Patch
M include/core/SkCanvas.h View 1 chunk +6 lines, -0 lines 1 comment Download
M include/core/SkMatrix.h View 3 chunks +24 lines, -0 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 chunk +6 lines, -0 lines 0 comments Download
M src/core/SkMatrix.cpp View 1 chunk +36 lines, -4 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
zino
Please review this codes. Thank you. :)
6 years, 10 months ago (2014-02-20 06:32:20 UTC) #1
zino
Please take a look.
6 years, 10 months ago (2014-02-23 04:34:55 UTC) #2
bsalomon
Does this require changes to SkPicture to record the radian variants? https://codereview.chromium.org/151923006/diff/1/include/core/SkCanvas.h File include/core/SkCanvas.h (right): ...
6 years, 10 months ago (2014-02-24 17:35:56 UTC) #3
reed1
I don't disagree w/ the idea, but this will turn into a rather big CL ...
6 years, 10 months ago (2014-02-24 17:39:26 UTC) #4
zino
On 2014/02/24 17:39:26, reed1 wrote: > I don't disagree w/ the idea, but this will ...
6 years, 10 months ago (2014-02-25 13:00:46 UTC) #5
bsalomon
6 years, 10 months ago (2014-02-25 15:03:28 UTC) #6
On 2014/02/25 13:00:46, zino wrote:
> On 2014/02/24 17:39:26, reed1 wrote:
> > I don't disagree w/ the idea, but this will turn into a rather big CL if we
> try
> > to do it right -- update pictures at least to record/playback this new op.
> > 
> > Suggestion: for now, just make rotateRadians() be non-virtual, and have it
> call
> > rotate() by converting its argument.
> 
> Sorry, I don't understand your suggetion.
> Could you please explain details easily?

The idea is to first add the new rotate API to SkCanvas as a non-virtual
function and to implement it by converting to degrees and calling the virtual
rotate(SkScalar degrees). This won't make us faster but makes the API available
to Chrome/Blink. Those code bases can be converted to using the new API and then
we can update Skia to handle it more optimally afterwards. It's just a way of
staging the changes over more CLs.

Powered by Google App Engine
This is Rietveld 408576698