aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-06-22 09:46:59 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-22 09:46:59 -0700
commit9a53fd7c41554630124522f4b6eedc16912abbb7 (patch)
tree20550e4369717dfa1082ba4913a4dc646d040b5e /experimental
parent462a33c7ac6ad82ac3511884d6448491e9e9a647 (diff)
Begin kLegacyFontHost_InitType cleanup
This CL starts the process of pushing kLegacyFontHost_InitType-type SkSurfaceProps up the call stack and out of Skia. It: Gets rid of the default SkBaseDevice ctor. This means everyone has to always hand an explicit SkSurfaceProps to it. It makes public the SkBitmapDevice creation methods that require SkSurfaceProps. Removes (in Skia's code base) all SkBitmapDevice ctor calls w/o SkSurfaceProps. Makes the "recording" canvases (e.g., pdf, svg, xps) explicitly not use kLegacyFontHost_InitType. Replicates the creating canvas/device's flags on saveLayer devices BUG=skia:3934 Review URL: https://codereview.chromium.org/1204433002
Diffstat (limited to 'experimental')
-rw-r--r--experimental/PdfViewer/SkTrackDevice.h9
-rw-r--r--experimental/PdfViewer/pdf_viewer_main.cpp11
-rw-r--r--experimental/PdfViewer/src/SkPdfRenderer.cpp4
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);
}