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

Unified Diff: skia/ext/platform_device.cc

Issue 7719014: PrintPreview: Printing preview of a PDF on Mac with Skia only previews the last page of the PDF (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 3 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
Index: skia/ext/platform_device.cc
diff --git a/skia/ext/platform_device.cc b/skia/ext/platform_device.cc
index 9e1dde76667d7e023f0969e9364008c1210ae583..05733046b66436d4404caf2e3f96b0bb872cef3a 100644
--- a/skia/ext/platform_device.cc
+++ b/skia/ext/platform_device.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/logging.h"
#include "skia/ext/platform_device.h"
#include "third_party/skia/include/core/SkMetaData.h"
@@ -9,8 +10,15 @@
namespace skia {
namespace {
+
const char* kDevicePlatformBehaviour = "CrDevicePlatformBehaviour";
-}
+const char* kDraftModeKey = "CrDraftMode";
+
+#if defined(OS_MACOSX) || defined(OS_WIN)
+const char* kIsPreviewMetafileKey = "CrIsPreviewMetafile";
+#endif
+
+} // namespace
void SetPlatformDevice(SkDevice* device, PlatformDevice* platform_behaviour) {
SkMetaData& meta_data = device->getMetaData();
@@ -27,6 +35,42 @@ PlatformDevice* GetPlatformDevice(SkDevice* device) {
return NULL;
}
+SkMetaData& getMetaData(SkCanvas* canvas) {
+ DCHECK(canvas != NULL);
+
+ SkDevice* device = canvas->getDevice();
+ DCHECK(device != NULL);
+ return device->getMetaData();
+}
+
+void SetDraftMode(SkCanvas* canvas, bool draft_mode) {
vandebo (ex-Chrome) 2011/09/26 21:01:45 You might as well make these generic and pull them
kmadhusu 2011/09/27 00:35:14 Done.
+ SkMetaData& meta = getMetaData(canvas);
+ meta.setBool(kDraftModeKey, draft_mode);
+}
+
+bool GetDraftMode(SkCanvas* canvas) {
+ SkMetaData& meta = getMetaData(canvas);
+ bool draft_mode;
+ if (!meta.findBool(kDraftModeKey, &draft_mode))
+ draft_mode = false;
+ return draft_mode;
+}
+
+#if defined(OS_MACOSX) || defined(OS_WIN)
+void SetIsPreviewMetafile(SkCanvas* canvas, bool is_preview) {
+ SkMetaData& meta = getMetaData(canvas);
+ meta.setBool(kIsPreviewMetafileKey, is_preview);
+}
+
+bool IsPreviewMetafile(SkCanvas* canvas) {
+ SkMetaData& meta = getMetaData(canvas);
+ bool is_preview_metafile;
+ if (!meta.findBool(kIsPreviewMetafileKey, &is_preview_metafile))
+ is_preview_metafile = false;
+ return is_preview_metafile;
+}
+#endif
+
bool PlatformDevice::IsNativeFontRenderingAllowed() {
return true;
}

Powered by Google App Engine
This is Rietveld 408576698