OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 static PassRefPtr<TestImage> create(const IntSize& size, bool isOpaque) | 48 static PassRefPtr<TestImage> create(const IntSize& size, bool isOpaque) |
49 { | 49 { |
50 return adoptRef(new TestImage(size, isOpaque)); | 50 return adoptRef(new TestImage(size, isOpaque)); |
51 } | 51 } |
52 | 52 |
53 explicit TestImage(const IntSize& size, bool isOpaque) | 53 explicit TestImage(const IntSize& size, bool isOpaque) |
54 : Image(0) | 54 : Image(0) |
55 , m_size(size) | 55 , m_size(size) |
56 { | 56 { |
57 m_nativeImage = NativeImageSkia::create(); | 57 SkBitmap bitmap; |
58 EXPECT_TRUE(m_nativeImage->bitmap().allocN32Pixels(size.width(), size.he
ight(), isOpaque)); | 58 EXPECT_TRUE(bitmap.allocN32Pixels(size.width(), size.height(), isOpaque)
); |
| 59 m_nativeImage = NativeImageSkia::create(bitmap); |
59 } | 60 } |
60 | 61 |
61 virtual bool isBitmapImage() const OVERRIDE | 62 virtual bool isBitmapImage() const OVERRIDE |
62 { | 63 { |
63 return true; | 64 return true; |
64 } | 65 } |
65 | 66 |
66 virtual bool currentFrameKnownToBeOpaque() OVERRIDE | 67 virtual bool currentFrameKnownToBeOpaque() OVERRIDE |
67 { | 68 { |
68 return m_nativeImage->bitmap().isOpaque(); | 69 return m_nativeImage->bitmap().isOpaque(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 ASSERT_FALSE(graphicsLayer->contentsLayer()); | 120 ASSERT_FALSE(graphicsLayer->contentsLayer()); |
120 | 121 |
121 graphicsLayer->setContentsToImage(opaqueImage.get()); | 122 graphicsLayer->setContentsToImage(opaqueImage.get()); |
122 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); | 123 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); |
123 | 124 |
124 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); | 125 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); |
125 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); | 126 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); |
126 } | 127 } |
127 | 128 |
128 } // namespace | 129 } // namespace |
OLD | NEW |