| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/compositing/PaintChunksToCcLayer.h" | 5 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" |
| 6 | 6 |
| 7 #include "cc/paint/compositing_display_item.h" | 7 #include "cc/paint/compositing_display_item.h" |
| 8 #include "cc/paint/display_item_list.h" | 8 #include "cc/paint/display_item_list.h" |
| 9 #include "cc/paint/drawing_display_item.h" | 9 #include "cc/paint/drawing_display_item.h" |
| 10 #include "cc/paint/filter_display_item.h" | 10 #include "cc/paint/filter_display_item.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 static gfx::Rect g_large_rect(-200000, -200000, 400000, 400000); | 180 static gfx::Rect g_large_rect(-200000, -200000, 400000, 400000); |
| 181 static void AppendDisplayItemToCcDisplayItemList( | 181 static void AppendDisplayItemToCcDisplayItemList( |
| 182 const DisplayItem& display_item, | 182 const DisplayItem& display_item, |
| 183 cc::DisplayItemList* list) { | 183 cc::DisplayItemList* list) { |
| 184 DCHECK(DisplayItem::IsDrawingType(display_item.GetType())); | 184 DCHECK(DisplayItem::IsDrawingType(display_item.GetType())); |
| 185 if (DisplayItem::IsDrawingType(display_item.GetType())) { | 185 if (DisplayItem::IsDrawingType(display_item.GetType())) { |
| 186 sk_sp<const PaintRecord> record = | 186 const auto& drawing_display_item = |
| 187 static_cast<const DrawingDisplayItem&>(display_item).GetPaintRecord(); | 187 static_cast<const DrawingDisplayItem&>(display_item); |
| 188 sk_sp<const PaintRecord> record = drawing_display_item.GetPaintRecord(); |
| 188 if (!record) | 189 if (!record) |
| 189 return; | 190 return; |
| 191 SkRect record_bounds = drawing_display_item.GetPaintRecordBounds(); |
| 190 // In theory we would pass the bounds of the record, previously done as: | 192 // In theory we would pass the bounds of the record, previously done as: |
| 191 // gfx::Rect bounds = gfx::SkIRectToRect(record->cullRect().roundOut()); | 193 // gfx::Rect bounds = gfx::SkIRectToRect(record->cullRect().roundOut()); |
| 192 // or use the visual rect directly. However, clip content layers attempt | 194 // or use the visual rect directly. However, clip content layers attempt |
| 193 // to raster in a different space than that of the visual rects. We'll be | 195 // to raster in a different space than that of the visual rects. We'll be |
| 194 // reworking visual rects further for SPv2, so for now we just pass a | 196 // reworking visual rects further for SPv2, so for now we just pass a |
| 195 // visual rect large enough to make sure items raster. | 197 // visual rect large enough to make sure items raster. |
| 196 list->CreateAndAppendDrawingItem<cc::DrawingDisplayItem>(g_large_rect, | 198 list->CreateAndAppendDrawingItem<cc::DrawingDisplayItem>( |
| 197 std::move(record)); | 199 g_large_rect, std::move(record), record_bounds); |
| 198 } | 200 } |
| 199 } | 201 } |
| 200 | 202 |
| 201 } // unnamed namespace | 203 } // unnamed namespace |
| 202 | 204 |
| 203 scoped_refptr<cc::DisplayItemList> PaintChunksToCcLayer::Convert( | 205 scoped_refptr<cc::DisplayItemList> PaintChunksToCcLayer::Convert( |
| 204 const Vector<const PaintChunk*>& paint_chunks, | 206 const Vector<const PaintChunk*>& paint_chunks, |
| 205 const PropertyTreeState& layer_state, | 207 const PropertyTreeState& layer_state, |
| 206 const gfx::Vector2dF& layer_offset, | 208 const gfx::Vector2dF& layer_offset, |
| 207 const DisplayItemList& display_items) { | 209 const DisplayItemList& display_items) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 237 RecordPairedEndDisplayItems(end_display_items, cc_list.get()); | 239 RecordPairedEndDisplayItems(end_display_items, cc_list.get()); |
| 238 } | 240 } |
| 239 | 241 |
| 240 cc_list->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>(); | 242 cc_list->CreateAndAppendPairedEndItem<cc::EndTransformDisplayItem>(); |
| 241 | 243 |
| 242 cc_list->Finalize(); | 244 cc_list->Finalize(); |
| 243 return cc_list; | 245 return cc_list; |
| 244 } | 246 } |
| 245 | 247 |
| 246 } // namespace blink | 248 } // namespace blink |
| OLD | NEW |