OLD | NEW |
---|---|
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 "cc/resources/picture.h" | 5 #include "cc/resources/picture.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 SkCanvas* canvas = picture_->beginRecording( | 160 SkCanvas* canvas = picture_->beginRecording( |
161 layer_rect_.width(), | 161 layer_rect_.width(), |
162 layer_rect_.height(), | 162 layer_rect_.height(), |
163 SkPicture::kUsePathBoundsForClip_RecordingFlag | | 163 SkPicture::kUsePathBoundsForClip_RecordingFlag | |
164 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); | 164 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
165 | 165 |
166 canvas->save(); | 166 canvas->save(); |
167 canvas->translate(SkFloatToScalar(-layer_rect_.x()), | 167 canvas->translate(SkFloatToScalar(-layer_rect_.x()), |
168 SkFloatToScalar(-layer_rect_.y())); | 168 SkFloatToScalar(-layer_rect_.y())); |
169 | 169 |
170 SkPaint paint; | 170 canvas->clipRect(RectToSkRect(layer_rect_)); |
Tom Hudson
2013/04/30 09:43:59
Is this clip actually necessary, since we've creat
vmpstr
2013/04/30 17:06:23
I had it there initially, since I wasn't sure. But
| |
171 paint.setAntiAlias(false); | |
172 paint.setXfermodeMode(SkXfermode::kClear_Mode); | |
173 SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(), | |
174 layer_rect_.y(), | |
175 layer_rect_.width(), | |
176 layer_rect_.height()); | |
177 canvas->clipRect(layer_skrect); | |
178 canvas->drawRect(layer_skrect, paint); | |
179 | 171 |
180 gfx::RectF opaque_layer_rect; | 172 gfx::RectF opaque_layer_rect; |
181 base::TimeTicks begin_record_time; | 173 base::TimeTicks begin_record_time; |
182 if (stats) | 174 if (stats) |
183 begin_record_time = base::TimeTicks::Now(); | 175 begin_record_time = base::TimeTicks::Now(); |
184 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect); | 176 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect); |
185 if (stats) { | 177 if (stats) { |
186 stats->total_record_time += base::TimeTicks::Now() - begin_record_time; | 178 stats->total_record_time += base::TimeTicks::Now() - begin_record_time; |
187 stats->total_pixels_recorded += | 179 stats->total_pixels_recorded += |
188 layer_rect_.width() * layer_rect_.height(); | 180 layer_rect_.width() * layer_rect_.height(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
413 | 405 |
414 // We found a non-empty list: store it and get the first pixel ref. | 406 // We found a non-empty list: store it and get the first pixel ref. |
415 current_pixel_refs_ = &iter->second; | 407 current_pixel_refs_ = &iter->second; |
416 current_index_ = 0; | 408 current_index_ = 0; |
417 break; | 409 break; |
418 } | 410 } |
419 return *this; | 411 return *this; |
420 } | 412 } |
421 | 413 |
422 } // namespace cc | 414 } // namespace cc |
OLD | NEW |