diff options
author | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 16:51:20 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 16:51:20 +0000 |
commit | e195fbf59cb3c26b7345df1a50996822c63d89cd (patch) | |
tree | b15800017960f32a4ee923e73cccd85fb1402990 /printing | |
parent | e67a7af68532ceef2b02bd228344392226e0ab34 (diff) | |
download | chromium_src-e195fbf59cb3c26b7345df1a50996822c63d89cd.zip chromium_src-e195fbf59cb3c26b7345df1a50996822c63d89cd.tar.gz chromium_src-e195fbf59cb3c26b7345df1a50996822c63d89cd.tar.bz2 |
roll skia
Review URL: http://codereview.chromium.org/7235024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/pdf_metafile_skia.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc index d335545..0ef33f2 100644 --- a/printing/pdf_metafile_skia.cc +++ b/printing/pdf_metafile_skia.cc @@ -10,6 +10,7 @@ #include "base/hash_tables.h" #include "base/metrics/histogram.h" #include "skia/ext/vector_platform_device_skia.h" +#include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkScalar.h" #include "third_party/skia/include/core/SkStream.h" @@ -125,13 +126,16 @@ bool PdfMetafileSkia::GetData(void* dst_buffer, if (dst_buffer_size < GetDataSize()) return false; - memcpy(dst_buffer, data_->pdf_stream_.getStream(), dst_buffer_size); + SkAutoDataUnref data(data_->pdf_stream_.copyToData()); + memcpy(dst_buffer, data.bytes(), dst_buffer_size); return true; } bool PdfMetafileSkia::SaveTo(const FilePath& file_path) const { DCHECK_GT(data_->pdf_stream_.getOffset(), 0U); - if (file_util::WriteFile(file_path, data_->pdf_stream_.getStream(), + SkAutoDataUnref data(data_->pdf_stream_.copyToData()); + if (file_util::WriteFile(file_path, + reinterpret_cast<const char*>(data.data()), GetDataSize()) != static_cast<int>(GetDataSize())) { DLOG(ERROR) << "Failed to save file " << file_path.value().c_str(); return false; @@ -189,9 +193,10 @@ bool PdfMetafileSkia::RenderPage(unsigned int page_number, bool center_horizontally, bool center_vertically) const { DCHECK_GT(data_->pdf_stream_.getOffset(), 0U); - if (data_->pdf_cg_.GetDataSize() == 0) - data_->pdf_cg_.InitFromData(data_->pdf_stream_.getStream(), - data_->pdf_stream_.getOffset()); + if (data_->pdf_cg_.GetDataSize() == 0) { + SkAutoDataUnref data(data_->pdf_stream_.copyToData()); + data_->pdf_cg_.InitFromData(data.bytes(), data.size()); + } return data_->pdf_cg_.RenderPage(page_number, context, rect, shrink_to_fit, stretch_to_fit, center_horizontally, center_vertically); @@ -208,7 +213,9 @@ bool PdfMetafileSkia::SaveToFD(const base::FileDescriptor& fd) const { } bool result = true; - if (file_util::WriteFileDescriptor(fd.fd, data_->pdf_stream_.getStream(), + SkAutoDataUnref data(data_->pdf_stream_.copyToData()); + if (file_util::WriteFileDescriptor(fd.fd, + reinterpret_cast<const char*>(data.data()), GetDataSize()) != static_cast<int>(GetDataSize())) { DLOG(ERROR) << "Failed to save file with fd " << fd.fd; |