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

Issue 2342043: High level pdf classes and pdf specific interface. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 1 month ago by Steve VanDeBogart
Modified:
14 years, 1 month ago
Reviewers:
agl
CC:
skia-review_googlegroups.com, James Hawkins, reed
Visibility:
Public.

Description

High level pdf classes and pdf specific interface. The guts of the implementation will be in SkPDFDevice and below. This is a first implementation of everything above that point. Committed: http://code.google.com/p/skia/source/detail?r=602

Patch Set 1 #

Total comments: 22

Patch Set 2 : Address agl's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+712 lines, -41 lines) Patch
M include/core/SkStream.h View 2 chunks +1 line, -1 line 0 comments Download
M include/core/SkString.h View 5 chunks +5 lines, -1 line 0 comments Download
M include/pdf/SkPDFCatalog.h View 1 2 chunks +26 lines, -7 lines 0 comments Download
A include/pdf/SkPDFDocument.h View 1 chunk +80 lines, -0 lines 0 comments Download
A include/pdf/SkPDFPage.h View 1 chunk +98 lines, -0 lines 0 comments Download
M include/pdf/SkPDFStream.h View 1 chunk +8 lines, -2 lines 0 comments Download
M include/pdf/SkPDFTypes.h View 4 chunks +19 lines, -2 lines 0 comments Download
M src/core/SkStream.cpp View 2 chunks +7 lines, -1 line 0 comments Download
M src/core/SkString.cpp View 1 3 chunks +40 lines, -1 line 0 comments Download
M src/pdf/SkPDFCatalog.cpp View 1 2 chunks +59 lines, -14 lines 0 comments Download
A src/pdf/SkPDFDocument.cpp View 1 1 chunk +186 lines, -0 lines 0 comments Download
A src/pdf/SkPDFPage.cpp View 1 1 chunk +134 lines, -0 lines 0 comments Download
M src/pdf/SkPDFStream.cpp View 3 chunks +7 lines, -5 lines 0 comments Download
M src/pdf/SkPDFTypes.cpp View 2 chunks +22 lines, -4 lines 0 comments Download
M src/pdf/pdf_files.mk View 1 chunk +2 lines, -1 line 0 comments Download
M tests/PDFPrimitivesTest.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M tests/StringTest.cpp View 1 chunk +16 lines, -0 lines 0 comments Download

Messages

Total messages: 4
Steve VanDeBogart
14 years, 1 month ago (2010-10-02 01:21:01 UTC) #1
agl
On Fri, Oct 1, 2010 at 9:21 PM, <vandebo@chromium.org> wrote: > Description: > High level ...
14 years, 1 month ago (2010-10-11 15:04:23 UTC) #2
agl
LGTM http://codereview.appspot.com/2342043/diff/1/include/pdf/SkPDFCatalog.h File include/pdf/SkPDFCatalog.h (right): http://codereview.appspot.com/2342043/diff/1/include/pdf/SkPDFCatalog.h#newcode87 include/pdf/SkPDFCatalog.h:87: // Number of object on the first page. ...
14 years, 1 month ago (2010-10-11 15:30:58 UTC) #3
Steve VanDeBogart
14 years, 1 month ago (2010-10-12 00:10:29 UTC) #4
Thanks for the review.

http://codereview.appspot.com/2342043/diff/1/include/pdf/SkPDFCatalog.h
File include/pdf/SkPDFCatalog.h (right):

http://codereview.appspot.com/2342043/diff/1/include/pdf/SkPDFCatalog.h#newco...
include/pdf/SkPDFCatalog.h:87: // Number of object on the first page.
On 2010/10/11 15:30:58, agl wrote:
> s/object/objects/

Done.

http://codereview.appspot.com/2342043/diff/1/include/pdf/SkPDFCatalog.h#newco...
include/pdf/SkPDFCatalog.h:89: // Next object number to assign. (on page > 1)
On 2010/10/11 15:30:58, agl wrote:
> move the '.' to the end or capitalise 'On' and put a period before ')'

Done.

http://codereview.appspot.com/2342043/diff/1/src/core/SkString.cpp
File src/core/SkString.cpp (right):

http://codereview.appspot.com/2342043/diff/1/src/core/SkString.cpp#newcode91
src/core/SkString.cpp:91: {
On 2010/10/11 15:30:58, agl wrote:
> at some point this file will need a style cleanup. I think the '{' of an if
> should be on the same line but I'm certain that you shouldn't change styles
> between 'if' and 'do' :)

Yea, I was trying to match style, but it seems to already be inconsistent.

http://codereview.appspot.com/2342043/diff/1/src/core/SkString.cpp#newcode109
src/core/SkString.cpp:109: while (p < stop)
On 2010/10/11 15:30:58, agl wrote:
> memcpy

Done.

http://codereview.appspot.com/2342043/diff/1/src/core/SkString.cpp#newcode113
src/core/SkString.cpp:113: return string;
On 2010/10/11 15:30:58, agl wrote:
> The string isn't NUL terminated. I assume that's deliberate and that you've
> already calculated the size.

Yup

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

http://codereview.appspot.com/2342043/diff/1/src/pdf/SkPDFDocument.cpp#newcode74
src/pdf/SkPDFDocument.cpp:74: for (int i = 1; i < fPages.count(); i++) {
On 2010/10/11 15:30:58, agl wrote:
> Starting at 1 is odd but I understand that there may be a dummy entry in
> fPages[0] because there's no page 0. Just checking.

fPages[0] is actually the first page, not a dummy entry.  The for body was
unroll for i = 0 because some of the arguments were different.  I pulled it back
into the loop and made the argument differences explicit to make things clearer.

http://codereview.appspot.com/2342043/diff/1/src/pdf/SkPDFDocument.cpp#newcode84
src/pdf/SkPDFDocument.cpp:84: fileOffset = fCatalog.setFileOffset(fPages[0],
fileOffset);
On 2010/10/11 15:30:58, agl wrote:
> Something is clearly off here. You may wish to discard the return values of
the
> first two calls, in which you shouldn't assign them at all but it looks like
you
> want +=

setFileOffset returned the updated fileoffset (arg2 plus size of the object.)  I
changed this to return just the size of the object, making these +='s

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

http://codereview.appspot.com/2342043/diff/1/src/pdf/SkPDFPage.cpp#newcode76
src/pdf/SkPDFPage.cpp:76: SkTDArray<SkPDFDict*> curNodes;
On 2010/10/11 15:30:58, agl wrote:
> One wonders if an array of SkRefPtrs wouldn't be better, although there may be
> something that I'm missing.

SkTDArray (and the other classes like it), copies the content directly, skipping
constructors and destructors.  This is why SkTDArray is only used for pointers
or simple structs.

I have been and will continue running valgrind to make sure the right things are
happening.

http://codereview.appspot.com/2342043/diff/1/src/pdf/SkPDFPage.cpp#newcode91
src/pdf/SkPDFPage.cpp:91: i++;
On 2010/10/11 15:30:58, agl wrote:
> aren't these two lines a complicated way of saying 'break'?

Indeed. Done.
Sign in to reply to this message.

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