0

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
This commit is contained in:
reed@google.com
2011-06-27 16:51:20 +00:00
parent e67a7af685
commit e195fbf59c
3 changed files with 16 additions and 7 deletions

2
DEPS

@ -16,7 +16,7 @@ vars = {
"libjingle_revision": "66",
"libvpx_revision": "90416",
"ffmpeg_revision": "88382",
"skia_revision": "1690",
"skia_revision": "1722",
"v8_revision": "8431",
"webrtc_revision": "90",
}

@ -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;

@ -311,6 +311,7 @@
'../third_party/skia/src/core/SkCoreBlitters.h',
'../third_party/skia/src/core/SkCubicClipper.cpp',
'../third_party/skia/src/core/SkCubicClipper.h',
'../third_party/skia/src/core/SkData.cpp',
'../third_party/skia/src/core/SkDebug.cpp',
#'../third_party/skia/src/core/SkDebug_stdio.cpp',
'../third_party/skia/src/core/SkDeque.cpp',
@ -527,6 +528,7 @@
'../third_party/skia/include/core/SkColorPriv.h',
'../third_party/skia/include/core/SkColorShader.h',
'../third_party/skia/include/core/SkComposeShader.h',
'../third_party/skia/include/core/SkData.h',
'../third_party/skia/include/core/SkDeque.h',
'../third_party/skia/include/core/SkDescriptor.h',
'../third_party/skia/include/core/SkDevice.h',