OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/users/avatar/user_image_manager_test_uti
l.h" | 5 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_test_uti
l.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 19 matching lines...) Expand all Loading... |
30 const SkBitmap* second_bitmap = second.bitmap(); | 30 const SkBitmap* second_bitmap = second.bitmap(); |
31 if (!first_bitmap && !second_bitmap) | 31 if (!first_bitmap && !second_bitmap) |
32 return true; | 32 return true; |
33 if (!first_bitmap || !second_bitmap) | 33 if (!first_bitmap || !second_bitmap) |
34 return false; | 34 return false; |
35 | 35 |
36 const size_t size = first_bitmap->getSize(); | 36 const size_t size = first_bitmap->getSize(); |
37 if (second_bitmap->getSize() != size) | 37 if (second_bitmap->getSize() != size) |
38 return false; | 38 return false; |
39 | 39 |
40 SkAutoLockPixels first_pixel_lock(*first_bitmap); | |
41 SkAutoLockPixels second_pixel_lock(*second_bitmap); | |
42 uint8_t* first_data = reinterpret_cast<uint8_t*>(first_bitmap->getPixels()); | 40 uint8_t* first_data = reinterpret_cast<uint8_t*>(first_bitmap->getPixels()); |
43 uint8_t* second_data = reinterpret_cast<uint8_t*>(second_bitmap->getPixels()); | 41 uint8_t* second_data = reinterpret_cast<uint8_t*>(second_bitmap->getPixels()); |
44 for (size_t i = 0; i < size; ++i) { | 42 for (size_t i = 0; i < size; ++i) { |
45 if (first_data[i] != second_data[i]) | 43 if (first_data[i] != second_data[i]) |
46 return false; | 44 return false; |
47 } | 45 } |
48 return true; | 46 return true; |
49 } | 47 } |
50 | 48 |
51 ImageLoader::ImageLoader(const base::FilePath& path) : path_(path) { | 49 ImageLoader::ImageLoader(const base::FilePath& path) : path_(path) { |
(...skipping 19 matching lines...) Expand all Loading... |
71 new gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f))); | 69 new gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f))); |
72 run_loop_.Quit(); | 70 run_loop_.Quit(); |
73 } | 71 } |
74 | 72 |
75 void ImageLoader::OnDecodeImageFailed() { | 73 void ImageLoader::OnDecodeImageFailed() { |
76 run_loop_.Quit(); | 74 run_loop_.Quit(); |
77 } | 75 } |
78 | 76 |
79 } // namespace test | 77 } // namespace test |
80 } // namespace chromeos | 78 } // namespace chromeos |
OLD | NEW |