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

Side by Side Diff: skia/ext/vector_canvas_unittest.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if !defined(OS_WIN) 7 #if !defined(OS_WIN)
8 #include <unistd.h> 8 #include <unistd.h>
9 #endif 9 #endif
10 10
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 (SkColorGetG(color) * 255 + alpha_offset) / alpha, 327 (SkColorGetG(color) * 255 + alpha_offset) / alpha,
328 (SkColorGetB(color) * 255 + alpha_offset) / alpha); 328 (SkColorGetB(color) * 255 + alpha_offset) / alpha);
329 } 329 }
330 } 330 }
331 } 331 }
332 } 332 }
333 333
334 void LoadPngFileToSkBitmap(const base::FilePath& filename, 334 void LoadPngFileToSkBitmap(const base::FilePath& filename,
335 SkBitmap* bitmap, 335 SkBitmap* bitmap,
336 bool is_opaque) { 336 bool is_opaque) {
337 base::FilePath absolute_path(filename);
338 file_util::AbsolutePath(&absolute_path);
339 std::string compressed; 337 std::string compressed;
340 file_util::ReadFileToString(absolute_path, &compressed); 338 file_util::ReadFileToString(base::MakeAbsoluteFilePath(filename),
339 &compressed);
341 ASSERT_TRUE(compressed.size()); 340 ASSERT_TRUE(compressed.size());
342 341
343 ASSERT_TRUE(gfx::PNGCodec::Decode( 342 ASSERT_TRUE(gfx::PNGCodec::Decode(
344 reinterpret_cast<const unsigned char*>(compressed.data()), 343 reinterpret_cast<const unsigned char*>(compressed.data()),
345 compressed.size(), bitmap)); 344 compressed.size(), bitmap));
346 345
347 EXPECT_EQ(is_opaque, bitmap->isOpaque()); 346 EXPECT_EQ(is_opaque, bitmap->isOpaque());
348 Premultiply(*bitmap); 347 Premultiply(*bitmap);
349 } 348 }
350 349
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 pcanvas_->rotate(67); 961 pcanvas_->rotate(67);
963 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); 962 vcanvas_->drawBitmap(bitmap, 20, -50, NULL);
964 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); 963 pcanvas_->drawBitmap(bitmap, 20, -50, NULL);
965 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); 964 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate")));
966 } 965 }
967 } 966 }
968 967
969 #endif // !defined(USE_AURA) 968 #endif // !defined(USE_AURA)
970 969
971 } // namespace skia 970 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698