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 // TODO(awalker): clean up the const/non-const reference handling in this test | 5 // TODO(awalker): clean up the const/non-const reference handling in this test |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
10 #import <ApplicationServices/ApplicationServices.h> | 10 #import <ApplicationServices/ApplicationServices.h> |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 406 |
407 EXPECT_TRUE(platform_bitmap->Allocate(kWidth, kHeight, /*is_opaque=*/false)); | 407 EXPECT_TRUE(platform_bitmap->Allocate(kWidth, kHeight, /*is_opaque=*/false)); |
408 | 408 |
409 EXPECT_TRUE(0 != platform_bitmap->GetSurface()); | 409 EXPECT_TRUE(0 != platform_bitmap->GetSurface()); |
410 EXPECT_FALSE(platform_bitmap->GetBitmap().empty()); | 410 EXPECT_FALSE(platform_bitmap->GetBitmap().empty()); |
411 EXPECT_FALSE(platform_bitmap->GetBitmap().isNull()); | 411 EXPECT_FALSE(platform_bitmap->GetBitmap().isNull()); |
412 EXPECT_EQ(kWidth, platform_bitmap->GetBitmap().width()); | 412 EXPECT_EQ(kWidth, platform_bitmap->GetBitmap().width()); |
413 EXPECT_EQ(kHeight, platform_bitmap->GetBitmap().height()); | 413 EXPECT_EQ(kHeight, platform_bitmap->GetBitmap().height()); |
414 EXPECT_LE(static_cast<size_t>(platform_bitmap->GetBitmap().width()*4), | 414 EXPECT_LE(static_cast<size_t>(platform_bitmap->GetBitmap().width()*4), |
415 platform_bitmap->GetBitmap().rowBytes()); | 415 platform_bitmap->GetBitmap().rowBytes()); |
416 EXPECT_EQ(SkBitmap::kARGB_8888_Config, // Same for all platforms. | 416 EXPECT_EQ(kN32_SkColorType, // Same for all platforms. |
417 platform_bitmap->GetBitmap().config()); | 417 platform_bitmap->GetBitmap().colorType()); |
418 EXPECT_TRUE(platform_bitmap->GetBitmap().lockPixelsAreWritable()); | 418 EXPECT_TRUE(platform_bitmap->GetBitmap().lockPixelsAreWritable()); |
419 EXPECT_TRUE(platform_bitmap->GetBitmap().pixelRef()->isLocked()); | 419 EXPECT_TRUE(platform_bitmap->GetBitmap().pixelRef()->isLocked()); |
420 EXPECT_EQ(1, platform_bitmap->GetBitmap().pixelRef()->getRefCnt()); | 420 EXPECT_EQ(1, platform_bitmap->GetBitmap().pixelRef()->getRefCnt()); |
421 | 421 |
422 *(platform_bitmap->GetBitmap().getAddr32(10, 20)) = 0xDEED1020; | 422 *(platform_bitmap->GetBitmap().getAddr32(10, 20)) = 0xDEED1020; |
423 *(platform_bitmap->GetBitmap().getAddr32(20, 30)) = 0xDEED2030; | 423 *(platform_bitmap->GetBitmap().getAddr32(20, 30)) = 0xDEED2030; |
424 | 424 |
425 SkBitmap sk_bitmap = platform_bitmap->GetBitmap(); | 425 SkBitmap sk_bitmap = platform_bitmap->GetBitmap(); |
426 sk_bitmap.lockPixels(); | 426 sk_bitmap.lockPixels(); |
427 | 427 |
(...skipping 20 matching lines...) Expand all Loading... |
448 | 448 |
449 sk_bitmap.lockPixels(); | 449 sk_bitmap.lockPixels(); |
450 EXPECT_EQ(0xDEED1020, *sk_bitmap.getAddr32(10, 20)); | 450 EXPECT_EQ(0xDEED1020, *sk_bitmap.getAddr32(10, 20)); |
451 EXPECT_EQ(0xDEED2030, *sk_bitmap.getAddr32(20, 30)); | 451 EXPECT_EQ(0xDEED2030, *sk_bitmap.getAddr32(20, 30)); |
452 EXPECT_EQ(0xDEED3040, *sk_bitmap.getAddr32(30, 40)); | 452 EXPECT_EQ(0xDEED3040, *sk_bitmap.getAddr32(30, 40)); |
453 sk_bitmap.unlockPixels(); | 453 sk_bitmap.unlockPixels(); |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 } // namespace skia | 457 } // namespace skia |
OLD | NEW |