| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/paint/DrawingRecorder.h" | 5 #include "platform/graphics/paint/DrawingRecorder.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/GraphicsLayer.h" | 9 #include "platform/graphics/GraphicsLayer.h" |
| 10 #include "platform/graphics/paint/PaintController.h" | 10 #include "platform/graphics/paint/PaintController.h" |
| 11 #include "third_party/skia/include/core/SkPicture.h" | 11 #include "third_party/skia/include/core/SkPicture.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClie
nt& displayItemClient, DisplayItem::Type displayItemType, const FloatRect& float
CullRect) | 15 DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClie
nt& displayItemClient, DisplayItem::Type displayItemType, const FloatRect& float
CullRect) |
| 16 : m_context(context) | 16 : m_context(context) |
| 17 , m_displayItemClient(displayItemClient) | 17 , m_displayItemClient(displayItemClient) |
| 18 , m_displayItemType(displayItemType) | 18 , m_displayItemType(displayItemType) |
| 19 , m_knownToBeOpaque(false) | 19 , m_knownToBeOpaque(false) |
| 20 #if DCHECK_IS_ON() | 20 #if DCHECK_IS_ON() |
| 21 , m_displayItemPosition(m_context.getPaintController().newDisplayItemList().
size()) | 21 , m_displayItemPosition(m_context.getPaintController().newDisplayItemList().
size()) |
| 22 #endif | 22 #endif |
| 23 { | 23 { |
| 24 if (context.getPaintController().displayItemConstructionIsDisabled()) | 24 if (context.getPaintController().displayItemConstructionIsDisabled()) |
| 25 return; | 25 return; |
| 26 | 26 |
| 27 // Must check DrawingRecorder::useCachedDrawingIfPossible before creating th
e DrawingRecorder. | 27 // Must check DrawingRecorder::useCachedDrawingIfPossible before creating th
e DrawingRecorder. |
| 28 DCHECK(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled
() | 28 DCHECK(RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() |
| 29 || !useCachedDrawingIfPossible(m_context, m_displayItemClient, m_display
ItemType)); | 29 || !useCachedDrawingIfPossible(m_context, m_displayItemClient, m_display
ItemType)); |
| 30 | 30 |
| 31 DCHECK(DisplayItem::isDrawingType(displayItemType)); | 31 DCHECK(DisplayItem::isDrawingType(displayItemType)); |
| 32 | 32 |
| 33 #if DCHECK_IS_ON() | 33 #if DCHECK_IS_ON() |
| 34 context.setInDrawingRecorder(true); | 34 context.setInDrawingRecorder(true); |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 // Use the enclosing int rect, since pixel-snapping may be applied to the bo
unds of the object during painting. Potentially expanding | 37 // Use the enclosing int rect, since pixel-snapping may be applied to the bo
unds of the object during painting. Potentially expanding |
| 38 // the cull rect by a pixel or two also does not affect correctness, and is
very unlikely to matter for performance. | 38 // the cull rect by a pixel or two also does not affect correctness, and is
very unlikely to matter for performance. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 65 m_context.restore(); | 65 m_context.restore(); |
| 66 | 66 |
| 67 m_context.setInDrawingRecorder(false); | 67 m_context.setInDrawingRecorder(false); |
| 68 DCHECK(m_displayItemPosition == m_context.getPaintController().newDisplayIte
mList().size()); | 68 DCHECK(m_displayItemPosition == m_context.getPaintController().newDisplayIte
mList().size()); |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 m_context.getPaintController().createAndAppend<DrawingDisplayItem>(m_display
ItemClient, m_displayItemType, m_context.endRecording(), m_knownToBeOpaque); | 71 m_context.getPaintController().createAndAppend<DrawingDisplayItem>(m_display
ItemClient, m_displayItemType, m_context.endRecording(), m_knownToBeOpaque); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |