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