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

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: 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 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 if (m_size != IntSize()) { 580 if (m_size != IntSize()) {
579 writeIndent(ts, indent + 1); 581 writeIndent(ts, indent + 1);
580 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n"; 582 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n";
581 } 583 }
582 584
583 if (m_opacity != 1) { 585 if (m_opacity != 1) {
584 writeIndent(ts, indent + 1); 586 writeIndent(ts, indent + 1);
585 ts << "(opacity " << m_opacity << ")\n"; 587 ts << "(opacity " << m_opacity << ")\n";
586 } 588 }
587 589
590 if (m_blendMode != BlendModeNormal) {
591 writeIndent(ts, indent + 1);
592 ts << "(blendMode " << compositeOperatorName(CompositeSourceOver, m_blen dMode) << ")\n";
593 }
594
595 if (m_isRootForIsolatedGroup) {
596 writeIndent(ts, indent + 1);
597 ts << "(isolate " << m_isRootForIsolatedGroup << ")\n";
598 }
599
588 if (m_contentsOpaque) { 600 if (m_contentsOpaque) {
589 writeIndent(ts, indent + 1); 601 writeIndent(ts, indent + 1);
590 ts << "(contentsOpaque " << m_contentsOpaque << ")\n"; 602 ts << "(contentsOpaque " << m_contentsOpaque << ")\n";
591 } 603 }
592 604
593 if (m_preserves3D) { 605 if (m_preserves3D) {
594 writeIndent(ts, indent + 1); 606 writeIndent(ts, indent + 1);
595 ts << "(preserves3D " << m_preserves3D << ")\n"; 607 ts << "(preserves3D " << m_preserves3D << ")\n";
596 } 608 }
597 609
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 m_layer->setDoubleSided(m_backfaceVisibility); 926 m_layer->setDoubleSided(m_backfaceVisibility);
915 } 927 }
916 928
917 void GraphicsLayer::setOpacity(float opacity) 929 void GraphicsLayer::setOpacity(float opacity)
918 { 930 {
919 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); 931 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f);
920 m_opacity = clampedOpacity; 932 m_opacity = clampedOpacity;
921 platformLayer()->setOpacity(opacity); 933 platformLayer()->setOpacity(opacity);
922 } 934 }
923 935
936 void GraphicsLayer::setBlendMode(BlendMode blendMode)
937 {
938 if (m_blendMode == blendMode)
939 return;
940 m_blendMode = blendMode;
941 platformLayer()->setBlendMode(blink::WebBlendMode(blendMode));
942 }
943
944 void GraphicsLayer::setIsRootForIsolatedGroup(bool isolated)
945 {
946 if (m_isRootForIsolatedGroup == isolated)
947 return;
948 m_isRootForIsolatedGroup = isolated;
949 platformLayer()->setIsRootForIsolatedGroup(isolated);
950 }
951
924 void GraphicsLayer::setContentsNeedsDisplay() 952 void GraphicsLayer::setContentsNeedsDisplay()
925 { 953 {
926 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { 954 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
927 contentsLayer->invalidate(); 955 contentsLayer->invalidate();
928 addRepaintRect(contentsRect()); 956 addRepaintRect(contentsRect());
929 } 957 }
930 } 958 }
931 959
932 void GraphicsLayer::setNeedsDisplay() 960 void GraphicsLayer::setNeedsDisplay()
933 { 961 {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 #ifndef NDEBUG 1207 #ifndef NDEBUG
1180 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1208 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1181 { 1209 {
1182 if (!layer) 1210 if (!layer)
1183 return; 1211 return;
1184 1212
1185 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1213 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1186 fprintf(stderr, "%s\n", output.utf8().data()); 1214 fprintf(stderr, "%s\n", output.utf8().data());
1187 } 1215 }
1188 #endif 1216 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698