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

Side by Side Diff: printing/image.cc

Issue 6696076: Adding CreateFromData to NativeMetafileFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 9 years, 9 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/image.h" 5 #include "printing/image.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/md5.h" 8 #include "base/md5.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 reinterpret_cast<const unsigned char*>(compressed.c_str()), 140 reinterpret_cast<const unsigned char*>(compressed.c_str()),
141 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h); 141 compressed.size(), gfx::PNGCodec::FORMAT_BGRA, &data_, &w, &h);
142 size_.SetSize(w, h); 142 size_.SetSize(w, h);
143 row_length_ = size_.width() * sizeof(uint32); 143 row_length_ = size_.width() * sizeof(uint32);
144 return success; 144 return success;
145 } 145 }
146 146
147 bool Image::LoadMetafile(const std::string& data) { 147 bool Image::LoadMetafile(const std::string& data) {
148 DCHECK(!data.empty()); 148 DCHECK(!data.empty());
149 scoped_ptr<NativeMetafile> metafile( 149 scoped_ptr<NativeMetafile> metafile(
150 printing::NativeMetafileFactory::Create()); 150 printing::NativeMetafileFactory::CreateFromData(data.data(),
151 metafile->InitFromData(data.data(), data.size()); 151 data.size()));
vandebo (ex-Chrome) 2011/03/24 20:11:55 look for null metafile.
dpapad 2011/03/24 21:08:14 Done.
152 return LoadMetafile(*metafile); 152 return LoadMetafile(*metafile);
153 } 153 }
154 154
155 } // namespace printing 155 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698