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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2552893005: Add ColorBehavior to GraphicsLayer and GraphicsContext (Closed)
Patch Set: Rebase Created 4 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/GraphicsLayer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 client->isTrackingRasterInvalidations()), 103 client->isTrackingRasterInvalidations()),
104 m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip), 104 m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip),
105 m_parent(0), 105 m_parent(0),
106 m_maskLayer(0), 106 m_maskLayer(0),
107 m_contentsClippingMaskLayer(0), 107 m_contentsClippingMaskLayer(0),
108 m_paintCount(0), 108 m_paintCount(0),
109 m_contentsLayer(0), 109 m_contentsLayer(0),
110 m_contentsLayerId(0), 110 m_contentsLayerId(0),
111 m_scrollableArea(nullptr), 111 m_scrollableArea(nullptr),
112 m_renderingContext3d(0), 112 m_renderingContext3d(0),
113 m_colorBehavior(ColorBehavior::transformToGlobalTarget()),
113 m_hasPreferredRasterBounds(false) { 114 m_hasPreferredRasterBounds(false) {
114 #if ENABLE(ASSERT) 115 #if ENABLE(ASSERT)
115 if (m_client) 116 if (m_client)
116 m_client->verifyNotPainting(); 117 m_client->verifyNotPainting();
117 #endif 118 #endif
118 119
120 // In true color mode, no inputs are adjusted, and all colors are converted
121 // at rasterization time.
122 if (RuntimeEnabledFeatures::trueColorRenderingEnabled())
123 m_colorBehavior = ColorBehavior::tag();
124
119 m_contentLayerDelegate = WTF::makeUnique<ContentLayerDelegate>(this); 125 m_contentLayerDelegate = WTF::makeUnique<ContentLayerDelegate>(this);
120 m_layer = Platform::current()->compositorSupport()->createContentLayer( 126 m_layer = Platform::current()->compositorSupport()->createContentLayer(
121 m_contentLayerDelegate.get()); 127 m_contentLayerDelegate.get());
122 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); 128 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
123 m_layer->layer()->setLayerClient(this); 129 m_layer->layer()->setLayerClient(this);
124 } 130 }
125 131
126 GraphicsLayer::~GraphicsLayer() { 132 GraphicsLayer::~GraphicsLayer() {
127 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 133 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
128 m_linkHighlights[i]->clearCurrentGraphicsLayer(); 134 m_linkHighlights[i]->clearCurrentGraphicsLayer();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 m_client->computeInterestRect(this, m_previousInterestRect); 326 m_client->computeInterestRect(this, m_previousInterestRect);
321 interestRect = &newInterestRect; 327 interestRect = &newInterestRect;
322 } 328 }
323 329
324 if (!getPaintController().subsequenceCachingIsDisabled() && 330 if (!getPaintController().subsequenceCachingIsDisabled() &&
325 !m_client->needsRepaint(*this) && !getPaintController().cacheIsEmpty() && 331 !m_client->needsRepaint(*this) && !getPaintController().cacheIsEmpty() &&
326 m_previousInterestRect == *interestRect) { 332 m_previousInterestRect == *interestRect) {
327 return false; 333 return false;
328 } 334 }
329 335
330 GraphicsContext context(getPaintController(), disabledMode); 336 GraphicsContext context(getPaintController(), disabledMode, nullptr,
337 m_colorBehavior);
331 338
332 m_previousInterestRect = *interestRect; 339 m_previousInterestRect = *interestRect;
333 m_client->paintContents(this, context, m_paintingPhase, *interestRect); 340 m_client->paintContents(this, context, m_paintingPhase, *interestRect);
334 notifyFirstPaintToClient(); 341 notifyFirstPaintToClient();
335 return true; 342 return true;
336 } 343 }
337 344
338 void GraphicsLayer::notifyFirstPaintToClient() { 345 void GraphicsLayer::notifyFirstPaintToClient() {
339 bool isFirstPaint = false; 346 bool isFirstPaint = false;
340 if (!m_painted) { 347 if (!m_painted) {
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 void GraphicsLayer::setCompositorMutableProperties(uint32_t properties) { 1234 void GraphicsLayer::setCompositorMutableProperties(uint32_t properties) {
1228 if (WebLayer* layer = platformLayer()) 1235 if (WebLayer* layer = platformLayer())
1229 layer->setCompositorMutableProperties(properties); 1236 layer->setCompositorMutableProperties(properties);
1230 } 1237 }
1231 1238
1232 sk_sp<SkPicture> GraphicsLayer::capturePicture() { 1239 sk_sp<SkPicture> GraphicsLayer::capturePicture() {
1233 if (!drawsContent()) 1240 if (!drawsContent())
1234 return nullptr; 1241 return nullptr;
1235 1242
1236 IntSize intSize = expandedIntSize(size()); 1243 IntSize intSize = expandedIntSize(size());
1237 GraphicsContext graphicsContext(getPaintController()); 1244 GraphicsContext graphicsContext(getPaintController(),
1245 GraphicsContext::NothingDisabled, nullptr,
1246 m_colorBehavior);
1238 graphicsContext.beginRecording(IntRect(IntPoint(0, 0), intSize)); 1247 graphicsContext.beginRecording(IntRect(IntPoint(0, 0), intSize));
1239 getPaintController().paintArtifact().replay(graphicsContext); 1248 getPaintController().paintArtifact().replay(graphicsContext);
1240 return graphicsContext.endRecording(); 1249 return graphicsContext.endRecording();
1241 } 1250 }
1242 1251
1243 static bool pixelComponentsDiffer(int c1, int c2) { 1252 static bool pixelComponentsDiffer(int c1, int c2) {
1244 // Compare strictly for saturated values. 1253 // Compare strictly for saturated values.
1245 if (c1 == 0 || c1 == 255 || c2 == 0 || c2 == 255) 1254 if (c1 == 0 || c1 == 255 || c2 == 0 || c2 == 255)
1246 return c1 != c2; 1255 return c1 != c2;
1247 // Tolerate invisible differences that may occur in gradients etc. 1256 // Tolerate invisible differences that may occur in gradients etc.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1352 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1344 if (!layer) { 1353 if (!layer) {
1345 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; 1354 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil).";
1346 return; 1355 return;
1347 } 1356 }
1348 1357
1349 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1358 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1350 LOG(INFO) << output.utf8().data(); 1359 LOG(INFO) << output.utf8().data();
1351 } 1360 }
1352 #endif 1361 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/GraphicsLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698