Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PaintArtifact_h | |
| 6 #define PaintArtifact_h | |
| 7 | |
| 8 #include "platform/PlatformExport.h" | |
| 9 #include "platform/graphics/paint/DisplayItems.h" | |
| 10 #include "platform/graphics/paint/PaintChunk.h" | |
| 11 #include "wtf/Vector.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 class GraphicsContext; | |
| 16 class WebDisplayItemList; | |
| 17 | |
| 18 // The output of painting, consisting of a series of drawings partitioned into | |
| 19 // discontiguous chunks with a common set of paint properties (i.e. associated | |
|
wkorman
2015/10/09 04:45:50
Does the order of chunks in the vector matter / is
| |
| 20 // with the same transform, clip, effects, etc.). | |
| 21 // | |
| 22 // It represents a particular state of the world, and should be immutable | |
| 23 // (const) to most of its users. | |
| 24 class PLATFORM_EXPORT PaintArtifact { | |
| 25 public: | |
| 26 PaintArtifact(); | |
| 27 ~PaintArtifact(); | |
| 28 | |
| 29 bool isEmpty() const { return m_displayItems.isEmpty(); } | |
| 30 | |
| 31 DisplayItems& displayItems() { return m_displayItems; } | |
| 32 const DisplayItems& displayItems() const { return m_displayItems; } | |
| 33 | |
| 34 Vector<PaintChunk>& paintChunks() { return m_paintChunks; } | |
| 35 const Vector<PaintChunk>& paintChunks() const { return m_paintChunks; } | |
| 36 | |
| 37 // Resets to an empty paint artifact. | |
| 38 void reset(); | |
| 39 | |
| 40 // Updates the artifact with complete display items and chunks. | |
| 41 // This swaps out of the display items, making it empty. | |
| 42 // This will be more efficient if you pass an rvalue for updatedPaintChunks | |
| 43 // to avoid a copy. | |
| 44 // TODO(jbroman): Clean this up once std::move is legal in Blink. | |
| 45 void update(DisplayItems& updatedDisplayItems, Vector<PaintChunk> updatedPai ntChunks); | |
|
pdr.
2015/10/09 03:57:51
I think it would be best to leave this in the clas
jbroman
2015/10/13 18:20:56
I waffled on this point, so I'll mail you a CL to
| |
| 46 | |
| 47 // Returns the approximate memory usage, excluding memory likely to be | |
| 48 // shared with the embedder after copying to WebDisplayItemList. | |
| 49 size_t approximateUnsharedMemoryUsage() const; | |
| 50 | |
| 51 // Draws the paint artifact to a GraphicsContext. | |
| 52 void replay(GraphicsContext&) const; | |
| 53 | |
| 54 // Writes the paint artifact into a WebDisplayItemList. | |
| 55 void appendToWebDisplayItemList(WebDisplayItemList*) const; | |
| 56 | |
| 57 private: | |
| 58 DisplayItems m_displayItems; | |
| 59 Vector<PaintChunk> m_paintChunks; | |
| 60 }; | |
| 61 | |
| 62 } // namespace blink | |
| 63 | |
| 64 #endif // PaintArtifact_h | |
| OLD | NEW |