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 23 matching lines...) Expand all Loading... |
34 #include "platform/graphics/GraphicsContext.h" | 34 #include "platform/graphics/GraphicsContext.h" |
35 #include "platform/graphics/paint/PaintArtifactToSkCanvas.h" | 35 #include "platform/graphics/paint/PaintArtifactToSkCanvas.h" |
36 #include "platform/graphics/paint/PaintController.h" | 36 #include "platform/graphics/paint/PaintController.h" |
37 #include "platform/transforms/AffineTransform.h" | 37 #include "platform/transforms/AffineTransform.h" |
38 #include "platform/transforms/TransformationMatrix.h" | 38 #include "platform/transforms/TransformationMatrix.h" |
39 #include "public/platform/WebDisplayItemList.h" | 39 #include "public/platform/WebDisplayItemList.h" |
40 #include "public/platform/WebFloatRect.h" | 40 #include "public/platform/WebFloatRect.h" |
41 #include "public/platform/WebRect.h" | 41 #include "public/platform/WebRect.h" |
42 #include "third_party/skia/include/core/SkCanvas.h" | 42 #include "third_party/skia/include/core/SkCanvas.h" |
43 #include "third_party/skia/include/core/SkPicture.h" | 43 #include "third_party/skia/include/core/SkPicture.h" |
| 44 #include "ui/gfx/geometry/rect.h" |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 ContentLayerDelegate::ContentLayerDelegate(GraphicsContextPainter* painter) | 48 ContentLayerDelegate::ContentLayerDelegate(GraphicsContextPainter* painter) |
48 : m_painter(painter) | 49 : m_painter(painter) |
49 { | 50 { |
50 } | 51 } |
51 | 52 |
52 ContentLayerDelegate::~ContentLayerDelegate() | 53 ContentLayerDelegate::~ContentLayerDelegate() |
53 { | 54 { |
(...skipping 20 matching lines...) Expand all Loading... |
74 // one big flat SkPicture. | 75 // one big flat SkPicture. |
75 SkRect skBounds = SkRect::MakeXYWH(bounds.x, bounds.y, bounds.width, bou
nds.height); | 76 SkRect skBounds = SkRect::MakeXYWH(bounds.x, bounds.y, bounds.width, bou
nds.height); |
76 RefPtr<SkPicture> picture = paintArtifactToSkPicture(artifact, skBounds)
; | 77 RefPtr<SkPicture> picture = paintArtifactToSkPicture(artifact, skBounds)
; |
77 // TODO(wkorman): Pass actual visual rect with the drawing item. | 78 // TODO(wkorman): Pass actual visual rect with the drawing item. |
78 list->appendDrawingItem(IntRect(), picture.get()); | 79 list->appendDrawingItem(IntRect(), picture.get()); |
79 return; | 80 return; |
80 } | 81 } |
81 artifact.appendToWebDisplayItemList(list); | 82 artifact.appendToWebDisplayItemList(list); |
82 } | 83 } |
83 | 84 |
| 85 gfx::Rect ContentLayerDelegate::paintableRegion() |
| 86 { |
| 87 IntRect interestRect = m_painter->interestRect(); |
| 88 return gfx::Rect(interestRect.x(), interestRect.y(), interestRect.width(), i
nterestRect.height()); |
| 89 } |
| 90 |
84 void ContentLayerDelegate::paintContents( | 91 void ContentLayerDelegate::paintContents( |
85 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 92 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
86 WebContentLayerClient::PaintingControlSetting paintingControl) | 93 WebContentLayerClient::PaintingControlSetting paintingControl) |
87 { | 94 { |
88 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); | 95 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); |
89 | 96 |
90 PaintController* paintController = m_painter->paintController(); | 97 PaintController* paintController = m_painter->paintController(); |
91 ASSERT(paintController); | 98 ASSERT(paintController); |
92 paintController->setDisplayItemConstructionIsDisabled( | 99 paintController->setDisplayItemConstructionIsDisabled( |
93 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); | 100 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); |
(...skipping 15 matching lines...) Expand all Loading... |
109 paintController->commitNewDisplayItems(); | 116 paintController->commitNewDisplayItems(); |
110 paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paint
Artifact(), clip); | 117 paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paint
Artifact(), clip); |
111 } | 118 } |
112 | 119 |
113 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const | 120 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |
114 { | 121 { |
115 return m_painter->paintController()->approximateUnsharedMemoryUsage(); | 122 return m_painter->paintController()->approximateUnsharedMemoryUsage(); |
116 } | 123 } |
117 | 124 |
118 } // namespace blink | 125 } // namespace blink |
OLD | NEW |