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

Side by Side Diff: skia/ext/image_operations_unittest.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <cmath> 6 #include <cmath>
7 #include <iomanip> 7 #include <iomanip>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (!gfx::PNGCodec::Encode( 197 if (!gfx::PNGCodec::Encode(
198 reinterpret_cast<const unsigned char*>(bmp.getPixels()), 198 reinterpret_cast<const unsigned char*>(bmp.getPixels()),
199 color_format, gfx::Size(bmp.width(), bmp.height()), 199 color_format, gfx::Size(bmp.width(), bmp.height()),
200 static_cast<int>(bmp.rowBytes()), 200 static_cast<int>(bmp.rowBytes()),
201 false, std::vector<gfx::PNGCodec::Comment>(), &png)) { 201 false, std::vector<gfx::PNGCodec::Comment>(), &png)) {
202 FAIL() << "Failed to encode image"; 202 FAIL() << "Failed to encode image";
203 } 203 }
204 204
205 const base::FilePath fpath(path); 205 const base::FilePath fpath(path);
206 const int num_written = 206 const int num_written =
207 file_util::WriteFile(fpath, reinterpret_cast<const char*>(&png[0]), 207 base::WriteFile(fpath, reinterpret_cast<const char*>(&png[0]),
208 png.size()); 208 png.size());
209 if (num_written != static_cast<int>(png.size())) { 209 if (num_written != static_cast<int>(png.size())) {
210 FAIL() << "Failed to write dest \"" << path << '"'; 210 FAIL() << "Failed to write dest \"" << path << '"';
211 } 211 }
212 } 212 }
213 #endif // #if DEBUG_BITMAP_GENERATION 213 #endif // #if DEBUG_BITMAP_GENERATION
214 214
215 void CheckResampleToSame(skia::ImageOperations::ResizeMethod method) { 215 void CheckResampleToSame(skia::ImageOperations::ResizeMethod method) {
216 // Make our source bitmap. 216 // Make our source bitmap.
217 const int src_w = 16, src_h = 34; 217 const int src_w = 16, src_h = 34;
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 EXPECT_LE(fabs(SkColorGetA(dst_color) - a), 1.5f); 722 EXPECT_LE(fabs(SkColorGetA(dst_color) - a), 1.5f);
723 EXPECT_LE(fabs(SkColorGetR(dst_color) - r), 1.5f); 723 EXPECT_LE(fabs(SkColorGetR(dst_color) - r), 1.5f);
724 EXPECT_LE(fabs(SkColorGetG(dst_color) - g), 1.5f); 724 EXPECT_LE(fabs(SkColorGetG(dst_color) - g), 1.5f);
725 EXPECT_LE(fabs(SkColorGetB(dst_color) - b), 1.5f); 725 EXPECT_LE(fabs(SkColorGetB(dst_color) - b), 1.5f);
726 if (HasFailure()) { 726 if (HasFailure()) {
727 return; 727 return;
728 } 728 }
729 } 729 }
730 } 730 }
731 } 731 }
OLDNEW
« no previous file with comments | « remoting/host/setup/daemon_controller_delegate_mac.mm ('k') | third_party/zlib/google/zip_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698