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

Side by Side Diff: Source/platform/graphics/ContentLayerDelegate.cpp

Issue 880653004: Blink side of changes to enable cache clearing without a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Better use of enum. Created 5 years, 10 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
« no previous file with comments | « Source/platform/graphics/ContentLayerDelegate.h ('k') | Source/web/LinkHighlight.h » ('j') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 , m_opaque(false) 46 , m_opaque(false)
47 { 47 {
48 } 48 }
49 49
50 ContentLayerDelegate::~ContentLayerDelegate() 50 ContentLayerDelegate::~ContentLayerDelegate()
51 { 51 {
52 } 52 }
53 53
54 void ContentLayerDelegate::paintContents( 54 void ContentLayerDelegate::paintContents(
55 SkCanvas* canvas, const WebRect& clip, 55 SkCanvas* canvas, const WebRect& clip,
56 WebContentLayerClient::GraphicsContextStatus contextStatus) 56 WebContentLayerClient::PaintingControlSetting paintingControl)
57 { 57 {
58 static const unsigned char* annotationsEnabled = 0; 58 static const unsigned char* annotationsEnabled = 0;
59 if (UNLIKELY(!annotationsEnabled)) 59 if (UNLIKELY(!annotationsEnabled))
60 annotationsEnabled = EventTracer::getTraceCategoryEnabledFlag(TRACE_DISA BLED_BY_DEFAULT("blink.graphics_context_annotations")); 60 annotationsEnabled = EventTracer::getTraceCategoryEnabledFlag(TRACE_DISA BLED_BY_DEFAULT("blink.graphics_context_annotations"));
61 61
62 GraphicsContext context(canvas, m_painter->displayItemList(), contextStatus == WebContentLayerClient::GraphicsContextEnabled ? GraphicsContext::NothingDisab led : GraphicsContext::FullyDisabled); 62 GraphicsContext context(canvas, m_painter->displayItemList(),
63 paintingControl == WebContentLayerClient::DisplayListConstructionDisable d ? GraphicsContext::FullyDisabled : GraphicsContext::NothingDisabled);
63 context.setCertainlyOpaque(m_opaque); 64 context.setCertainlyOpaque(m_opaque);
64 if (*annotationsEnabled) 65 if (*annotationsEnabled)
65 context.setAnnotationMode(AnnotateAll); 66 context.setAnnotationMode(AnnotateAll);
66 67
67 m_painter->paint(context, clip); 68 m_painter->paint(context, clip);
68 69
69 if (DisplayItemList* displayItemList = m_painter->displayItemList()) 70 if (DisplayItemList* displayItemList = m_painter->displayItemList())
70 displayItemList->endNewPaints(); 71 displayItemList->endNewPaints();
71 } 72 }
72 73
73 void ContentLayerDelegate::paintContents( 74 void ContentLayerDelegate::paintContents(
74 WebDisplayItemList* webDisplayItemList, const WebRect& clip, 75 WebDisplayItemList* webDisplayItemList, const WebRect& clip,
75 WebContentLayerClient::GraphicsContextStatus contextStatus) 76 WebContentLayerClient::PaintingControlSetting paintingControl)
76 { 77 {
77 // Once Slimming Paint is fully implemented, this method will no longer 78 // Once Slimming Paint is fully implemented, this method will no longer
78 // be needed since Blink will be in charge of creating the display list 79 // be needed since Blink will be in charge of creating the display list
79 // during the document lifecylcle. 80 // during the document lifecylcle.
80 81
82 if (paintingControl == WebContentLayerClient::DisplayListCachingDisabled)
83 m_painter->displayItemList()->invalidateAll();
84
81 // Some layers don't yet produce display lists. To handle such layers, we 85 // Some layers don't yet produce display lists. To handle such layers, we
82 // create a canvas backed by an SkPicture, and manually insert this 86 // create a canvas backed by an SkPicture, and manually insert this
83 // SkPicture into the WebDisplayItemList when the layer's display list is 87 // SkPicture into the WebDisplayItemList when the layer's display list is
84 // empty. 88 // empty.
85 SkPictureRecorder recorder; 89 SkPictureRecorder recorder;
86 RefPtr<SkPicture> picture; 90 RefPtr<SkPicture> picture;
87 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height); 91 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height);
88 canvas->save(); 92 canvas->save();
89 canvas->translate(-clip.x, -clip.y); 93 canvas->translate(-clip.x, -clip.y);
90 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height)); 94 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height));
91 paintContents(canvas, clip, contextStatus); 95 paintContents(canvas, clip, paintingControl);
92 canvas->restore(); 96 canvas->restore();
93 picture = adoptRef(recorder.endRecording()); 97 picture = adoptRef(recorder.endRecording());
94 98
95 const PaintList& paintList = m_painter->displayItemList()->paintList(); 99 const PaintList& paintList = m_painter->displayItemList()->paintList();
96 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end() ; ++it) 100 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end() ; ++it)
97 (*it)->appendToWebDisplayItemList(webDisplayItemList); 101 (*it)->appendToWebDisplayItemList(webDisplayItemList);
98 } 102 }
99 103
100 } // namespace blink 104 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/ContentLayerDelegate.h ('k') | Source/web/LinkHighlight.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698