Chromium Code Reviews| 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 "cc/paint/display_item_list.h" | 5 #include "cc/paint/display_item_list.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 case DisplayItem::END_COMPOSITING: | 95 case DisplayItem::END_COMPOSITING: |
| 96 canvas->restore(); | 96 canvas->restore(); |
| 97 break; | 97 break; |
| 98 case DisplayItem::DRAWING: { | 98 case DisplayItem::DRAWING: { |
| 99 const auto& item = static_cast<const DrawingDisplayItem&>(base_item); | 99 const auto& item = static_cast<const DrawingDisplayItem&>(base_item); |
| 100 if (canvas->quickReject(item.picture->cullRect())) | 100 if (canvas->quickReject(item.picture->cullRect())) |
| 101 break; | 101 break; |
| 102 | 102 |
| 103 // SkPicture always does a wrapping save/restore on the canvas, so it is | 103 // SkPicture always does a wrapping save/restore on the canvas, so it is |
| 104 // not necessary here. | 104 // not necessary here. |
| 105 if (callback) { | 105 item.picture->playback(canvas, callback); |
|
vmpstr
2017/03/22 21:00:11
IIRC this was there as a performance optimization,
enne (OOO)
2017/03/23 16:43:12
I think it does when the SkCanvas is recording or
| |
| 106 item.picture->playback(canvas, callback); | |
| 107 } else { | |
| 108 // TODO(enne): switch this to playback once PaintRecord is real. | |
| 109 canvas->drawPicture(ToSkPicture(item.picture.get())); | |
| 110 } | |
| 111 break; | 106 break; |
| 112 } | 107 } |
| 113 case DisplayItem::FLOAT_CLIP: { | 108 case DisplayItem::FLOAT_CLIP: { |
| 114 const auto& item = static_cast<const FloatClipDisplayItem&>(base_item); | 109 const auto& item = static_cast<const FloatClipDisplayItem&>(base_item); |
| 115 canvas->save(); | 110 canvas->save(); |
| 116 canvas->clipRect(gfx::RectFToSkRect(item.clip_rect)); | 111 canvas->clipRect(gfx::RectFToSkRect(item.clip_rect)); |
| 117 break; | 112 break; |
| 118 } | 113 } |
| 119 case DisplayItem::END_FLOAT_CLIP: | 114 case DisplayItem::END_FLOAT_CLIP: |
| 120 canvas->restore(); | 115 canvas->restore(); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 state->EndArray(); | 395 state->EndArray(); |
| 401 | 396 |
| 402 state->BeginArray("cullRect"); | 397 state->BeginArray("cullRect"); |
| 403 state->AppendInteger(item.picture->cullRect().x()); | 398 state->AppendInteger(item.picture->cullRect().x()); |
| 404 state->AppendInteger(item.picture->cullRect().y()); | 399 state->AppendInteger(item.picture->cullRect().y()); |
| 405 state->AppendInteger(item.picture->cullRect().width()); | 400 state->AppendInteger(item.picture->cullRect().width()); |
| 406 state->AppendInteger(item.picture->cullRect().height()); | 401 state->AppendInteger(item.picture->cullRect().height()); |
| 407 state->EndArray(); | 402 state->EndArray(); |
| 408 | 403 |
| 409 std::string b64_picture; | 404 std::string b64_picture; |
| 410 PictureDebugUtil::SerializeAsBase64(ToSkPicture(item.picture.get()), | 405 PictureDebugUtil::SerializeAsBase64(ToSkPicture(item.picture).get(), |
| 411 &b64_picture); | 406 &b64_picture); |
| 412 state->SetString("skp64", b64_picture); | 407 state->SetString("skp64", b64_picture); |
| 413 state->EndDictionary(); | 408 state->EndDictionary(); |
| 414 break; | 409 break; |
| 415 } | 410 } |
| 416 case DisplayItem::FILTER: { | 411 case DisplayItem::FILTER: { |
| 417 const auto& item = static_cast<const FilterDisplayItem&>(base_item); | 412 const auto& item = static_cast<const FilterDisplayItem&>(base_item); |
| 418 state->AppendString(base::StringPrintf( | 413 state->AppendString(base::StringPrintf( |
| 419 "FilterDisplayItem bounds: [%s] visualRect: [%s]", | 414 "FilterDisplayItem bounds: [%s] visualRect: [%s]", |
| 420 item.bounds.ToString().c_str(), visual_rect.ToString().c_str())); | 415 item.bounds.ToString().c_str(), visual_rect.ToString().c_str())); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 float contents_scale, | 490 float contents_scale, |
| 496 std::vector<DrawImage>* images) { | 491 std::vector<DrawImage>* images) { |
| 497 image_map_.GetDiscardableImagesInRect(rect, contents_scale, images); | 492 image_map_.GetDiscardableImagesInRect(rect, contents_scale, images); |
| 498 } | 493 } |
| 499 | 494 |
| 500 gfx::Rect DisplayItemList::GetRectForImage(ImageId image_id) const { | 495 gfx::Rect DisplayItemList::GetRectForImage(ImageId image_id) const { |
| 501 return image_map_.GetRectForImage(image_id); | 496 return image_map_.GetRectForImage(image_id); |
| 502 } | 497 } |
| 503 | 498 |
| 504 } // namespace cc | 499 } // namespace cc |
| OLD | NEW |