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

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: More tests 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (m_size != IntSize()) { 592 if (m_size != IntSize()) {
591 writeIndent(ts, indent + 1); 593 writeIndent(ts, indent + 1);
592 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n"; 594 ts << "(bounds " << m_size.width() << " " << m_size.height() << ")\n";
593 } 595 }
594 596
595 if (m_opacity != 1) { 597 if (m_opacity != 1) {
596 writeIndent(ts, indent + 1); 598 writeIndent(ts, indent + 1);
597 ts << "(opacity " << m_opacity << ")\n"; 599 ts << "(opacity " << m_opacity << ")\n";
598 } 600 }
599 601
602 if (m_blendMode != BlendModeNormal) {
603 writeIndent(ts, indent + 1);
604 ts << "(blendMode " << compositeOperatorName(CompositeSourceOver, m_blen dMode) << ")\n";
605 }
606
607 if (m_isRootForIsolatedGroup) {
608 writeIndent(ts, indent + 1);
609 ts << "(isolate " << m_isRootForIsolatedGroup << ")\n";
610 }
611
600 if (m_contentsOpaque) { 612 if (m_contentsOpaque) {
601 writeIndent(ts, indent + 1); 613 writeIndent(ts, indent + 1);
602 ts << "(contentsOpaque " << m_contentsOpaque << ")\n"; 614 ts << "(contentsOpaque " << m_contentsOpaque << ")\n";
603 } 615 }
604 616
605 if (m_preserves3D) { 617 if (m_preserves3D) {
606 writeIndent(ts, indent + 1); 618 writeIndent(ts, indent + 1);
607 ts << "(preserves3D " << m_preserves3D << ")\n"; 619 ts << "(preserves3D " << m_preserves3D << ")\n";
608 } 620 }
609 621
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 m_layer->setDoubleSided(m_backfaceVisibility); 938 m_layer->setDoubleSided(m_backfaceVisibility);
927 } 939 }
928 940
929 void GraphicsLayer::setOpacity(float opacity) 941 void GraphicsLayer::setOpacity(float opacity)
930 { 942 {
931 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); 943 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f);
932 m_opacity = clampedOpacity; 944 m_opacity = clampedOpacity;
933 platformLayer()->setOpacity(opacity); 945 platformLayer()->setOpacity(opacity);
934 } 946 }
935 947
948 void GraphicsLayer::setBlendMode(BlendMode blendMode)
949 {
950 if (m_blendMode == blendMode)
951 return;
952 m_blendMode = blendMode;
953 platformLayer()->setBlendMode(blink::WebBlendMode(blendMode));
954 }
955
956 void GraphicsLayer::setIsRootForIsolatedGroup(bool isolated)
957 {
958 if (m_isRootForIsolatedGroup == isolated)
959 return;
960 m_isRootForIsolatedGroup = isolated;
961 platformLayer()->setIsRootForIsolatedGroup(isolated);
962 }
963
936 void GraphicsLayer::setContentsNeedsDisplay() 964 void GraphicsLayer::setContentsNeedsDisplay()
937 { 965 {
938 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { 966 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
939 contentsLayer->invalidate(); 967 contentsLayer->invalidate();
940 addRepaintRect(contentsRect()); 968 addRepaintRect(contentsRect());
941 } 969 }
942 } 970 }
943 971
944 void GraphicsLayer::setNeedsDisplay() 972 void GraphicsLayer::setNeedsDisplay()
945 { 973 {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 #ifndef NDEBUG 1239 #ifndef NDEBUG
1212 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1240 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1213 { 1241 {
1214 if (!layer) 1242 if (!layer)
1215 return; 1243 return;
1216 1244
1217 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1245 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1218 fprintf(stderr, "%s\n", output.utf8().data()); 1246 fprintf(stderr, "%s\n", output.utf8().data());
1219 } 1247 }
1220 #endif 1248 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698