OLD | NEW |
---|---|
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 Loading... | |
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(), paintingContro l == WebContentLayerClient::PaintDefaultBehavior ? GraphicsContext::NothingDisab led : GraphicsContext::FullyDisabled); |
chrishtr
2015/02/03 22:05:43
Don't you want to set FullyDisabled only with Disp
Stephen Chennney
2015/02/03 22:11:32
Yes, that makes more sense. We can then get 3 mode
| |
63 context.setCertainlyOpaque(m_opaque); | 63 context.setCertainlyOpaque(m_opaque); |
64 if (*annotationsEnabled) | 64 if (*annotationsEnabled) |
65 context.setAnnotationMode(AnnotateAll); | 65 context.setAnnotationMode(AnnotateAll); |
66 | 66 |
67 m_painter->paint(context, clip); | 67 m_painter->paint(context, clip); |
68 | 68 |
69 if (DisplayItemList* displayItemList = m_painter->displayItemList()) | 69 if (DisplayItemList* displayItemList = m_painter->displayItemList()) |
70 displayItemList->endNewPaints(); | 70 displayItemList->endNewPaints(); |
71 } | 71 } |
72 | 72 |
73 void ContentLayerDelegate::paintContents( | 73 void ContentLayerDelegate::paintContents( |
74 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 74 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
75 WebContentLayerClient::GraphicsContextStatus contextStatus) | 75 WebContentLayerClient::PaintingControlSetting paintingControl) |
76 { | 76 { |
77 // Once Slimming Paint is fully implemented, this method will no longer | 77 // 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 | 78 // be needed since Blink will be in charge of creating the display list |
79 // during the document lifecylcle. | 79 // during the document lifecylcle. |
80 | 80 |
81 if (paintingControl == WebContentLayerClient::DisplayListCachingDisabled) | |
82 m_painter->displayItemList()->invalidateAll(); | |
83 | |
81 // Some layers don't yet produce display lists. To handle such layers, we | 84 // 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 | 85 // create a canvas backed by an SkPicture, and manually insert this |
83 // SkPicture into the WebDisplayItemList when the layer's display list is | 86 // SkPicture into the WebDisplayItemList when the layer's display list is |
84 // empty. | 87 // empty. |
85 SkPictureRecorder recorder; | 88 SkPictureRecorder recorder; |
86 RefPtr<SkPicture> picture; | 89 RefPtr<SkPicture> picture; |
87 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height); | 90 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height); |
88 canvas->save(); | 91 canvas->save(); |
89 canvas->translate(-clip.x, -clip.y); | 92 canvas->translate(-clip.x, -clip.y); |
90 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height)); | 93 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height)); |
91 paintContents(canvas, clip, contextStatus); | 94 paintContents(canvas, clip, paintingControl); |
92 canvas->restore(); | 95 canvas->restore(); |
93 picture = adoptRef(recorder.endRecording()); | 96 picture = adoptRef(recorder.endRecording()); |
94 | 97 |
95 const PaintList& paintList = m_painter->displayItemList()->paintList(); | 98 const PaintList& paintList = m_painter->displayItemList()->paintList(); |
96 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end() ; ++it) | 99 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end() ; ++it) |
97 (*it)->appendToWebDisplayItemList(webDisplayItemList); | 100 (*it)->appendToWebDisplayItemList(webDisplayItemList); |
98 } | 101 } |
99 | 102 |
100 } // namespace blink | 103 } // namespace blink |
OLD | NEW |