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

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

Issue 2075873002: Support general raster matrix for RasterSource and DisplayItemList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a bug in PrepareForPlaybackToCanvas and fix cc_unittests Created 4 years, 6 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 picture_->serialize(&stream, 75 picture_->serialize(&stream,
76 image_serialization_processor->GetPixelSerializer()); 76 image_serialization_processor->GetPixelSerializer());
77 if (stream.bytesWritten() > 0) { 77 if (stream.bytesWritten() > 0) {
78 SkAutoDataUnref data(stream.copyToData()); 78 SkAutoDataUnref data(stream.copyToData());
79 details->set_picture(data->data(), data->size()); 79 details->set_picture(data->data(), data->size());
80 } 80 }
81 } 81 }
82 } 82 }
83 83
84 void DrawingDisplayItem::Raster(SkCanvas* canvas, 84 void DrawingDisplayItem::Raster(SkCanvas* canvas,
85 const gfx::Rect& canvas_target_playback_rect,
86 SkPicture::AbortCallback* callback) const { 85 SkPicture::AbortCallback* callback) const {
87 // The canvas_playback_rect can be empty to signify no culling is desired. 86 if (canvas->quickReject(picture_->cullRect()))
88 if (!canvas_target_playback_rect.IsEmpty()) { 87 return;
89 const SkMatrix& matrix = canvas->getTotalMatrix();
90 const SkRect& cull_rect = picture_->cullRect();
91 SkRect target_rect;
92 matrix.mapRect(&target_rect, cull_rect);
93 if (!target_rect.intersect(gfx::RectToSkRect(canvas_target_playback_rect)))
94 return;
95 }
96 88
97 // SkPicture always does a wrapping save/restore on the canvas, so it is not 89 // SkPicture always does a wrapping save/restore on the canvas, so it is not
98 // necessary here. 90 // necessary here.
99 if (callback) 91 if (callback)
100 picture_->playback(canvas, callback); 92 picture_->playback(canvas, callback);
101 else 93 else
102 canvas->drawPicture(picture_.get()); 94 canvas->drawPicture(picture_.get());
103 } 95 }
104 96
105 void DrawingDisplayItem::AsValueInto( 97 void DrawingDisplayItem::AsValueInto(
(...skipping 28 matching lines...) Expand all
134 126
135 size_t DrawingDisplayItem::ExternalMemoryUsage() const { 127 size_t DrawingDisplayItem::ExternalMemoryUsage() const {
136 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); 128 return SkPictureUtils::ApproximateBytesUsed(picture_.get());
137 } 129 }
138 130
139 int DrawingDisplayItem::ApproximateOpCount() const { 131 int DrawingDisplayItem::ApproximateOpCount() const {
140 return picture_->approximateOpCount(); 132 return picture_->approximateOpCount();
141 } 133 }
142 134
143 } // namespace cc 135 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698