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

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: adding the rendering part Created 7 years, 3 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
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_isIsolatedGroupRoot(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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 m_layer->setDoubleSided(m_backfaceVisibility); 1011 m_layer->setDoubleSided(m_backfaceVisibility);
1010 } 1012 }
1011 1013
1012 void GraphicsLayer::setOpacity(float opacity) 1014 void GraphicsLayer::setOpacity(float opacity)
1013 { 1015 {
1014 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); 1016 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f);
1015 m_opacity = clampedOpacity; 1017 m_opacity = clampedOpacity;
1016 platformLayer()->setOpacity(opacity); 1018 platformLayer()->setOpacity(opacity);
1017 } 1019 }
1018 1020
1021 void GraphicsLayer::setBlendMode(BlendMode blendMode)
1022 {
1023 if (m_blendMode == blendMode)
1024 return;
1025 m_blendMode = blendMode;
1026 platformLayer()->setBlendMode(WebKit::fromWebCoreBlendMode(blendMode));
1027 }
1028
1029 void GraphicsLayer::setIsIsolatedGroupRoot(bool isolated)
1030 {
1031 if (m_isIsolatedGroupRoot == isolated)
1032 return;
1033 m_isIsolatedGroupRoot = isolated;
1034 platformLayer()->setIsIsolatedGroupRoot(isolated);
1035 }
1036
1019 void GraphicsLayer::setContentsNeedsDisplay() 1037 void GraphicsLayer::setContentsNeedsDisplay()
1020 { 1038 {
1021 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { 1039 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
1022 contentsLayer->invalidate(); 1040 contentsLayer->invalidate();
1023 addRepaintRect(contentsRect()); 1041 addRepaintRect(contentsRect());
1024 } 1042 }
1025 } 1043 }
1026 1044
1027 void GraphicsLayer::setNeedsDisplay() 1045 void GraphicsLayer::setNeedsDisplay()
1028 { 1046 {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 #ifndef NDEBUG 1348 #ifndef NDEBUG
1331 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1349 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1332 { 1350 {
1333 if (!layer) 1351 if (!layer)
1334 return; 1352 return;
1335 1353
1336 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1354 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1337 fprintf(stderr, "%s\n", output.utf8().data()); 1355 fprintf(stderr, "%s\n", output.utf8().data());
1338 } 1356 }
1339 #endif 1357 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698