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

Side by Side Diff: printing/image.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 std::vector<unsigned char> compressed; 63 std::vector<unsigned char> compressed;
64 bool success = gfx::PNGCodec::Encode(&*data_.begin(), 64 bool success = gfx::PNGCodec::Encode(&*data_.begin(),
65 gfx::PNGCodec::FORMAT_BGRA, 65 gfx::PNGCodec::FORMAT_BGRA,
66 size_, 66 size_,
67 row_length_, 67 row_length_,
68 true, 68 true,
69 std::vector<gfx::PNGCodec::Comment>(), 69 std::vector<gfx::PNGCodec::Comment>(),
70 &compressed); 70 &compressed);
71 DCHECK(success && compressed.size()); 71 DCHECK(success && compressed.size());
72 if (success) { 72 if (success) {
73 int write_bytes = file_util::WriteFile( 73 int write_bytes = base::WriteFile(
74 filepath, 74 filepath,
75 reinterpret_cast<char*>(&*compressed.begin()), 75 reinterpret_cast<char*>(&*compressed.begin()),
76 base::checked_cast<int>(compressed.size())); 76 base::checked_cast<int>(compressed.size()));
77 success = (write_bytes == static_cast<int>(compressed.size())); 77 success = (write_bytes == static_cast<int>(compressed.size()));
78 DCHECK(success); 78 DCHECK(success);
79 } 79 }
80 return success; 80 return success;
81 } 81 }
82 82
83 double Image::PercentageDifferent(const Image& rhs) const { 83 double Image::PercentageDifferent(const Image& rhs) const {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 bool Image::LoadMetafile(const std::string& data) { 151 bool Image::LoadMetafile(const std::string& data) {
152 DCHECK(!data.empty()); 152 DCHECK(!data.empty());
153 NativeMetafile metafile; 153 NativeMetafile metafile;
154 if (!metafile.InitFromData(data.data(), 154 if (!metafile.InitFromData(data.data(),
155 base::checked_cast<uint32>(data.size()))) 155 base::checked_cast<uint32>(data.size())))
156 return false; 156 return false;
157 return LoadMetafile(metafile); 157 return LoadMetafile(metafile);
158 } 158 }
159 159
160 } // namespace printing 160 } // namespace printing
OLDNEW
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698