| 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/paint/DrawingRecorder.h" | 6 #include "platform/graphics/paint/DrawingRecorder.h" |
| 7 | 7 |
| 8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/GraphicsLayer.h" | 10 #include "platform/graphics/GraphicsLayer.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (!m_canUseCachedDrawing) | 47 if (!m_canUseCachedDrawing) |
| 48 context.beginRecording(cullRect); | 48 context.beginRecording(cullRect); |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if ENABLE(ASSERT) | 51 #if ENABLE(ASSERT) |
| 52 if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled() &&
!m_canUseCachedDrawing) { | 52 if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled() &&
!m_canUseCachedDrawing) { |
| 53 // Skia depends on the cull rect containing all of the display item comm
ands. When strict | 53 // Skia depends on the cull rect containing all of the display item comm
ands. When strict |
| 54 // cull rect clipping is enabled, make this explicit. This allows us to
identify potential | 54 // cull rect clipping is enabled, make this explicit. This allows us to
identify potential |
| 55 // incorrect cull rects that might otherwise be masked due to Skia inter
nal optimizations. | 55 // incorrect cull rects that might otherwise be masked due to Skia inter
nal optimizations. |
| 56 context.save(); | 56 context.save(); |
| 57 context.clipRect(enclosingIntRect(cullRect), NotAntiAliased, SkRegion::k
Intersect_Op); | 57 IntRect verificationClip = enclosingIntRect(cullRect); |
| 58 // Expand the verification clip by one pixel to account for Skia's SkCan
vas::getClipBounds() |
| 59 // expansion, used in testing cull rects. |
| 60 // TODO(schenney) This is not the best place to do this. Ideally, we wou
ld expand by one pixel |
| 61 // in device (pixel) space, but to do that we would need to add the veri
fication mode to Skia. |
| 62 verificationClip.inflate(1); |
| 63 context.clipRect(verificationClip, NotAntiAliased, SkRegion::kIntersect_
Op); |
| 58 } | 64 } |
| 59 #endif | 65 #endif |
| 60 } | 66 } |
| 61 | 67 |
| 62 DrawingRecorder::~DrawingRecorder() | 68 DrawingRecorder::~DrawingRecorder() |
| 63 { | 69 { |
| 64 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) | 70 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| 65 return; | 71 return; |
| 66 | 72 |
| 67 ASSERT(m_context.displayItemList()); | 73 ASSERT(m_context.displayItemList()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 } else { | 95 } else { |
| 90 OwnPtr<DrawingDisplayItem> drawingDisplayItem = DrawingDisplayItem::crea
te(m_displayItemClient, m_displayItemType, m_context.endRecording()); | 96 OwnPtr<DrawingDisplayItem> drawingDisplayItem = DrawingDisplayItem::crea
te(m_displayItemClient, m_displayItemType, m_context.endRecording()); |
| 91 #if ENABLE(ASSERT) | 97 #if ENABLE(ASSERT) |
| 92 drawingDisplayItem->setUnderInvalidationCheckingMode(m_underInvalidation
CheckingMode); | 98 drawingDisplayItem->setUnderInvalidationCheckingMode(m_underInvalidation
CheckingMode); |
| 93 #endif | 99 #endif |
| 94 m_context.displayItemList()->add(drawingDisplayItem.release()); | 100 m_context.displayItemList()->add(drawingDisplayItem.release()); |
| 95 } | 101 } |
| 96 } | 102 } |
| 97 | 103 |
| 98 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |