| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 { | 977 { |
| 978 if (rect == m_contentsRect) | 978 if (rect == m_contentsRect) |
| 979 return; | 979 return; |
| 980 | 980 |
| 981 m_contentsRect = rect; | 981 m_contentsRect = rect; |
| 982 updateContentsRect(); | 982 updateContentsRect(); |
| 983 } | 983 } |
| 984 | 984 |
| 985 void GraphicsLayer::setContentsToImage(Image* image) | 985 void GraphicsLayer::setContentsToImage(Image* image) |
| 986 { | 986 { |
| 987 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : 0; | 987 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; |
| 988 if (nativeImage) { | 988 if (nativeImage) { |
| 989 if (!m_imageLayer) { | 989 if (!m_imageLayer) { |
| 990 m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateImageLayer()); | 990 m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateImageLayer()); |
| 991 registerContentsLayer(m_imageLayer->layer()); | 991 registerContentsLayer(m_imageLayer->layer()); |
| 992 } | 992 } |
| 993 m_imageLayer->setBitmap(nativeImage->bitmap()); | 993 m_imageLayer->setBitmap(nativeImage->bitmap()); |
| 994 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); | 994 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); |
| 995 updateContentsRect(); | 995 updateContentsRect(); |
| 996 } else { | 996 } else { |
| 997 if (m_imageLayer) { | 997 if (m_imageLayer) { |
| 998 unregisterContentsLayer(m_imageLayer->layer()); | 998 unregisterContentsLayer(m_imageLayer->layer()); |
| 999 m_imageLayer.clear(); | 999 m_imageLayer.clear(); |
| 1000 } | 1000 } |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); | 1003 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
) | 1006 void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
) |
| 1007 { | 1007 { |
| 1008 if (m_ninePatchLayer) { | 1008 if (m_ninePatchLayer) { |
| 1009 unregisterContentsLayer(m_ninePatchLayer->layer()); | 1009 unregisterContentsLayer(m_ninePatchLayer->layer()); |
| 1010 m_ninePatchLayer.clear(); | 1010 m_ninePatchLayer.clear(); |
| 1011 } | 1011 } |
| 1012 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : 0; | 1012 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; |
| 1013 if (nativeImage) { | 1013 if (nativeImage) { |
| 1014 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | 1014 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); |
| 1015 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); | 1015 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); |
| 1016 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | 1016 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); |
| 1017 registerContentsLayer(m_ninePatchLayer->layer()); | 1017 registerContentsLayer(m_ninePatchLayer->layer()); |
| 1018 } | 1018 } |
| 1019 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | 1019 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 void GraphicsLayer::setContentsToSolidColor(const Color& color) | 1022 void GraphicsLayer::setContentsToSolidColor(const Color& color) |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 #ifndef NDEBUG | 1224 #ifndef NDEBUG |
| 1225 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 1225 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |
| 1226 { | 1226 { |
| 1227 if (!layer) | 1227 if (!layer) |
| 1228 return; | 1228 return; |
| 1229 | 1229 |
| 1230 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); | 1230 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |
| 1231 fprintf(stderr, "%s\n", output.utf8().data()); | 1231 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1232 } | 1232 } |
| 1233 #endif | 1233 #endif |
| OLD | NEW |