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

Side by Side Diff: Source/core/platform/graphics/GraphicsLayer.cpp

Issue 63943006: Re-enable solid background color optimization for composited layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add window.internals.forceCompositingUpdate(document) to webgl test to avoid flaky Created 7 years 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : 0; 998 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : 0;
999 if (nativeImage) { 999 if (nativeImage) {
1000 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer()); 1000 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer());
1001 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); 1001 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture);
1002 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( )); 1002 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( ));
1003 registerContentsLayer(m_ninePatchLayer->layer()); 1003 registerContentsLayer(m_ninePatchLayer->layer());
1004 } 1004 }
1005 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); 1005 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
1006 } 1006 }
1007 1007
1008 void GraphicsLayer::setContentsToSolidColor(const Color& color)
1009 {
1010 if (color == m_contentsSolidColor)
1011 return;
1012
1013 m_contentsSolidColor = color;
1014 if (color.isValid() && color.alpha()) {
1015 if (!m_solidColorLayer) {
1016 m_solidColorLayer = adoptPtr(Platform::current()->compositorSupport( )->createSolidColorLayer());
1017 registerContentsLayer(m_solidColorLayer->layer());
1018 }
1019 m_solidColorLayer->setBackgroundColor(color.rgb());
1020 } else {
1021 if (!m_solidColorLayer)
1022 return;
1023 unregisterContentsLayer(m_solidColorLayer->layer());
1024 m_solidColorLayer.clear();
1025 }
1026 setContentsTo(m_solidColorLayer ? m_solidColorLayer->layer() : 0);
1027 }
1028
1008 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) 1029 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation)
1009 { 1030 {
1010 OwnPtr<WebAnimation> animation(popAnimation); 1031 OwnPtr<WebAnimation> animation(popAnimation);
1011 ASSERT(animation); 1032 ASSERT(animation);
1012 platformLayer()->setAnimationDelegate(this); 1033 platformLayer()->setAnimationDelegate(this);
1013 1034
1014 // Remove any existing animations with the same animation id and target prop erty. 1035 // Remove any existing animations with the same animation id and target prop erty.
1015 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( )); 1036 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( ));
1016 return platformLayer()->addAnimation(animation.leakPtr()); 1037 return platformLayer()->addAnimation(animation.leakPtr());
1017 } 1038 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 #ifndef NDEBUG 1210 #ifndef NDEBUG
1190 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1211 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1191 { 1212 {
1192 if (!layer) 1213 if (!layer)
1193 return; 1214 return;
1194 1215
1195 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1216 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1196 fprintf(stderr, "%s\n", output.utf8().data()); 1217 fprintf(stderr, "%s\n", output.utf8().data());
1197 } 1218 }
1198 #endif 1219 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698