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

Side by Side Diff: printing/pdf_metafile_skia.cc

Issue 7633040: CL removing inheritance of SkDevice from PlatformDevice. Flavours of PlatformDevice classes now ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add mac changes. Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/pdf_metafile_skia.h" 5 #include "printing/pdf_metafile_skia.h"
6 6
7 #include "base/eintr_wrapper.h" 7 #include "base/eintr_wrapper.h"
8 #include "base/file_descriptor_posix.h" 8 #include "base/file_descriptor_posix.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // TODO(ctguil): Refactor: don't create the PDF device explicitly here. 64 // TODO(ctguil): Refactor: don't create the PDF device explicitly here.
65 SkISize pdf_page_size = SkISize::Make(page_size.width(), page_size.height()); 65 SkISize pdf_page_size = SkISize::Make(page_size.width(), page_size.height());
66 SkISize pdf_content_size = 66 SkISize pdf_content_size =
67 SkISize::Make(content_area.width(), content_area.height()); 67 SkISize::Make(content_area.width(), content_area.height());
68 SkRefPtr<SkPDFDevice> pdf_device = 68 SkRefPtr<SkPDFDevice> pdf_device =
69 new SkPDFDevice(pdf_page_size, pdf_content_size, transform); 69 new SkPDFDevice(pdf_page_size, pdf_content_size, transform);
70 pdf_device->unref(); // SkRefPtr and new both took a reference. 70 pdf_device->unref(); // SkRefPtr and new both took a reference.
71 skia::VectorPlatformDeviceSkia* device = 71 skia::VectorPlatformDeviceSkia* device =
72 new skia::VectorPlatformDeviceSkia(pdf_device.get()); 72 new skia::VectorPlatformDeviceSkia(pdf_device.get());
73 data_->current_page_ = device->PdfDevice(); 73 data_->current_page_ = pdf_device;
74 return device; 74 return device->GetOwningDevice();
75 } 75 }
76 76
77 bool PdfMetafileSkia::StartPage(const gfx::Size& page_size, 77 bool PdfMetafileSkia::StartPage(const gfx::Size& page_size,
78 const gfx::Rect& content_area, 78 const gfx::Rect& content_area,
79 const float& scale_factor) { 79 const float& scale_factor) {
80 NOTREACHED(); 80 NOTREACHED();
81 return NULL; 81 return NULL;
82 } 82 }
83 83
84 bool PdfMetafileSkia::FinishPage() { 84 bool PdfMetafileSkia::FinishPage() {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 SkAutoDataUnref data(pdf_stream.copyToData()); 251 SkAutoDataUnref data(pdf_stream.copyToData());
252 if (data.size() == 0) 252 if (data.size() == 0)
253 return NULL; 253 return NULL;
254 254
255 PdfMetafileSkia* metafile = new printing::PdfMetafileSkia; 255 PdfMetafileSkia* metafile = new printing::PdfMetafileSkia;
256 metafile->InitFromData(data.bytes(), data.size()); 256 metafile->InitFromData(data.bytes(), data.size());
257 return metafile; 257 return metafile;
258 } 258 }
259 259
260 } // namespace printing 260 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698