| 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 } else { | 1021 } else { |
| 1022 if (m_imageLayer) { | 1022 if (m_imageLayer) { |
| 1023 unregisterContentsLayer(m_imageLayer->layer()); | 1023 unregisterContentsLayer(m_imageLayer->layer()); |
| 1024 m_imageLayer.clear(); | 1024 m_imageLayer.clear(); |
| 1025 } | 1025 } |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); | 1028 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
) | |
| 1032 { | |
| 1033 if (m_ninePatchLayer) { | |
| 1034 unregisterContentsLayer(m_ninePatchLayer->layer()); | |
| 1035 m_ninePatchLayer.clear(); | |
| 1036 } | |
| 1037 SkBitmap bitmap; | |
| 1038 if (image && image->deprecatedBitmapForCurrentFrame(&bitmap)) { | |
| 1039 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | |
| 1040 int borderWidth = bitmap.width() - aperture.width(); | |
| 1041 int borderHeight = bitmap.height() - aperture.height(); | |
| 1042 WebRect border(aperture.x(), aperture.y(), borderWidth, borderHeight); | |
| 1043 | |
| 1044 m_ninePatchLayer->setBitmap(bitmap); | |
| 1045 m_ninePatchLayer->setAperture(aperture); | |
| 1046 m_ninePatchLayer->setBorder(border); | |
| 1047 | |
| 1048 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | |
| 1049 registerContentsLayer(m_ninePatchLayer->layer()); | |
| 1050 } | |
| 1051 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | |
| 1052 } | |
| 1053 | |
| 1054 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) | 1031 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) |
| 1055 { | 1032 { |
| 1056 OwnPtr<WebCompositorAnimation> animation(popAnimation); | 1033 OwnPtr<WebCompositorAnimation> animation(popAnimation); |
| 1057 ASSERT(animation); | 1034 ASSERT(animation); |
| 1058 platformLayer()->setAnimationDelegate(this); | 1035 platformLayer()->setAnimationDelegate(this); |
| 1059 | 1036 |
| 1060 // Remove any existing animations with the same animation id and target prop
erty. | 1037 // Remove any existing animations with the same animation id and target prop
erty. |
| 1061 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); | 1038 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); |
| 1062 return platformLayer()->addAnimation(animation.leakPtr()); | 1039 return platformLayer()->addAnimation(animation.leakPtr()); |
| 1063 } | 1040 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 { | 1152 { |
| 1176 if (!layer) { | 1153 if (!layer) { |
| 1177 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1154 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
| 1178 return; | 1155 return; |
| 1179 } | 1156 } |
| 1180 | 1157 |
| 1181 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1158 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1182 fprintf(stderr, "%s\n", output.utf8().data()); | 1159 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1183 } | 1160 } |
| 1184 #endif | 1161 #endif |
| OLD | NEW |