diff options
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/PdfViewer/SkTrackDevice.h | 9 | ||||
-rw-r--r-- | experimental/PdfViewer/pdf_viewer_main.cpp | 11 | ||||
-rw-r--r-- | experimental/PdfViewer/src/SkPdfRenderer.cpp | 4 |
3 files changed, 10 insertions, 14 deletions
diff --git a/experimental/PdfViewer/SkTrackDevice.h b/experimental/PdfViewer/SkTrackDevice.h index 9280b7f247..e3e78e3097 100644 --- a/experimental/PdfViewer/SkTrackDevice.h +++ b/experimental/PdfViewer/SkTrackDevice.h @@ -13,7 +13,7 @@ /** \class SkTrackDevice * - * A Track Device is used to track that callstack of an operation that affected some pixels. + * A Track Device is used to track the callstack of an operation that affected some pixels. * It can be used with SampleApp to investigate bugs (CL not checked in yet). * * every drawFoo is implemented as such: @@ -22,12 +22,15 @@ * after(); // - checks if pixels of interest, and issue a breakpoint. * */ +// TODO: can this be derived from SkBaseDevice instead? class SkTrackDevice : public SkBitmapDevice { public: SK_DECLARE_INST_COUNT(SkTrackDevice) - SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap) - , fTracker(NULL) {} + SkTrackDevice(const SkBitmap& bitmap) + : INHERITED(bitmap, SkSurfaceProps(0, kUnknown_SkPixelGeometry)) + , fTracker(NULL) { + } virtual ~SkTrackDevice() {} diff --git a/experimental/PdfViewer/pdf_viewer_main.cpp b/experimental/PdfViewer/pdf_viewer_main.cpp index f5bfdbbd7e..94735ac49a 100644 --- a/experimental/PdfViewer/pdf_viewer_main.cpp +++ b/experimental/PdfViewer/pdf_viewer_main.cpp @@ -5,7 +5,6 @@ * found in the LICENSE file. */ -#include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkCommandLineFlags.h" #include "SkDevice.h" @@ -121,8 +120,7 @@ static bool render_page(const SkString& outputDir, // Exercise all pdf codepaths as in normal rendering, but no actual bits are changed. if (!FLAGS_config.isEmpty() && strcmp(FLAGS_config[0], "nul") == 0) { SkBitmap bitmap; - SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); - SkNulCanvas canvas(device); + SkNulCanvas canvas(bitmap); renderer.renderPage(page < 0 ? 0 : page, &canvas, rect); } else { // 8888 @@ -143,14 +141,11 @@ static bool render_page(const SkString& outputDir, setup_bitmap(&bitmap, (int)SkScalarToDouble(width), (int)SkScalarToDouble(height), background); #endif - SkAutoTUnref<SkBaseDevice> device; - if (strcmp(FLAGS_config[0], "8888") == 0) { - device.reset(SkNEW_ARGS(SkBitmapDevice, (bitmap))); - } else { + if (strcmp(FLAGS_config[0], "8888") != 0) { SkDebugf("unknown --config: %s\n", FLAGS_config[0]); return false; } - SkCanvas canvas(device); + SkCanvas canvas(bitmap); #ifdef PDF_TRACE_DIFF_IN_PNG gDumpBitmap = &bitmap; diff --git a/experimental/PdfViewer/src/SkPdfRenderer.cpp b/experimental/PdfViewer/src/SkPdfRenderer.cpp index 6a9fd74aba..b77a43ee3c 100644 --- a/experimental/PdfViewer/src/SkPdfRenderer.cpp +++ b/experimental/PdfViewer/src/SkPdfRenderer.cpp @@ -7,7 +7,6 @@ #include "SkPdfRenderer.h" -#include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkColorPriv.h" #include "SkDevice.h" @@ -2910,8 +2909,7 @@ bool SkPDFNativeRenderToBitmap(SkStream* stream, setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); - SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); - SkCanvas canvas(device); + SkCanvas canvas(*output); return renderer->renderPage(page, &canvas, rect); } |