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 // fprintf(stderr, "ContentLayerDelegate::paintableRegion\n"); |
| 88 IntRect interestRect = m_painter->interestRect(); |
| 89 return gfx::Rect(interestRect.x(), interestRect.y(), interestRect.width(), i
nterestRect.height()); |
| 90 } |
| 91 |
84 void ContentLayerDelegate::paintContents( | 92 void ContentLayerDelegate::paintContents( |
85 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 93 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
86 WebContentLayerClient::PaintingControlSetting paintingControl) | 94 WebContentLayerClient::PaintingControlSetting paintingControl) |
87 { | 95 { |
88 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); | 96 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); |
89 | 97 |
90 // TODO(pdr): Remove when slimming paint v2 is further along. This is only | 98 // TODO(pdr): Remove when slimming paint v2 is further along. This is only |
91 // here so the browser is usable during development and does not crash due | 99 // here so the browser is usable during development and does not crash due |
92 // to committing the new display items twice. | 100 // to committing the new display items twice. |
93 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 101 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
(...skipping 23 matching lines...) Expand all Loading... |
117 paintController->commitNewDisplayItems(); | 125 paintController->commitNewDisplayItems(); |
118 paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paint
Artifact(), clip); | 126 paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paint
Artifact(), clip); |
119 } | 127 } |
120 | 128 |
121 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const | 129 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |
122 { | 130 { |
123 return m_painter->paintController()->approximateUnsharedMemoryUsage(); | 131 return m_painter->paintController()->approximateUnsharedMemoryUsage(); |
124 } | 132 } |
125 | 133 |
126 } // namespace blink | 134 } // namespace blink |
OLD | NEW |