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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 canvas->saveLayer(bounds, &paint); | 91 canvas->saveLayer(bounds, &paint); |
92 else | 92 else |
93 canvas->saveLayerPreserveLCDTextRequests(bounds, &paint); | 93 canvas->saveLayerPreserveLCDTextRequests(bounds, &paint); |
94 break; | 94 break; |
95 } | 95 } |
96 case DisplayItem::END_COMPOSITING: | 96 case DisplayItem::END_COMPOSITING: |
97 canvas->restore(); | 97 canvas->restore(); |
98 break; | 98 break; |
99 case DisplayItem::DRAWING: { | 99 case DisplayItem::DRAWING: { |
100 const auto& item = static_cast<const DrawingDisplayItem&>(base_item); | 100 const auto& item = static_cast<const DrawingDisplayItem&>(base_item); |
101 if (canvas->quickReject(item.picture->cullRect())) | 101 if (canvas->quickReject(item.bounds)) |
102 break; | 102 break; |
103 | 103 |
104 // TODO(enne): Maybe the PaintRecord itself could know whether this | 104 // TODO(enne): Maybe the PaintRecord itself could know whether this |
105 // was needed? It's not clear whether these save/restore semantics | 105 // was needed? It's not clear whether these save/restore semantics |
106 // that SkPicture handles during playback are things that should be | 106 // that SkPicture handles during playback are things that should be |
107 // kept around. | 107 // kept around. |
108 canvas->save(); | 108 canvas->save(); |
109 item.picture->playback(canvas, callback); | 109 item.picture->playback(canvas, callback); |
110 canvas->restore(); | 110 canvas->restore(); |
111 break; | 111 break; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 state->SetString("name", "DrawingDisplayItem"); | 420 state->SetString("name", "DrawingDisplayItem"); |
421 | 421 |
422 state->BeginArray("visualRect"); | 422 state->BeginArray("visualRect"); |
423 state->AppendInteger(visual_rect.x()); | 423 state->AppendInteger(visual_rect.x()); |
424 state->AppendInteger(visual_rect.y()); | 424 state->AppendInteger(visual_rect.y()); |
425 state->AppendInteger(visual_rect.width()); | 425 state->AppendInteger(visual_rect.width()); |
426 state->AppendInteger(visual_rect.height()); | 426 state->AppendInteger(visual_rect.height()); |
427 state->EndArray(); | 427 state->EndArray(); |
428 | 428 |
429 state->BeginArray("cullRect"); | 429 state->BeginArray("cullRect"); |
430 state->AppendInteger(item.picture->cullRect().x()); | 430 state->AppendInteger(item.bounds.x()); |
431 state->AppendInteger(item.picture->cullRect().y()); | 431 state->AppendInteger(item.bounds.y()); |
432 state->AppendInteger(item.picture->cullRect().width()); | 432 state->AppendInteger(item.bounds.width()); |
433 state->AppendInteger(item.picture->cullRect().height()); | 433 state->AppendInteger(item.bounds.height()); |
434 state->EndArray(); | 434 state->EndArray(); |
435 | 435 |
436 std::string b64_picture; | 436 std::string b64_picture; |
437 PictureDebugUtil::SerializeAsBase64(ToSkPicture(item.picture).get(), | 437 PictureDebugUtil::SerializeAsBase64( |
438 &b64_picture); | 438 ToSkPicture(item.picture, item.bounds).get(), &b64_picture); |
439 state->SetString("skp64", b64_picture); | 439 state->SetString("skp64", b64_picture); |
440 state->EndDictionary(); | 440 state->EndDictionary(); |
441 break; | 441 break; |
442 } | 442 } |
443 case DisplayItem::FILTER: { | 443 case DisplayItem::FILTER: { |
444 const auto& item = static_cast<const FilterDisplayItem&>(base_item); | 444 const auto& item = static_cast<const FilterDisplayItem&>(base_item); |
445 state->AppendString(base::StringPrintf( | 445 state->AppendString(base::StringPrintf( |
446 "FilterDisplayItem bounds: [%s] visualRect: [%s]", | 446 "FilterDisplayItem bounds: [%s] visualRect: [%s]", |
447 item.bounds.ToString().c_str(), visual_rect.ToString().c_str())); | 447 item.bounds.ToString().c_str(), visual_rect.ToString().c_str())); |
448 break; | 448 break; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 std::vector<DrawImage>* images) { | 539 std::vector<DrawImage>* images) { |
540 image_map_.GetDiscardableImagesInRect(rect, contents_scale, | 540 image_map_.GetDiscardableImagesInRect(rect, contents_scale, |
541 target_color_space, images); | 541 target_color_space, images); |
542 } | 542 } |
543 | 543 |
544 gfx::Rect DisplayItemList::GetRectForImage(PaintImage::Id image_id) const { | 544 gfx::Rect DisplayItemList::GetRectForImage(PaintImage::Id image_id) const { |
545 return image_map_.GetRectForImage(image_id); | 545 return image_map_.GetRectForImage(image_id); |
546 } | 546 } |
547 | 547 |
548 } // namespace cc | 548 } // namespace cc |
OLD | NEW |