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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 , m_hasScrollParent(false) | 92 , m_hasScrollParent(false) |
93 , m_hasClipParent(false) | 93 , m_hasClipParent(false) |
94 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) | 94 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) |
95 , m_contentsOrientation(CompositingCoordinatesTopDown) | 95 , m_contentsOrientation(CompositingCoordinatesTopDown) |
96 , m_parent(0) | 96 , m_parent(0) |
97 , m_maskLayer(0) | 97 , m_maskLayer(0) |
98 , m_contentsClippingMaskLayer(0) | 98 , m_contentsClippingMaskLayer(0) |
99 , m_replicaLayer(0) | 99 , m_replicaLayer(0) |
100 , m_replicatedLayer(0) | 100 , m_replicatedLayer(0) |
101 , m_paintCount(0) | 101 , m_paintCount(0) |
102 , m_contentsSolidColor(Color::transparent) | |
103 , m_contentsLayer(0) | 102 , m_contentsLayer(0) |
104 , m_contentsLayerId(0) | 103 , m_contentsLayerId(0) |
105 , m_scrollableArea(0) | 104 , m_scrollableArea(0) |
106 , m_3dRenderingContext(0) | 105 , m_3dRenderingContext(0) |
107 { | 106 { |
108 #ifndef NDEBUG | 107 #ifndef NDEBUG |
109 if (m_client) | 108 if (m_client) |
110 m_client->verifyNotPainting(); | 109 m_client->verifyNotPainting(); |
111 #endif | 110 #endif |
112 | 111 |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; | 1011 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; |
1013 if (nativeImage) { | 1012 if (nativeImage) { |
1014 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | 1013 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); |
1015 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); | 1014 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); |
1016 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | 1015 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); |
1017 registerContentsLayer(m_ninePatchLayer->layer()); | 1016 registerContentsLayer(m_ninePatchLayer->layer()); |
1018 } | 1017 } |
1019 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | 1018 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); |
1020 } | 1019 } |
1021 | 1020 |
1022 void GraphicsLayer::setContentsToSolidColor(const Color& color) | |
1023 { | |
1024 if (color == m_contentsSolidColor) | |
1025 return; | |
1026 | |
1027 m_contentsSolidColor = color; | |
1028 if (color.alpha()) { | |
1029 if (!m_solidColorLayer) { | |
1030 m_solidColorLayer = adoptPtr(Platform::current()->compositorSupport(
)->createSolidColorLayer()); | |
1031 registerContentsLayer(m_solidColorLayer->layer()); | |
1032 } | |
1033 m_solidColorLayer->setBackgroundColor(color.rgb()); | |
1034 } else { | |
1035 if (!m_solidColorLayer) | |
1036 return; | |
1037 unregisterContentsLayer(m_solidColorLayer->layer()); | |
1038 m_solidColorLayer.clear(); | |
1039 } | |
1040 setContentsTo(m_solidColorLayer ? m_solidColorLayer->layer() : 0); | |
1041 } | |
1042 | |
1043 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) | 1021 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) |
1044 { | 1022 { |
1045 OwnPtr<WebAnimation> animation(popAnimation); | 1023 OwnPtr<WebAnimation> animation(popAnimation); |
1046 ASSERT(animation); | 1024 ASSERT(animation); |
1047 platformLayer()->setAnimationDelegate(this); | 1025 platformLayer()->setAnimationDelegate(this); |
1048 | 1026 |
1049 // Remove any existing animations with the same animation id and target prop
erty. | 1027 // Remove any existing animations with the same animation id and target prop
erty. |
1050 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); | 1028 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); |
1051 return platformLayer()->addAnimation(animation.leakPtr()); | 1029 return platformLayer()->addAnimation(animation.leakPtr()); |
1052 } | 1030 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 #ifndef NDEBUG | 1202 #ifndef NDEBUG |
1225 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 1203 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |
1226 { | 1204 { |
1227 if (!layer) | 1205 if (!layer) |
1228 return; | 1206 return; |
1229 | 1207 |
1230 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); | 1208 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |
1231 fprintf(stderr, "%s\n", output.utf8().data()); | 1209 fprintf(stderr, "%s\n", output.utf8().data()); |
1232 } | 1210 } |
1233 #endif | 1211 #endif |
OLD | NEW |