Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: sky/engine/platform/graphics/GraphicsLayer.cpp

Issue 685983002: Remove Nine Patch layers. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } else { 899 } else {
900 if (m_imageLayer) { 900 if (m_imageLayer) {
901 unregisterContentsLayer(m_imageLayer->layer()); 901 unregisterContentsLayer(m_imageLayer->layer());
902 m_imageLayer.clear(); 902 m_imageLayer.clear();
903 } 903 }
904 } 904 }
905 905
906 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); 906 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0);
907 } 907 }
908 908
909 void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture )
910 {
911 if (m_ninePatchLayer) {
912 unregisterContentsLayer(m_ninePatchLayer->layer());
913 m_ninePatchLayer.clear();
914 }
915 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : nullptr;
916 if (nativeImage) {
917 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer());
918 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture);
919 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( ));
920 registerContentsLayer(m_ninePatchLayer->layer());
921 }
922 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
923 }
924
925 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation ) 909 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation )
926 { 910 {
927 OwnPtr<WebCompositorAnimation> animation(popAnimation); 911 OwnPtr<WebCompositorAnimation> animation(popAnimation);
928 ASSERT(animation); 912 ASSERT(animation);
929 platformLayer()->setAnimationDelegate(this); 913 platformLayer()->setAnimationDelegate(this);
930 914
931 // Remove any existing animations with the same animation id and target prop erty. 915 // Remove any existing animations with the same animation id and target prop erty.
932 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( )); 916 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( ));
933 return platformLayer()->addAnimation(animation.leakPtr()); 917 return platformLayer()->addAnimation(animation.leakPtr());
934 } 918 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 #ifndef NDEBUG 1006 #ifndef NDEBUG
1023 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) 1007 void showGraphicsLayerTree(const blink::GraphicsLayer* layer)
1024 { 1008 {
1025 if (!layer) 1009 if (!layer)
1026 return; 1010 return;
1027 1011
1028 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1012 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1029 fprintf(stderr, "%s\n", output.utf8().data()); 1013 fprintf(stderr, "%s\n", output.utf8().data());
1030 } 1014 }
1031 #endif 1015 #endif
OLDNEW
« no previous file with comments | « sky/engine/platform/graphics/GraphicsLayer.h ('k') | sky/engine/public/platform/WebCompositorSupport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698