| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 static PassRefPtr<TestImage> create(const IntSize& size, bool opaque) { | 43 static PassRefPtr<TestImage> create(const IntSize& size, bool opaque) { |
| 44 return adoptRef(new TestImage(size, opaque)); | 44 return adoptRef(new TestImage(size, opaque)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override { | 47 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override { |
| 48 return m_image->isOpaque(); | 48 return m_image->isOpaque(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 IntSize size() const override { return m_size; } | 51 IntSize size() const override { return m_size; } |
| 52 | 52 |
| 53 sk_sp<SkImage> imageForCurrentFrame() override { return m_image; } | 53 sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override { |
| 54 return m_image; |
| 55 } |
| 54 | 56 |
| 55 void destroyDecodedData() override { | 57 void destroyDecodedData() override { |
| 56 // Image pure virtual stub. | 58 // Image pure virtual stub. |
| 57 } | 59 } |
| 58 | 60 |
| 59 void draw(SkCanvas*, | 61 void draw(SkCanvas*, |
| 60 const SkPaint&, | 62 const SkPaint&, |
| 61 const FloatRect&, | 63 const FloatRect&, |
| 62 const FloatRect&, | 64 const FloatRect&, |
| 63 RespectImageOrientationEnum, | 65 RespectImageOrientationEnum, |
| 64 ImageClampingMode) override { | 66 ImageClampingMode, |
| 67 const ColorBehavior&) override { |
| 65 // Image pure virtual stub. | 68 // Image pure virtual stub. |
| 66 } | 69 } |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 TestImage(IntSize size, bool opaque) : Image(0), m_size(size) { | 72 TestImage(IntSize size, bool opaque) : Image(0), m_size(size) { |
| 70 sk_sp<SkSurface> surface = createSkSurface(size, opaque); | 73 sk_sp<SkSurface> surface = createSkSurface(size, opaque); |
| 71 if (!surface) | 74 if (!surface) |
| 72 return; | 75 return; |
| 73 | 76 |
| 74 surface->getCanvas()->clear(SK_ColorTRANSPARENT); | 77 surface->getCanvas()->clear(SK_ColorTRANSPARENT); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ASSERT_FALSE(graphicsLayer->contentsLayer()); | 127 ASSERT_FALSE(graphicsLayer->contentsLayer()); |
| 125 | 128 |
| 126 graphicsLayer->setContentsToImage(opaqueImage.get()); | 129 graphicsLayer->setContentsToImage(opaqueImage.get()); |
| 127 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); | 130 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); |
| 128 | 131 |
| 129 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); | 132 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); |
| 130 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); | 133 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); |
| 131 } | 134 } |
| 132 | 135 |
| 133 } // namespace blink | 136 } // namespace blink |
| OLD | NEW |