| 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 | 46 |
| 47 ContentLayerDelegate::ContentLayerDelegate(GraphicsContextPainter* painter) | 47 ContentLayerDelegate::ContentLayerDelegate(GraphicsContextPainter* painter) |
| 48 : m_painter(painter) | 48 : m_painter(painter) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 ContentLayerDelegate::~ContentLayerDelegate() | 52 ContentLayerDelegate::~ContentLayerDelegate() |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 static void paintArtifactToWebDisplayItemList(WebDisplayItemList* list, const Pa
intArtifact& artifact, const gfx::Rect& bounds) | 56 static void paintArtifactToWebDisplayItemList(WebDisplayItemList* list, const Pa
intArtifact& artifact, |
| 57 const PaintController::DisplayItemRectMap& visualRects, const gfx::Rect& bou
nds) |
| 57 { | 58 { |
| 58 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 59 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 59 // This is a temporary path to paint the artifact using the paint chunk | 60 // This is a temporary path to paint the artifact using the paint chunk |
| 60 // properties. Ultimately, we should instead split the artifact into | 61 // properties. Ultimately, we should instead split the artifact into |
| 61 // separate layers and send those to the compositor, instead of sending | 62 // separate layers and send those to the compositor, instead of sending |
| 62 // one big flat SkPicture. | 63 // one big flat SkPicture. |
| 63 SkRect skBounds = SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(
), bounds.height()); | 64 SkRect skBounds = SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(
), bounds.height()); |
| 64 RefPtr<SkPicture> picture = paintArtifactToSkPicture(artifact, skBounds)
; | 65 RefPtr<SkPicture> picture = paintArtifactToSkPicture(artifact, skBounds)
; |
| 65 // TODO(wkorman): Pass actual visual rect with the drawing item. | 66 // TODO(wkorman): Why do we need to explicitly construct now? Wasn't req
uired previously. |
| 66 list->appendDrawingItem(IntRect(), picture.get()); | 67 list->appendDrawingItem(WebRect(bounds.x(), bounds.y(), bounds.width(),
bounds.height()), picture.get()); |
| 67 return; | 68 return; |
| 68 } | 69 } |
| 69 artifact.appendToWebDisplayItemList(list); | 70 artifact.appendToWebDisplayItemList(visualRects, list); |
| 70 } | 71 } |
| 71 | 72 |
| 72 gfx::Rect ContentLayerDelegate::paintableRegion() | 73 gfx::Rect ContentLayerDelegate::paintableRegion() |
| 73 { | 74 { |
| 74 IntRect interestRect = m_painter->interestRect(); | 75 IntRect interestRect = m_painter->interestRect(); |
| 75 return gfx::Rect(interestRect.x(), interestRect.y(), interestRect.width(), i
nterestRect.height()); | 76 return gfx::Rect(interestRect.x(), interestRect.y(), interestRect.width(), i
nterestRect.height()); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void ContentLayerDelegate::paintContents( | 79 void ContentLayerDelegate::paintContents( |
| 79 WebDisplayItemList* webDisplayItemList, WebContentLayerClient::PaintingContr
olSetting paintingControl) | 80 WebDisplayItemList* webDisplayItemList, WebContentLayerClient::PaintingContr
olSetting paintingControl) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 | 93 |
| 93 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; | 94 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; |
| 94 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled | 95 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled |
| 95 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) | 96 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) |
| 96 disabledMode = GraphicsContext::FullyDisabled; | 97 disabledMode = GraphicsContext::FullyDisabled; |
| 97 GraphicsContext context(*paintController, disabledMode); | 98 GraphicsContext context(*paintController, disabledMode); |
| 98 | 99 |
| 99 m_painter->paint(context, nullptr); | 100 m_painter->paint(context, nullptr); |
| 100 | 101 |
| 101 paintController->commitNewDisplayItems(); | 102 paintController->commitNewDisplayItems(); |
| 102 paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paint
Artifact(), paintableRegion()); | 103 paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paint
Artifact(), |
| 104 paintController->displayItemVisualRects(), paintableRegion()); |
| 103 paintController->setDisplayItemConstructionIsDisabled(false); | 105 paintController->setDisplayItemConstructionIsDisabled(false); |
| 104 } | 106 } |
| 105 | 107 |
| 106 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const | 108 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |
| 107 { | 109 { |
| 108 return m_painter->paintController()->approximateUnsharedMemoryUsage(); | 110 return m_painter->paintController()->approximateUnsharedMemoryUsage(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |