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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 | 945 |
946 void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
) | 946 void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
) |
947 { | 947 { |
948 if (m_ninePatchLayer) { | 948 if (m_ninePatchLayer) { |
949 unregisterContentsLayer(m_ninePatchLayer->layer()); | 949 unregisterContentsLayer(m_ninePatchLayer->layer()); |
950 m_ninePatchLayer.clear(); | 950 m_ninePatchLayer.clear(); |
951 } | 951 } |
952 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; | 952 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; |
953 if (nativeImage) { | 953 if (nativeImage) { |
954 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | 954 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); |
955 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); | 955 const SkBitmap& bitmap = nativeImage->bitmap(); |
| 956 int borderWidth = bitmap.width() - aperture.width(); |
| 957 int borderHeight = bitmap.height() - aperture.height(); |
| 958 WebRect border(aperture.x(), aperture.y(), borderWidth, borderHeight); |
| 959 |
| 960 m_ninePatchLayer->setBitmap(bitmap); |
| 961 m_ninePatchLayer->setAperture(aperture); |
| 962 m_ninePatchLayer->setBorder(border); |
| 963 |
956 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | 964 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); |
957 registerContentsLayer(m_ninePatchLayer->layer()); | 965 registerContentsLayer(m_ninePatchLayer->layer()); |
958 } | 966 } |
959 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | 967 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); |
960 } | 968 } |
961 | 969 |
962 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) | 970 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) |
963 { | 971 { |
964 OwnPtr<WebCompositorAnimation> animation(popAnimation); | 972 OwnPtr<WebCompositorAnimation> animation(popAnimation); |
965 ASSERT(animation); | 973 ASSERT(animation); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 #ifndef NDEBUG | 1070 #ifndef NDEBUG |
1063 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1071 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
1064 { | 1072 { |
1065 if (!layer) | 1073 if (!layer) |
1066 return; | 1074 return; |
1067 | 1075 |
1068 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1076 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1069 fprintf(stderr, "%s\n", output.utf8().data()); | 1077 fprintf(stderr, "%s\n", output.utf8().data()); |
1070 } | 1078 } |
1071 #endif | 1079 #endif |
OLD | NEW |