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

Side by Side Diff: cc/resources/picture_pile_impl.cc

Issue 1008373002: cc: Remove is_analysis parameter in RasterCommon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/resources/picture_pile_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 #include <set> 7 #include <set>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/base/region.h" 10 #include "cc/base/region.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 should_attempt_to_use_distance_field_text_( 73 should_attempt_to_use_distance_field_text_(
74 other->should_attempt_to_use_distance_field_text_) { 74 other->should_attempt_to_use_distance_field_text_) {
75 } 75 }
76 76
77 PicturePileImpl::~PicturePileImpl() { 77 PicturePileImpl::~PicturePileImpl() {
78 } 78 }
79 79
80 void PicturePileImpl::PlaybackToSharedCanvas(SkCanvas* canvas, 80 void PicturePileImpl::PlaybackToSharedCanvas(SkCanvas* canvas,
81 const gfx::Rect& canvas_rect, 81 const gfx::Rect& canvas_rect,
82 float contents_scale) const { 82 float contents_scale) const {
83 RasterCommon(canvas, 83 RasterCommon(canvas, NULL, canvas_rect, contents_scale);
84 NULL,
85 canvas_rect,
86 contents_scale,
87 false);
88 } 84 }
89 85
90 void PicturePileImpl::RasterForAnalysis(skia::AnalysisCanvas* canvas, 86 void PicturePileImpl::RasterForAnalysis(skia::AnalysisCanvas* canvas,
91 const gfx::Rect& canvas_rect, 87 const gfx::Rect& canvas_rect,
92 float contents_scale) const { 88 float contents_scale) const {
93 RasterCommon(canvas, canvas, canvas_rect, contents_scale, true); 89 RasterCommon(canvas, canvas, canvas_rect, contents_scale);
94 } 90 }
95 91
96 void PicturePileImpl::PlaybackToCanvas(SkCanvas* canvas, 92 void PicturePileImpl::PlaybackToCanvas(SkCanvas* canvas,
97 const gfx::Rect& canvas_rect, 93 const gfx::Rect& canvas_rect,
98 float contents_scale) const { 94 float contents_scale) const {
99 RasterSourceHelper::PrepareForPlaybackToCanvas( 95 RasterSourceHelper::PrepareForPlaybackToCanvas(
100 canvas, canvas_rect, gfx::Rect(tiling_.tiling_size()), contents_scale, 96 canvas, canvas_rect, gfx::Rect(tiling_.tiling_size()), contents_scale,
101 background_color_, clear_canvas_with_debug_color_, requires_clear_); 97 background_color_, clear_canvas_with_debug_color_, requires_clear_);
102 RasterCommon(canvas, 98 RasterCommon(canvas, NULL, canvas_rect, contents_scale);
103 NULL,
104 canvas_rect,
105 contents_scale,
106 false);
107 } 99 }
108 100
109 void PicturePileImpl::CoalesceRasters(const gfx::Rect& canvas_rect, 101 void PicturePileImpl::CoalesceRasters(const gfx::Rect& canvas_rect,
110 const gfx::Rect& content_rect, 102 const gfx::Rect& content_rect,
111 float contents_scale, 103 float contents_scale,
112 PictureRegionMap* results) const { 104 PictureRegionMap* results) const {
113 DCHECK(results); 105 DCHECK(results);
114 // Rasterize the collection of relevant picture piles. 106 // Rasterize the collection of relevant picture piles.
115 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect( 107 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect(
116 content_rect, 1.f / contents_scale); 108 content_rect, 1.f / contents_scale);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 clip_region = &it->second; 186 clip_region = &it->second;
195 } 187 }
196 188
197 DCHECK(clip_region->Contains(content_clip)) 189 DCHECK(clip_region->Contains(content_clip))
198 << "Content clips should not overlap."; 190 << "Content clips should not overlap.";
199 clip_region->Subtract(content_clip); 191 clip_region->Subtract(content_clip);
200 last_content_rect = content_clip; 192 last_content_rect = content_clip;
201 } 193 }
202 } 194 }
203 195
204 void PicturePileImpl::RasterCommon( 196 void PicturePileImpl::RasterCommon(SkCanvas* canvas,
205 SkCanvas* canvas, 197 SkDrawPictureCallback* callback,
206 SkDrawPictureCallback* callback, 198 const gfx::Rect& canvas_rect,
207 const gfx::Rect& canvas_rect, 199 float contents_scale) const {
208 float contents_scale,
209 bool is_analysis) const {
210 DCHECK(contents_scale >= min_contents_scale_); 200 DCHECK(contents_scale >= min_contents_scale_);
211 201
212 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); 202 canvas->translate(-canvas_rect.x(), -canvas_rect.y());
213 gfx::Rect content_tiling_rect = gfx::ToEnclosingRect( 203 gfx::Rect content_tiling_rect = gfx::ToEnclosingRect(
214 gfx::ScaleRect(gfx::Rect(tiling_.tiling_size()), contents_scale)); 204 gfx::ScaleRect(gfx::Rect(tiling_.tiling_size()), contents_scale));
215 content_tiling_rect.Intersect(canvas_rect); 205 content_tiling_rect.Intersect(canvas_rect);
216 206
217 canvas->clipRect(gfx::RectToSkRect(content_tiling_rect), 207 canvas->clipRect(gfx::RectToSkRect(content_tiling_rect),
218 SkRegion::kIntersect_Op); 208 SkRegion::kIntersect_Op);
219 209
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 for (const auto& map_pair : picture_map_) { 456 for (const auto& map_pair : picture_map_) {
467 const Picture* picture = map_pair.second.GetPicture(); 457 const Picture* picture = map_pair.second.GetPicture();
468 if (picture && (processed_pictures.count(picture) == 0)) { 458 if (picture && (processed_pictures.count(picture) == 0)) {
469 picture->EmitTraceSnapshot(); 459 picture->EmitTraceSnapshot();
470 processed_pictures.insert(picture); 460 processed_pictures.insert(picture);
471 } 461 }
472 } 462 }
473 } 463 }
474 464
475 } // namespace cc 465 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698