Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4062)

Issue 5516043: [PDF] Fix some scalar/int assumptions. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 6 months ago by Steve VanDeBogart
Modified:
12 years, 6 months ago
Reviewers:
epoger, reed1
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlecode.com/svn/trunk
Visibility:
Public.

Description

[PDF] Fix some scalar/int assumptions. Committed: http://code.google.com/p/skia/source/detail?r=2975

Patch Set 1 #

Total comments: 11

Patch Set 2 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -16 lines) Patch
M gm/drawbitmaprect.cpp View 1 chunk +1 line, -1 line 0 comments Download
M src/pdf/SkPDFDevice.cpp View 1 8 chunks +12 lines, -8 lines 0 comments Download
M src/pdf/SkPDFGraphicState.cpp View 1 chunk +1 line, -1 line 0 comments Download
M src/pdf/SkPDFShader.cpp View 6 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 6
Steve VanDeBogart
This doesn't fix all the PDF fixed gm's, but it's a good start.
12 years, 6 months ago (2012-01-05 00:11:05 UTC) #1
epoger
L mostly G T M, but one major concern and a few suggestions. http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFDevice.cpp File ...
12 years, 6 months ago (2012-01-05 14:30:07 UTC) #2
Steve VanDeBogart
http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFDevice.cpp File src/pdf/SkPDFDevice.cpp (right): http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFDevice.cpp#newcode286 src/pdf/SkPDFDevice.cpp:286: const SkIPoint& translation) { On 2012/01/05 14:30:08, epoger wrote: ...
12 years, 6 months ago (2012-01-05 17:47:58 UTC) #3
reed1
http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFGraphicState.cpp File src/pdf/SkPDFGraphicState.cpp (right): http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFGraphicState.cpp#newcode203 src/pdf/SkPDFGraphicState.cpp:203: new SkPDFScalar(SkScalarDiv(fPaint.getAlpha(), 0xFF)); On 2012/01/05 17:47:58, Steve VanDeBogart wrote: ...
12 years, 6 months ago (2012-01-05 18:14:04 UTC) #4
reed1
http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFDevice.cpp File src/pdf/SkPDFDevice.cpp (right): http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFDevice.cpp#newcode286 src/pdf/SkPDFDevice.cpp:286: const SkIPoint& translation) { On 2012/01/05 17:47:58, Steve VanDeBogart ...
12 years, 6 months ago (2012-01-05 18:17:32 UTC) #5
epoger
12 years, 6 months ago (2012-01-05 18:37:35 UTC) #6
LGTM

http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFGraphicState.cpp
File src/pdf/SkPDFGraphicState.cpp (right):

http://codereview.appspot.com/5516043/diff/1/src/pdf/SkPDFGraphicState.cpp#ne...
src/pdf/SkPDFGraphicState.cpp:203: new
SkPDFScalar(SkScalarDiv(fPaint.getAlpha(), 0xFF));
On 2012/01/05 18:14:04, reed1 wrote:
> On 2012/01/05 17:47:58, Steve VanDeBogart wrote:
> > On 2012/01/05 14:30:08, epoger wrote:
> > > I don't think this is correct... interpretation of 0xFF will vary
depending
> on
> > > whether SK_SCALAR_IS_FLOAT.  Right?
> > 
> > But the numerator's interpretation changes in the same way, i.e. 192/255 vs
> > (192/65536)/(255/65536).  The old code theoretically did the same thing, but
I
> > can't figure out why it wasn't working.  This works.
> 
> SkScalarDiv(int, int) will always do the right thing.

Ah, I see.  I assumed that fPaint.getAlpha() returned SkScalar, but it
doesn't... it returns an integer.  And since both the numerator and denominator
are integers, SkScalarDiv works fine.

I think it would be slightly clearer as follows, but I'm happy either way:
  new SkPDFScalar(SkIntToScalar(fPaint.getAlpha()) / 0xFF)
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b