| 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(filename.AssAbsolute(), &compressed); |
| 341 ASSERT_TRUE(compressed.size()); | 339 ASSERT_TRUE(compressed.size()); |
| 342 | 340 |
| 343 ASSERT_TRUE(gfx::PNGCodec::Decode( | 341 ASSERT_TRUE(gfx::PNGCodec::Decode( |
| 344 reinterpret_cast<const unsigned char*>(compressed.data()), | 342 reinterpret_cast<const unsigned char*>(compressed.data()), |
| 345 compressed.size(), bitmap)); | 343 compressed.size(), bitmap)); |
| 346 | 344 |
| 347 EXPECT_EQ(is_opaque, bitmap->isOpaque()); | 345 EXPECT_EQ(is_opaque, bitmap->isOpaque()); |
| 348 Premultiply(*bitmap); | 346 Premultiply(*bitmap); |
| 349 } | 347 } |
| 350 | 348 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 pcanvas_->rotate(67); | 960 pcanvas_->rotate(67); |
| 963 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 961 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
| 964 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 962 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
| 965 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); | 963 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); |
| 966 } | 964 } |
| 967 } | 965 } |
| 968 | 966 |
| 969 #endif // !defined(USE_AURA) | 967 #endif // !defined(USE_AURA) |
| 970 | 968 |
| 971 } // namespace skia | 969 } // namespace skia |
| OLD | NEW |