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

Unified Diff: printing/metafile_skia_wrapper.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
« no previous file with comments | « printing/metafile_skia_wrapper.h ('k') | skia/ext/platform_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/metafile_skia_wrapper.cc
diff --git a/printing/metafile_skia_wrapper.cc b/printing/metafile_skia_wrapper.cc
index cc7fa0880417fac2f3dfc066bfae97f04d72e272..ee24a667dba7bc0e9ac23d443fa670e1f7adfb50 100644
--- a/printing/metafile_skia_wrapper.cc
+++ b/printing/metafile_skia_wrapper.cc
@@ -2,8 +2,8 @@
// 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 "printing/metafile_skia_wrapper.h"
+#include "skia/ext/platform_device.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkMetaData.h"
@@ -12,34 +12,25 @@ namespace printing {
namespace {
-const char* kDraftModeKey = "CrDraftMode";
const char* kMetafileKey = "CrMetafile";
-SkMetaData& getMetaData(SkCanvas* canvas) {
- DCHECK(canvas != NULL);
-
- SkDevice* device = canvas->getDevice();
- DCHECK(device != NULL);
- return device->getMetaData();
-}
-
} // namespace
// static
-void MetafileSkiaWrapper::SetMetafileOnCanvas(SkCanvas* canvas,
+void MetafileSkiaWrapper::SetMetafileOnCanvas(const SkCanvas& canvas,
Metafile* metafile) {
MetafileSkiaWrapper* wrapper = NULL;
if (metafile)
wrapper = new MetafileSkiaWrapper(metafile);
- SkMetaData& meta = getMetaData(canvas);
+ SkMetaData& meta = skia::getMetaData(canvas);
meta.setRefCnt(kMetafileKey, wrapper);
SkSafeUnref(wrapper);
}
// static
-Metafile* MetafileSkiaWrapper::GetMetafileFromCanvas(SkCanvas* canvas) {
- SkMetaData& meta = getMetaData(canvas);
+Metafile* MetafileSkiaWrapper::GetMetafileFromCanvas(const SkCanvas& canvas) {
+ SkMetaData& meta = skia::getMetaData(canvas);
SkRefCnt* value;
if (!meta.findRefCnt(kMetafileKey, &value) || !value)
return NULL;
@@ -47,21 +38,6 @@ Metafile* MetafileSkiaWrapper::GetMetafileFromCanvas(SkCanvas* canvas) {
return static_cast<MetafileSkiaWrapper*>(value)->metafile_;
}
-// static
-void MetafileSkiaWrapper::SetDraftMode(SkCanvas* canvas, bool draft_mode) {
- SkMetaData& meta = getMetaData(canvas);
- meta.setBool(kDraftModeKey, draft_mode);
-}
-
-// static
-bool MetafileSkiaWrapper::GetDraftMode(SkCanvas* canvas) {
- SkMetaData& meta = getMetaData(canvas);
- bool draft_mode;
- if (!meta.findBool(kDraftModeKey, &draft_mode))
- draft_mode = false;
- return draft_mode;
-}
-
MetafileSkiaWrapper::MetafileSkiaWrapper(Metafile* metafile)
: metafile_(metafile) {
}
« no previous file with comments | « printing/metafile_skia_wrapper.h ('k') | skia/ext/platform_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698