| 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : 0; | 988 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : 0; |
| 989 if (nativeImage) { | 989 if (nativeImage) { |
| 990 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | 990 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); |
| 991 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); | 991 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); |
| 992 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | 992 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); |
| 993 registerContentsLayer(m_ninePatchLayer->layer()); | 993 registerContentsLayer(m_ninePatchLayer->layer()); |
| 994 } | 994 } |
| 995 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | 995 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); |
| 996 } | 996 } |
| 997 | 997 |
| 998 void GraphicsLayer::setContentsToSolidColor(const Color& color) |
| 999 { |
| 1000 if (color == m_contentsSolidColor) |
| 1001 return; |
| 1002 |
| 1003 m_contentsSolidColor = color; |
| 1004 if (color.isValid() && color.alpha()) { |
| 1005 if (!m_solidColorLayer) { |
| 1006 m_solidColorLayer = adoptPtr(Platform::current()->compositorSupport(
)->createSolidColorLayer()); |
| 1007 registerContentsLayer(m_solidColorLayer->layer()); |
| 1008 } |
| 1009 m_solidColorLayer->setBackgroundColor(color.rgb()); |
| 1010 } else { |
| 1011 if (!m_solidColorLayer) |
| 1012 return; |
| 1013 unregisterContentsLayer(m_solidColorLayer->layer()); |
| 1014 m_solidColorLayer.clear(); |
| 1015 } |
| 1016 setContentsTo(m_solidColorLayer ? m_solidColorLayer->layer() : 0); |
| 1017 } |
| 1018 |
| 998 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) | 1019 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) |
| 999 { | 1020 { |
| 1000 OwnPtr<WebAnimation> animation(popAnimation); | 1021 OwnPtr<WebAnimation> animation(popAnimation); |
| 1001 ASSERT(animation); | 1022 ASSERT(animation); |
| 1002 platformLayer()->setAnimationDelegate(this); | 1023 platformLayer()->setAnimationDelegate(this); |
| 1003 | 1024 |
| 1004 // Remove any existing animations with the same animation id and target prop
erty. | 1025 // Remove any existing animations with the same animation id and target prop
erty. |
| 1005 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); | 1026 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); |
| 1006 return platformLayer()->addAnimation(animation.leakPtr()); | 1027 return platformLayer()->addAnimation(animation.leakPtr()); |
| 1007 } | 1028 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 #ifndef NDEBUG | 1200 #ifndef NDEBUG |
| 1180 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 1201 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |
| 1181 { | 1202 { |
| 1182 if (!layer) | 1203 if (!layer) |
| 1183 return; | 1204 return; |
| 1184 | 1205 |
| 1185 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); | 1206 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |
| 1186 fprintf(stderr, "%s\n", output.utf8().data()); | 1207 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1187 } | 1208 } |
| 1188 #endif | 1209 #endif |
| OLD | NEW |