| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 invalidBitmap.setPixelRef(pixelRef.get()); | 176 invalidBitmap.setPixelRef(pixelRef.get()); |
| 177 RefPtr<BitmapImage> image = BitmapImage::createWithOrientationForTesting( | 177 RefPtr<BitmapImage> image = BitmapImage::createWithOrientationForTesting( |
| 178 invalidBitmap, OriginRightTop); | 178 invalidBitmap, OriginRightTop); |
| 179 | 179 |
| 180 // Create a DragImage from it. In MSAN builds, this will cause a failure if | 180 // Create a DragImage from it. In MSAN builds, this will cause a failure if |
| 181 // the pixel memory is not initialized, if we have to respect non-default | 181 // the pixel memory is not initialized, if we have to respect non-default |
| 182 // orientation. | 182 // orientation. |
| 183 std::unique_ptr<DragImage> dragImage = | 183 std::unique_ptr<DragImage> dragImage = |
| 184 DragImage::create(image.get(), RespectImageOrientation); | 184 DragImage::create(image.get(), RespectImageOrientation); |
| 185 | 185 |
| 186 // With an invalid pixel ref, BitmapImage should have no backing SkImage => we
don't allocate | 186 // With an invalid pixel ref, BitmapImage should have no backing SkImage => |
| 187 // a DragImage. | 187 // we don't allocate a DragImage. |
| 188 ASSERT_FALSE(dragImage); | 188 ASSERT_FALSE(dragImage); |
| 189 } | 189 } |
| 190 | 190 |
| 191 TEST(DragImageTest, InterpolationNone) { | 191 TEST(DragImageTest, InterpolationNone) { |
| 192 SkBitmap expectedBitmap; | 192 SkBitmap expectedBitmap; |
| 193 expectedBitmap.allocN32Pixels(4, 4); | 193 expectedBitmap.allocN32Pixels(4, 4); |
| 194 { | 194 { |
| 195 SkAutoLockPixels lock(expectedBitmap); | 195 SkAutoLockPixels lock(expectedBitmap); |
| 196 expectedBitmap.eraseArea(SkIRect::MakeXYWH(0, 0, 2, 2), 0xFFFFFFFF); | 196 expectedBitmap.eraseArea(SkIRect::MakeXYWH(0, 0, 2, 2), 0xFFFFFFFF); |
| 197 expectedBitmap.eraseArea(SkIRect::MakeXYWH(0, 2, 2, 2), 0xFF000000); | 197 expectedBitmap.eraseArea(SkIRect::MakeXYWH(0, 2, 2, 2), 0xFF000000); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 219 { | 219 { |
| 220 SkAutoLockPixels lock1(dragBitmap); | 220 SkAutoLockPixels lock1(dragBitmap); |
| 221 SkAutoLockPixels lock2(expectedBitmap); | 221 SkAutoLockPixels lock2(expectedBitmap); |
| 222 for (int x = 0; x < dragBitmap.width(); ++x) | 222 for (int x = 0; x < dragBitmap.width(); ++x) |
| 223 for (int y = 0; y < dragBitmap.height(); ++y) | 223 for (int y = 0; y < dragBitmap.height(); ++y) |
| 224 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y)); | 224 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y)); |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace blink | 228 } // namespace blink |
| OLD | NEW |