| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 static PassRefPtr<TestImage> create(const IntSize& size, bool isOpaque) | 49 static PassRefPtr<TestImage> create(const IntSize& size, bool isOpaque) |
| 50 { | 50 { |
| 51 return adoptRef(new TestImage(size, isOpaque)); | 51 return adoptRef(new TestImage(size, isOpaque)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 explicit TestImage(const IntSize& size, bool isOpaque) | 54 explicit TestImage(const IntSize& size, bool isOpaque) |
| 55 : Image(0) | 55 : Image(0) |
| 56 , m_size(size) | 56 , m_size(size) |
| 57 { | 57 { |
| 58 SkBitmap bitmap; | 58 SkBitmap bitmap; |
| 59 EXPECT_TRUE(bitmap.allocN32Pixels(size.width(), size.height(), isOpaque)
); | 59 bitmap.allocN32Pixels(size.width(), size.height(), isOpaque); |
| 60 m_nativeImage = NativeImageSkia::create(bitmap); | 60 m_nativeImage = NativeImageSkia::create(bitmap); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual bool isBitmapImage() const OVERRIDE | 63 virtual bool isBitmapImage() const OVERRIDE |
| 64 { | 64 { |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 virtual bool currentFrameKnownToBeOpaque() OVERRIDE | 68 virtual bool currentFrameKnownToBeOpaque() OVERRIDE |
| 69 { | 69 { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 ASSERT_FALSE(graphicsLayer->contentsLayer()); | 142 ASSERT_FALSE(graphicsLayer->contentsLayer()); |
| 143 | 143 |
| 144 graphicsLayer->setContentsToImage(opaqueImage.get()); | 144 graphicsLayer->setContentsToImage(opaqueImage.get()); |
| 145 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); | 145 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); |
| 146 | 146 |
| 147 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); | 147 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); |
| 148 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); | 148 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| OLD | NEW |