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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 SkCanvas* canvas = picture_->beginRecording( | 191 SkCanvas* canvas = picture_->beginRecording( |
192 layer_rect_.width(), | 192 layer_rect_.width(), |
193 layer_rect_.height(), | 193 layer_rect_.height(), |
194 SkPicture::kUsePathBoundsForClip_RecordingFlag | | 194 SkPicture::kUsePathBoundsForClip_RecordingFlag | |
195 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); | 195 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
196 | 196 |
197 canvas->save(); | 197 canvas->save(); |
198 canvas->translate(SkFloatToScalar(-layer_rect_.x()), | 198 canvas->translate(SkFloatToScalar(-layer_rect_.x()), |
199 SkFloatToScalar(-layer_rect_.y())); | 199 SkFloatToScalar(-layer_rect_.y())); |
200 | 200 |
| 201 SkPaint paint; |
| 202 paint.setAntiAlias(false); |
| 203 paint.setXfermodeMode(SkXfermode::kClear_Mode); |
| 204 SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(), |
| 205 layer_rect_.y(), |
| 206 layer_rect_.width(), |
| 207 layer_rect_.height()); |
| 208 canvas->clipRect(layer_skrect); |
| 209 canvas->drawRect(layer_skrect, paint); |
| 210 |
201 gfx::RectF opaque_layer_rect; | 211 gfx::RectF opaque_layer_rect; |
202 base::TimeTicks begin_record_time; | 212 base::TimeTicks begin_record_time; |
203 if (stats) | 213 if (stats) |
204 begin_record_time = base::TimeTicks::Now(); | 214 begin_record_time = base::TimeTicks::Now(); |
205 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect); | 215 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect); |
206 if (stats) { | 216 if (stats) { |
207 stats->total_record_time += base::TimeTicks::Now() - begin_record_time; | 217 stats->total_record_time += base::TimeTicks::Now() - begin_record_time; |
208 stats->total_pixels_recorded += | 218 stats->total_pixels_recorded += |
209 layer_rect_.width() * layer_rect_.height(); | 219 layer_rect_.width() * layer_rect_.height(); |
210 } | 220 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 427 |
418 // We found a non-empty list: store it and get the first pixel ref. | 428 // We found a non-empty list: store it and get the first pixel ref. |
419 current_pixel_refs_ = &iter->second; | 429 current_pixel_refs_ = &iter->second; |
420 current_index_ = 0; | 430 current_index_ = 0; |
421 break; | 431 break; |
422 } | 432 } |
423 return *this; | 433 return *this; |
424 } | 434 } |
425 | 435 |
426 } // namespace cc | 436 } // namespace cc |
OLD | NEW |