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

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

Issue 183833020: Re-land "Drop background color optimization for composited layers" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make Mac test bot pass Created 6 years, 9 months 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
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.h ('k') | Source/web/tests/GraphicsLayerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 , m_hasScrollParent(false) 92 , m_hasScrollParent(false)
93 , m_hasClipParent(false) 93 , m_hasClipParent(false)
94 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) 94 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
95 , m_contentsOrientation(CompositingCoordinatesTopDown) 95 , m_contentsOrientation(CompositingCoordinatesTopDown)
96 , m_parent(0) 96 , m_parent(0)
97 , m_maskLayer(0) 97 , m_maskLayer(0)
98 , m_contentsClippingMaskLayer(0) 98 , m_contentsClippingMaskLayer(0)
99 , m_replicaLayer(0) 99 , m_replicaLayer(0)
100 , m_replicatedLayer(0) 100 , m_replicatedLayer(0)
101 , m_paintCount(0) 101 , m_paintCount(0)
102 , m_contentsSolidColor(Color::transparent)
103 , m_contentsLayer(0) 102 , m_contentsLayer(0)
104 , m_contentsLayerId(0) 103 , m_contentsLayerId(0)
105 , m_scrollableArea(0) 104 , m_scrollableArea(0)
106 , m_3dRenderingContext(0) 105 , m_3dRenderingContext(0)
107 { 106 {
108 #ifndef NDEBUG 107 #ifndef NDEBUG
109 if (m_client) 108 if (m_client)
110 m_client->verifyNotPainting(); 109 m_client->verifyNotPainting();
111 #endif 110 #endif
112 111
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : nullptr; 1018 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : nullptr;
1020 if (nativeImage) { 1019 if (nativeImage) {
1021 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer()); 1020 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer());
1022 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); 1021 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture);
1023 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( )); 1022 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( ));
1024 registerContentsLayer(m_ninePatchLayer->layer()); 1023 registerContentsLayer(m_ninePatchLayer->layer());
1025 } 1024 }
1026 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); 1025 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
1027 } 1026 }
1028 1027
1029 void GraphicsLayer::setContentsToSolidColor(const Color& color)
1030 {
1031 if (color == m_contentsSolidColor)
1032 return;
1033
1034 m_contentsSolidColor = color;
1035 if (color.alpha()) {
1036 if (!m_solidColorLayer) {
1037 m_solidColorLayer = adoptPtr(Platform::current()->compositorSupport( )->createSolidColorLayer());
1038 registerContentsLayer(m_solidColorLayer->layer());
1039 }
1040 m_solidColorLayer->setBackgroundColor(color.rgb());
1041 } else {
1042 if (!m_solidColorLayer)
1043 return;
1044 unregisterContentsLayer(m_solidColorLayer->layer());
1045 m_solidColorLayer.clear();
1046 }
1047 setContentsTo(m_solidColorLayer ? m_solidColorLayer->layer() : 0);
1048 }
1049
1050 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) 1028 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation)
1051 { 1029 {
1052 OwnPtr<WebAnimation> animation(popAnimation); 1030 OwnPtr<WebAnimation> animation(popAnimation);
1053 ASSERT(animation); 1031 ASSERT(animation);
1054 platformLayer()->setAnimationDelegate(this); 1032 platformLayer()->setAnimationDelegate(this);
1055 1033
1056 // Remove any existing animations with the same animation id and target prop erty. 1034 // Remove any existing animations with the same animation id and target prop erty.
1057 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( )); 1035 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( ));
1058 return platformLayer()->addAnimation(animation.leakPtr()); 1036 return platformLayer()->addAnimation(animation.leakPtr());
1059 } 1037 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 #ifndef NDEBUG 1209 #ifndef NDEBUG
1232 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1210 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1233 { 1211 {
1234 if (!layer) 1212 if (!layer)
1235 return; 1213 return;
1236 1214
1237 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1215 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1238 fprintf(stderr, "%s\n", output.utf8().data()); 1216 fprintf(stderr, "%s\n", output.utf8().data());
1239 } 1217 }
1240 #endif 1218 #endif
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.h ('k') | Source/web/tests/GraphicsLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698