skia2/experimental/PdfViewer/inc/SkPdfDiffEncoder.h
scroggo@google.com 5092adc546 Separate and update PDF_DIFF_TRACE_IN_PNG
Move its functionality out of readToken() and into its own class.
Callers of the previous readToken() now call
SkPdfNativeTokenizer::readToken(), which in turn calls a function
for writing the diff to a file, if the caller requests it and
PDF_TRACE_DIFF_IN_PNG is defined.

Do not attempt to draw a diff for compatibility sections, which we
do not draw.

Use SkString to handle string manipulation.

Hide globals only used by PDF_TRACE_DIFF_IN_PNG behind that flag.

Remove hasVisualEffects, which always returns true.

Rename gLastOpKeyword to gOpCounter for clarity.

In SkPdfNativeTokenizer, set fEmpty to true when the entire stream
has been read.

Use SkBitmap::copyTo instead of manually copying an SkBitmap.

Builds on https://codereview.chromium.org/79933003/

R=mtklein@google.com

Review URL: https://codereview.chromium.org/80463005

git-svn-id: http://skia.googlecode.com/svn/trunk@12436 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-02 20:22:31 +00:00

26 lines
788 B
C++

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkPdfDiffEncoder_DEFINED
#define SkPdfDiffEncoder_DEFINED
struct PdfToken;
namespace SkPdfDiffEncoder {
/**
* If PDF_TRACE_DIFF_IN_PNG is defined, the PDF commands so far are written
* to a file with the difference created by using this token highlighted.
* The file is named "/tmp/log_step_by_step/step-%i-%s.png", where %i is
* the number of the command and %s is the name of the command. If
* PDF_TRACE_DIFF_IN_PNG is not defined this function does nothing.
* TODO(scroggo): Pass SkPdfContext and SkCanvas for info.
*/
void WriteToFile(PdfToken*);
};
#endif // SkPdfDiffEncoder_DEFINED