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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client) | 102 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client) |
103 { | 103 { |
104 return factory->createGraphicsLayer(client); | 104 return factory->createGraphicsLayer(client); |
105 } | 105 } |
106 | 106 |
107 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) | 107 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) |
108 : m_client(client) | 108 : m_client(client) |
109 , m_anchorPoint(0.5f, 0.5f, 0) | 109 , m_anchorPoint(0.5f, 0.5f, 0) |
110 , m_opacity(1) | 110 , m_opacity(1) |
111 , m_zPosition(0) | 111 , m_zPosition(0) |
112 , m_blendMode(BlendModeNormal) | |
113 , m_isRootForIsolatedGroup(false) | |
112 , m_contentsOpaque(false) | 114 , m_contentsOpaque(false) |
113 , m_preserves3D(false) | 115 , m_preserves3D(false) |
114 , m_backfaceVisibility(true) | 116 , m_backfaceVisibility(true) |
115 , m_masksToBounds(false) | 117 , m_masksToBounds(false) |
116 , m_drawsContent(false) | 118 , m_drawsContent(false) |
117 , m_contentsVisible(true) | 119 , m_contentsVisible(true) |
118 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) | 120 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) |
119 , m_contentsOrientation(CompositingCoordinatesTopDown) | 121 , m_contentsOrientation(CompositingCoordinatesTopDown) |
120 , m_parent(0) | 122 , m_parent(0) |
121 , m_maskLayer(0) | 123 , m_maskLayer(0) |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
722 if (m_size != IntSize()) { | 724 if (m_size != IntSize()) { |
723 writeIndent(ts, indent + 1); | 725 writeIndent(ts, indent + 1); |
724 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n"; | 726 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n"; |
725 } | 727 } |
726 | 728 |
727 if (m_opacity != 1) { | 729 if (m_opacity != 1) { |
728 writeIndent(ts, indent + 1); | 730 writeIndent(ts, indent + 1); |
729 ts << "(opacity " << m_opacity << ")\n"; | 731 ts << "(opacity " << m_opacity << ")\n"; |
730 } | 732 } |
731 | 733 |
734 if (m_blendMode != BlendModeNormal) { | |
735 writeIndent(ts, indent + 1); | |
736 ts << "(blendMode " << m_blendMode << ")\n"; | |
shawnsingh
2013/09/13 10:22:59
Does this mean that various blend modes will be id
rosca
2013/09/19 14:26:54
Done.
| |
737 } | |
738 | |
739 if (m_isRootForIsolatedGroup) { | |
740 writeIndent(ts, indent + 1); | |
741 ts << "(isolate " << m_isRootForIsolatedGroup << ")\n"; | |
742 } | |
743 | |
732 if (m_contentsOpaque) { | 744 if (m_contentsOpaque) { |
733 writeIndent(ts, indent + 1); | 745 writeIndent(ts, indent + 1); |
734 ts << "(contentsOpaque " << m_contentsOpaque << ")\n"; | 746 ts << "(contentsOpaque " << m_contentsOpaque << ")\n"; |
735 } | 747 } |
736 | 748 |
737 if (m_preserves3D) { | 749 if (m_preserves3D) { |
738 writeIndent(ts, indent + 1); | 750 writeIndent(ts, indent + 1); |
739 ts << "(preserves3D " << m_preserves3D << ")\n"; | 751 ts << "(preserves3D " << m_preserves3D << ")\n"; |
740 } | 752 } |
741 | 753 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1009 m_layer->setDoubleSided(m_backfaceVisibility); | 1021 m_layer->setDoubleSided(m_backfaceVisibility); |
1010 } | 1022 } |
1011 | 1023 |
1012 void GraphicsLayer::setOpacity(float opacity) | 1024 void GraphicsLayer::setOpacity(float opacity) |
1013 { | 1025 { |
1014 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); | 1026 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); |
1015 m_opacity = clampedOpacity; | 1027 m_opacity = clampedOpacity; |
1016 platformLayer()->setOpacity(opacity); | 1028 platformLayer()->setOpacity(opacity); |
1017 } | 1029 } |
1018 | 1030 |
1031 void GraphicsLayer::setBlendMode(BlendMode blendMode) | |
1032 { | |
1033 if (m_blendMode == blendMode) | |
1034 return; | |
1035 m_blendMode = blendMode; | |
1036 platformLayer()->setBlendMode(WebKit::WebBlendMode(blendMode)); | |
shawnsingh
2013/09/13 10:22:59
using platformLayer() here seems correct. I just
rosca
2013/09/19 14:26:54
We set the blend mode to the outermost layer so it
| |
1037 } | |
1038 | |
1039 void GraphicsLayer::setIsRootForIsolatedGroup(bool isolated) | |
1040 { | |
1041 if (m_isRootForIsolatedGroup == isolated) | |
1042 return; | |
1043 m_isRootForIsolatedGroup = isolated; | |
1044 platformLayer()->setIsRootForIsolatedGroup(isolated); | |
shawnsingh
2013/09/13 10:22:59
Same issue for platformLayer() accessor here.
rosca
2013/09/19 14:26:54
Done.
| |
1045 } | |
1046 | |
1019 void GraphicsLayer::setContentsNeedsDisplay() | 1047 void GraphicsLayer::setContentsNeedsDisplay() |
1020 { | 1048 { |
1021 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { | 1049 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { |
1022 contentsLayer->invalidate(); | 1050 contentsLayer->invalidate(); |
1023 addRepaintRect(contentsRect()); | 1051 addRepaintRect(contentsRect()); |
1024 } | 1052 } |
1025 } | 1053 } |
1026 | 1054 |
1027 void GraphicsLayer::setNeedsDisplay() | 1055 void GraphicsLayer::setNeedsDisplay() |
1028 { | 1056 { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1330 #ifndef NDEBUG | 1358 #ifndef NDEBUG |
1331 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 1359 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |
1332 { | 1360 { |
1333 if (!layer) | 1361 if (!layer) |
1334 return; | 1362 return; |
1335 | 1363 |
1336 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); | 1364 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |
1337 fprintf(stderr, "%s\n", output.utf8().data()); | 1365 fprintf(stderr, "%s\n", output.utf8().data()); |
1338 } | 1366 } |
1339 #endif | 1367 #endif |
OLD | NEW |