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_recording_source.h" | 5 #include "cc/resources/display_list_recording_source.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 void DisplayListRecordingSource::DetermineIfSolidColor() { | 137 void DisplayListRecordingSource::DetermineIfSolidColor() { |
138 DCHECK(display_list_.get()); | 138 DCHECK(display_list_.get()); |
139 is_solid_color_ = false; | 139 is_solid_color_ = false; |
140 solid_color_ = SK_ColorTRANSPARENT; | 140 solid_color_ = SK_ColorTRANSPARENT; |
141 | 141 |
142 if (display_list_->ApproximateOpCount() > kOpCountThatIsOkToAnalyze) | 142 if (display_list_->ApproximateOpCount() > kOpCountThatIsOkToAnalyze) |
143 return; | 143 return; |
144 | 144 |
145 skia::AnalysisCanvas canvas(recorded_viewport_.width(), | 145 gfx::Size layer_size = GetSize(); |
146 recorded_viewport_.height()); | 146 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); |
147 canvas.translate(-recorded_viewport_.x(), -recorded_viewport_.y()); | |
148 display_list_->Raster(&canvas, nullptr, 1.f); | 147 display_list_->Raster(&canvas, nullptr, 1.f); |
149 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 148 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
150 } | 149 } |
151 | 150 |
152 void DisplayListRecordingSource::Clear() { | 151 void DisplayListRecordingSource::Clear() { |
153 recorded_viewport_ = gfx::Rect(); | 152 recorded_viewport_ = gfx::Rect(); |
154 display_list_ = NULL; | 153 display_list_ = NULL; |
155 is_solid_color_ = false; | 154 is_solid_color_ = false; |
156 } | 155 } |
157 | 156 |
158 } // namespace cc | 157 } // namespace cc |
OLD | NEW |