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

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

Issue 23511004: mix-blend-mode implementation for accelerated layers - blink part (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 7 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client) 76 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client)
77 { 77 {
78 return factory->createGraphicsLayer(client); 78 return factory->createGraphicsLayer(client);
79 } 79 }
80 80
81 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) 81 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
82 : m_client(client) 82 : m_client(client)
83 , m_anchorPoint(0.5f, 0.5f, 0) 83 , m_anchorPoint(0.5f, 0.5f, 0)
84 , m_opacity(1) 84 , m_opacity(1)
85 , m_zPosition(0) 85 , m_zPosition(0)
86 , m_blendMode(BlendModeNormal)
86 , m_contentsOpaque(false) 87 , m_contentsOpaque(false)
87 , m_preserves3D(false) 88 , m_preserves3D(false)
88 , m_backfaceVisibility(true) 89 , m_backfaceVisibility(true)
89 , m_masksToBounds(false) 90 , m_masksToBounds(false)
90 , m_drawsContent(false) 91 , m_drawsContent(false)
91 , m_contentsVisible(true) 92 , m_contentsVisible(true)
93 , m_isRootForIsolatedGroup(false)
92 , m_hasScrollParent(false) 94 , m_hasScrollParent(false)
93 , m_hasClipParent(false) 95 , m_hasClipParent(false)
94 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) 96 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
95 , m_contentsOrientation(CompositingCoordinatesTopDown) 97 , m_contentsOrientation(CompositingCoordinatesTopDown)
96 , m_parent(0) 98 , m_parent(0)
97 , m_maskLayer(0) 99 , m_maskLayer(0)
98 , m_contentsClippingMaskLayer(0) 100 , m_contentsClippingMaskLayer(0)
99 , m_replicaLayer(0) 101 , m_replicaLayer(0)
100 , m_replicatedLayer(0) 102 , m_replicatedLayer(0)
101 , m_paintCount(0) 103 , m_paintCount(0)
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (m_size != IntSize()) { 588 if (m_size != IntSize()) {
587 writeIndent(ts, indent + 1); 589 writeIndent(ts, indent + 1);
588 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n"; 590 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n";
589 } 591 }
590 592
591 if (m_opacity != 1) { 593 if (m_opacity != 1) {
592 writeIndent(ts, indent + 1); 594 writeIndent(ts, indent + 1);
593 ts << "(opacity " << m_opacity << ")\n"; 595 ts << "(opacity " << m_opacity << ")\n";
594 } 596 }
595 597
598 if (m_blendMode != BlendModeNormal) {
599 writeIndent(ts, indent + 1);
600 ts << "(blendMode " << compositeOperatorName(CompositeSourceOver, m_blen dMode) << ")\n";
601 }
602
603 if (m_isRootForIsolatedGroup) {
604 writeIndent(ts, indent + 1);
605 ts << "(isolate " << m_isRootForIsolatedGroup << ")\n";
606 }
607
596 if (m_contentsOpaque) { 608 if (m_contentsOpaque) {
597 writeIndent(ts, indent + 1); 609 writeIndent(ts, indent + 1);
598 ts << "(contentsOpaque " << m_contentsOpaque << ")\n"; 610 ts << "(contentsOpaque " << m_contentsOpaque << ")\n";
599 } 611 }
600 612
601 if (m_preserves3D) { 613 if (m_preserves3D) {
602 writeIndent(ts, indent + 1); 614 writeIndent(ts, indent + 1);
603 ts << "(preserves3D " << m_preserves3D << ")\n"; 615 ts << "(preserves3D " << m_preserves3D << ")\n";
604 } 616 }
605 617
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 m_layer->setDoubleSided(m_backfaceVisibility); 934 m_layer->setDoubleSided(m_backfaceVisibility);
923 } 935 }
924 936
925 void GraphicsLayer::setOpacity(float opacity) 937 void GraphicsLayer::setOpacity(float opacity)
926 { 938 {
927 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); 939 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f);
928 m_opacity = clampedOpacity; 940 m_opacity = clampedOpacity;
929 platformLayer()->setOpacity(opacity); 941 platformLayer()->setOpacity(opacity);
930 } 942 }
931 943
944 void GraphicsLayer::setBlendMode(BlendMode blendMode)
945 {
946 if (m_blendMode == blendMode)
947 return;
948 m_blendMode = blendMode;
949 platformLayer()->setBlendMode(WebKit::WebBlendMode(blendMode));
950 }
951
952 void GraphicsLayer::setIsRootForIsolatedGroup(bool isolated)
953 {
954 if (m_isRootForIsolatedGroup == isolated)
955 return;
956 m_isRootForIsolatedGroup = isolated;
957 platformLayer()->setIsRootForIsolatedGroup(isolated);
958 }
959
932 void GraphicsLayer::setContentsNeedsDisplay() 960 void GraphicsLayer::setContentsNeedsDisplay()
933 { 961 {
934 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { 962 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
935 contentsLayer->invalidate(); 963 contentsLayer->invalidate();
936 addRepaintRect(contentsRect()); 964 addRepaintRect(contentsRect());
937 } 965 }
938 } 966 }
939 967
940 void GraphicsLayer::setNeedsDisplay() 968 void GraphicsLayer::setNeedsDisplay()
941 { 969 {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 #ifndef NDEBUG 1243 #ifndef NDEBUG
1216 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1244 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1217 { 1245 {
1218 if (!layer) 1246 if (!layer)
1219 return; 1247 return;
1220 1248
1221 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1249 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1222 fprintf(stderr, "%s\n", output.utf8().data()); 1250 fprintf(stderr, "%s\n", output.utf8().data());
1223 } 1251 }
1224 #endif 1252 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698