OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |