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/resources/display_list_raster_source.h" | 5 #include "cc/resources/display_list_raster_source.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "cc/base/region.h" | 8 #include "cc/base/region.h" |
9 #include "cc/debug/debug_colors.h" | 9 #include "cc/debug/debug_colors.h" |
10 #include "cc/resources/display_item_list.h" | 10 #include "cc/resources/display_item_list.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 other->should_attempt_to_use_distance_field_text_) { | 80 other->should_attempt_to_use_distance_field_text_) { |
81 } | 81 } |
82 | 82 |
83 DisplayListRasterSource::~DisplayListRasterSource() { | 83 DisplayListRasterSource::~DisplayListRasterSource() { |
84 } | 84 } |
85 | 85 |
86 void DisplayListRasterSource::PlaybackToSharedCanvas( | 86 void DisplayListRasterSource::PlaybackToSharedCanvas( |
87 SkCanvas* canvas, | 87 SkCanvas* canvas, |
88 const gfx::Rect& canvas_rect, | 88 const gfx::Rect& canvas_rect, |
89 float contents_scale) const { | 89 float contents_scale) const { |
90 RasterCommon(canvas, NULL, canvas_rect, contents_scale, false); | 90 RasterCommon(canvas, NULL, canvas_rect, contents_scale); |
91 } | 91 } |
92 | 92 |
93 void DisplayListRasterSource::RasterForAnalysis(skia::AnalysisCanvas* canvas, | 93 void DisplayListRasterSource::RasterForAnalysis(skia::AnalysisCanvas* canvas, |
94 const gfx::Rect& canvas_rect, | 94 const gfx::Rect& canvas_rect, |
95 float contents_scale) const { | 95 float contents_scale) const { |
96 RasterCommon(canvas, canvas, canvas_rect, contents_scale, true); | 96 RasterCommon(canvas, canvas, canvas_rect, contents_scale); |
97 } | 97 } |
98 | 98 |
99 void DisplayListRasterSource::PlaybackToCanvas(SkCanvas* canvas, | 99 void DisplayListRasterSource::PlaybackToCanvas(SkCanvas* canvas, |
100 const gfx::Rect& canvas_rect, | 100 const gfx::Rect& canvas_rect, |
101 float contents_scale) const { | 101 float contents_scale) const { |
102 RasterSourceHelper::PrepareForPlaybackToCanvas( | 102 RasterSourceHelper::PrepareForPlaybackToCanvas( |
103 canvas, canvas_rect, gfx::Rect(size_), contents_scale, background_color_, | 103 canvas, canvas_rect, gfx::Rect(size_), contents_scale, background_color_, |
104 clear_canvas_with_debug_color_, requires_clear_); | 104 clear_canvas_with_debug_color_, requires_clear_); |
105 | 105 |
106 RasterCommon(canvas, NULL, canvas_rect, contents_scale, false); | 106 RasterCommon(canvas, NULL, canvas_rect, contents_scale); |
107 } | 107 } |
108 | 108 |
109 void DisplayListRasterSource::RasterCommon(SkCanvas* canvas, | 109 void DisplayListRasterSource::RasterCommon(SkCanvas* canvas, |
110 SkDrawPictureCallback* callback, | 110 SkDrawPictureCallback* callback, |
111 const gfx::Rect& canvas_rect, | 111 const gfx::Rect& canvas_rect, |
112 float contents_scale, | 112 float contents_scale) const { |
113 bool is_analysis) const { | |
114 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); | 113 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); |
115 gfx::Rect content_rect = | 114 gfx::Rect content_rect = |
116 gfx::ToEnclosingRect(gfx::ScaleRect(gfx::Rect(size_), contents_scale)); | 115 gfx::ToEnclosingRect(gfx::ScaleRect(gfx::Rect(size_), contents_scale)); |
117 content_rect.Intersect(canvas_rect); | 116 content_rect.Intersect(canvas_rect); |
118 | 117 |
119 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); | 118 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); |
120 | 119 |
121 DCHECK(display_list_.get()); | 120 DCHECK(display_list_.get()); |
122 display_list_->Raster(canvas, callback, contents_scale); | 121 display_list_->Raster(canvas, callback, contents_scale); |
123 } | 122 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 214 } |
216 | 215 |
217 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() | 216 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() |
218 const { | 217 const { |
219 bool can_use_lcd_text = false; | 218 bool can_use_lcd_text = false; |
220 return scoped_refptr<RasterSource>( | 219 return scoped_refptr<RasterSource>( |
221 new DisplayListRasterSource(this, can_use_lcd_text)); | 220 new DisplayListRasterSource(this, can_use_lcd_text)); |
222 } | 221 } |
223 | 222 |
224 } // namespace cc | 223 } // namespace cc |
OLD | NEW |