| 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED; | 206 painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED; |
| 207 break; | 207 break; |
| 208 default: | 208 default: |
| 209 NOTREACHED(); | 209 NOTREACHED(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 canvas->save(); | 212 canvas->save(); |
| 213 canvas->translate(SkFloatToScalar(-layer_rect_.x()), | 213 canvas->translate(SkFloatToScalar(-layer_rect_.x()), |
| 214 SkFloatToScalar(-layer_rect_.y())); | 214 SkFloatToScalar(-layer_rect_.y())); |
| 215 | 215 |
| 216 SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(), | 216 canvas->clipRect(gfx::RectToSkRect(layer_rect_)); |
| 217 layer_rect_.y(), | |
| 218 layer_rect_.width(), | |
| 219 layer_rect_.height()); | |
| 220 canvas->clipRect(layer_skrect); | |
| 221 | 217 |
| 222 painter->PaintContents(canvas.get(), layer_rect_, painting_control); | 218 painter->PaintContents(canvas.get(), layer_rect_, painting_control); |
| 223 | 219 |
| 224 canvas->restore(); | 220 canvas->restore(); |
| 225 picture_ = skia::AdoptRef(recorder.endRecording()); | 221 picture_ = skia::AdoptRef(recorder.endRecording()); |
| 226 DCHECK(picture_); | 222 DCHECK(picture_); |
| 227 | 223 |
| 228 EmitTraceSnapshot(); | 224 EmitTraceSnapshot(); |
| 229 } | 225 } |
| 230 | 226 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 329 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 334 Picture::AsTraceableRecordData() const { | 330 Picture::AsTraceableRecordData() const { |
| 335 scoped_refptr<base::trace_event::TracedValue> record_data = | 331 scoped_refptr<base::trace_event::TracedValue> record_data = |
| 336 new base::trace_event::TracedValue(); | 332 new base::trace_event::TracedValue(); |
| 337 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); | 333 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); |
| 338 MathUtil::AddToTracedValue("layer_rect", layer_rect_, record_data.get()); | 334 MathUtil::AddToTracedValue("layer_rect", layer_rect_, record_data.get()); |
| 339 return record_data; | 335 return record_data; |
| 340 } | 336 } |
| 341 | 337 |
| 342 } // namespace cc | 338 } // namespace cc |
| OLD | NEW |