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

Unified Diff: experimental/PdfViewer/src/SkPdfDiffEncoder.cpp

Issue 1266093003: Remove experimental/PdfViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-03 (Monday) 10:43:56 EDT Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/PdfViewer/src/SkPdfContext.cpp ('k') | experimental/PdfViewer/src/SkPdfOps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/src/SkPdfDiffEncoder.cpp
diff --git a/experimental/PdfViewer/src/SkPdfDiffEncoder.cpp b/experimental/PdfViewer/src/SkPdfDiffEncoder.cpp
deleted file mode 100644
index 3ea0d37363a2e234a4390ebf51d5a6cef97687c0..0000000000000000000000000000000000000000
--- a/experimental/PdfViewer/src/SkPdfDiffEncoder.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkPdfDiffEncoder.h"
-#include "SkPdfNativeTokenizer.h"
-
-#ifdef PDF_TRACE_DIFF_IN_PNG
-#include "SkBitmap.h"
-#include "SkBitmapDevice.h"
-#include "SkCanvas.h"
-#include "SkClipStack.h"
-#include "SkColor.h"
-#include "SkImageEncoder.h"
-#include "SkPaint.h"
-#include "SkPath.h"
-#include "SkRegion.h"
-#include "SkScalar.h"
-#include "SkString.h"
-
-extern "C" SkBitmap* gDumpBitmap;
-extern "C" SkCanvas* gDumpCanvas;
-SkBitmap* gDumpBitmap = NULL;
-SkCanvas* gDumpCanvas = NULL;
-static int gReadOp;
-static int gOpCounter;
-static SkString gLastKeyword;
-#endif // PDF_TRACE_DIFF_IN_PNG
-
-void SkPdfDiffEncoder::WriteToFile(PdfToken* token) {
-#ifdef PDF_TRACE_DIFF_IN_PNG
- gReadOp++;
- gOpCounter++;
-
- // Only attempt to write if the dump bitmap and canvas are non NULL. They are set by
- // pdf_viewer_main.cpp
- if (NULL == gDumpBitmap || NULL == gDumpCanvas) {
- return;
- }
-
- // TODO(edisonn): this code is used to make a step by step history of all the draw operations
- // so we could find the step where something is wrong.
- if (!gLastKeyword.isEmpty()) {
- gDumpCanvas->flush();
-
- // Copy the existing drawing. Then we will draw the difference caused by this command,
- // highlighted with a blue border.
- SkBitmap bitmap;
- if (gDumpBitmap->copyTo(&bitmap, SkBitmap::kARGB_8888_Config)) {
-
- SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
- SkCanvas canvas(device);
-
- // draw context stuff here
- SkPaint blueBorder;
- blueBorder.setColor(SK_ColorBLUE);
- blueBorder.setStyle(SkPaint::kStroke_Style);
- blueBorder.setTextSize(SkDoubleToScalar(20));
-
- SkString str;
-
- const SkClipStack* clipStack = gDumpCanvas->getClipStack();
- if (clipStack) {
- SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart);
- const SkClipStack::Element* elem;
- double y = 0;
- int total = 0;
- while ((elem = iter.next()) != NULL) {
- total++;
- y += 30;
-
- switch (elem->getType()) {
- case SkClipStack::Element::kRect_Type:
- canvas.drawRect(elem->getRect(), blueBorder);
- canvas.drawText("Rect Clip", strlen("Rect Clip"),
- SkDoubleToScalar(10), SkDoubleToScalar(y), blueBorder);
- break;
- case SkClipStack::Element::kPath_Type:
- canvas.drawPath(elem->getPath(), blueBorder);
- canvas.drawText("Path Clip", strlen("Path Clip"),
- SkDoubleToScalar(10), SkDoubleToScalar(y), blueBorder);
- break;
- case SkClipStack::Element::kEmpty_Type:
- canvas.drawText("Empty Clip!!!", strlen("Empty Clip!!!"),
- SkDoubleToScalar(10), SkDoubleToScalar(y), blueBorder);
- break;
- default:
- canvas.drawText("Unknown Clip!!!", strlen("Unknown Clip!!!"),
- SkDoubleToScalar(10), SkDoubleToScalar(y), blueBorder);
- break;
- }
- }
-
- y += 30;
- str.printf("Number of clips in stack: %i", total);
- canvas.drawText(str.c_str(), str.size(),
- SkDoubleToScalar(10), SkDoubleToScalar(y), blueBorder);
- }
-
- const SkRegion& clipRegion = gDumpCanvas->getTotalClip();
- SkPath clipPath;
- if (clipRegion.getBoundaryPath(&clipPath)) {
- SkPaint redBorder;
- redBorder.setColor(SK_ColorRED);
- redBorder.setStyle(SkPaint::kStroke_Style);
- canvas.drawPath(clipPath, redBorder);
- }
-
- canvas.flush();
-
- SkString out;
-
- // TODO(edisonn): overlay on top of image inf about the clip , grafic state, the stack
-
- out.appendf("/tmp/log_step_by_step/step-%i-%s.png", gOpCounter, gLastKeyword.c_str());
-
- SkImageEncoder::EncodeFile(out.c_str(), bitmap, SkImageEncoder::kPNG_Type, 100);
- }
- }
-
- if (token->fType == kKeyword_TokenType && token->fKeyword && token->fKeywordLength > 0) {
- gLastKeyword.set(token->fKeyword, token->fKeywordLength);
- } else {
- gLastKeyword.reset();
- }
-#endif
-}
« no previous file with comments | « experimental/PdfViewer/src/SkPdfContext.cpp ('k') | experimental/PdfViewer/src/SkPdfOps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698