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

Unified Diff: printing/pdf_metafile_skia.cc

Issue 7235024: roll skia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 | « DEPS ('k') | skia/skia.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_metafile_skia.cc
===================================================================
--- printing/pdf_metafile_skia.cc (revision 90594)
+++ printing/pdf_metafile_skia.cc (working copy)
@@ -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 @@
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 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 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;
« no previous file with comments | « DEPS ('k') | skia/skia.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698