Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: cc/playback/drawing_display_item.cc

Issue 1835843002: WIP: Fix foreignObject cullrect Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/playback/drawing_display_item.h ('k') | cc/playback/filter_display_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/playback/drawing_display_item.h" 5 #include "cc/playback/drawing_display_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 picture_->serialize(&stream, 71 picture_->serialize(&stream,
72 image_serialization_processor->GetPixelSerializer()); 72 image_serialization_processor->GetPixelSerializer());
73 if (stream.bytesWritten() > 0) { 73 if (stream.bytesWritten() > 0) {
74 SkAutoDataUnref data(stream.copyToData()); 74 SkAutoDataUnref data(stream.copyToData());
75 details->set_picture(data->data(), data->size()); 75 details->set_picture(data->data(), data->size());
76 } 76 }
77 } 77 }
78 } 78 }
79 79
80 void DrawingDisplayItem::Raster(SkCanvas* canvas, 80 void DrawingDisplayItem::Raster(SkCanvas* canvas,
81 const gfx::Rect& canvas_target_playback_rect,
82 SkPicture::AbortCallback* callback) const { 81 SkPicture::AbortCallback* callback) const {
83 // The canvas_playback_rect can be empty to signify no culling is desired.
84 if (!canvas_target_playback_rect.IsEmpty()) {
85 const SkMatrix& matrix = canvas->getTotalMatrix();
86 const SkRect& cull_rect = picture_->cullRect();
87 SkRect target_rect;
88 matrix.mapRect(&target_rect, cull_rect);
89 if (!target_rect.intersect(gfx::RectToSkRect(canvas_target_playback_rect)))
90 return;
91 }
92
93 // SkPicture always does a wrapping save/restore on the canvas, so it is not 82 // SkPicture always does a wrapping save/restore on the canvas, so it is not
94 // necessary here. 83 // necessary here.
95 if (callback) 84 if (callback)
96 picture_->playback(canvas, callback); 85 picture_->playback(canvas, callback);
97 else 86 else
98 canvas->drawPicture(picture_.get()); 87 canvas->drawPicture(picture_.get());
99 } 88 }
100 89
101 void DrawingDisplayItem::AsValueInto( 90 void DrawingDisplayItem::AsValueInto(
102 const gfx::Rect& visual_rect, 91 const gfx::Rect& visual_rect,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 123
135 int DrawingDisplayItem::ApproximateOpCount() const { 124 int DrawingDisplayItem::ApproximateOpCount() const {
136 return picture_->approximateOpCount(); 125 return picture_->approximateOpCount();
137 } 126 }
138 127
139 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const { 128 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const {
140 return picture_->suitableForGpuRasterization(NULL); 129 return picture_->suitableForGpuRasterization(NULL);
141 } 130 }
142 131
143 } // namespace cc 132 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/drawing_display_item.h ('k') | cc/playback/filter_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698