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

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: 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : 0; 988 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : 0;
989 if (nativeImage) { 989 if (nativeImage) {
990 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer()); 990 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer());
991 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); 991 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture);
992 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( )); 992 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( ));
993 registerContentsLayer(m_ninePatchLayer->layer()); 993 registerContentsLayer(m_ninePatchLayer->layer());
994 } 994 }
995 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); 995 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
996 } 996 }
997 997
998 void GraphicsLayer::setContentsToSolidColor(const Color& color)
999 {
1000 if (color == m_contentsSolidColor)
1001 return;
1002
1003 m_contentsSolidColor = color;
1004 if (color.isValid() && color.alpha()) {
1005 if (!m_solidColorLayer) {
1006 m_solidColorLayer = adoptPtr(Platform::current()->compositorSupport( )->createSolidColorLayer());
1007 registerContentsLayer(m_solidColorLayer->layer());
1008 }
1009 m_solidColorLayer->setBackgroundColor(color.rgb());
1010 } else {
1011 if (!m_solidColorLayer)
1012 return;
1013 unregisterContentsLayer(m_solidColorLayer->layer());
1014 m_solidColorLayer.clear();
1015 }
1016 setContentsTo(m_solidColorLayer ? m_solidColorLayer->layer() : 0);
1017 }
1018
998 void GraphicsLayer::setContentsToCanvas(WebLayer* layer) 1019 void GraphicsLayer::setContentsToCanvas(WebLayer* layer)
999 { 1020 {
1000 setContentsTo(layer); 1021 setContentsTo(layer);
1001 } 1022 }
1002 1023
1003 void GraphicsLayer::setContentsToMedia(WebLayer* layer) 1024 void GraphicsLayer::setContentsToMedia(WebLayer* layer)
1004 { 1025 {
1005 setContentsTo(layer); 1026 setContentsTo(layer);
1006 } 1027 }
1007 1028
(...skipping 181 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