| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 min_y = std::min(min_y, min.y()); | 280 min_y = std::min(min_y, min.y()); |
| 281 max_x = std::max(max_x, max.x()); | 281 max_x = std::max(max_x, max.x()); |
| 282 max_y = std::max(max_y, max.y()); | 282 max_y = std::max(max_y, max.y()); |
| 283 } | 283 } |
| 284 | 284 |
| 285 min_pixel_cell_ = gfx::Point(min_x, min_y); | 285 min_pixel_cell_ = gfx::Point(min_x, min_y); |
| 286 max_pixel_cell_ = gfx::Point(max_x, max_y); | 286 max_pixel_cell_ = gfx::Point(max_x, max_y); |
| 287 } | 287 } |
| 288 | 288 |
| 289 int Picture::Raster(SkCanvas* canvas, | 289 int Picture::Raster(SkCanvas* canvas, |
| 290 SkDrawPictureCallback* callback, | 290 SkPicture::AbortCallback* callback, |
| 291 const Region& negated_content_region, | 291 const Region& negated_content_region, |
| 292 float contents_scale) const { | 292 float contents_scale) const { |
| 293 TRACE_EVENT_BEGIN1( | 293 TRACE_EVENT_BEGIN1( |
| 294 "cc", | 294 "cc", |
| 295 "Picture::Raster", | 295 "Picture::Raster", |
| 296 "data", | 296 "data", |
| 297 AsTraceableRasterData(contents_scale)); | 297 AsTraceableRasterData(contents_scale)); |
| 298 | 298 |
| 299 DCHECK(picture_); | 299 DCHECK(picture_); |
| 300 | 300 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 316 } | 316 } |
| 317 SkIRect bounds; | 317 SkIRect bounds; |
| 318 canvas->getClipDeviceBounds(&bounds); | 318 canvas->getClipDeviceBounds(&bounds); |
| 319 canvas->restore(); | 319 canvas->restore(); |
| 320 TRACE_EVENT_END1( | 320 TRACE_EVENT_END1( |
| 321 "cc", "Picture::Raster", | 321 "cc", "Picture::Raster", |
| 322 "num_pixels_rasterized", bounds.width() * bounds.height()); | 322 "num_pixels_rasterized", bounds.width() * bounds.height()); |
| 323 return bounds.width() * bounds.height(); | 323 return bounds.width() * bounds.height(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 void Picture::Replay(SkCanvas* canvas) { | 326 void Picture::Replay(SkCanvas* canvas, SkPicture::AbortCallback* callback) { |
| 327 TRACE_EVENT_BEGIN0("cc", "Picture::Replay"); | 327 TRACE_EVENT_BEGIN0("cc", "Picture::Replay"); |
| 328 DCHECK(picture_); | 328 DCHECK(picture_); |
| 329 picture_->playback(canvas); | 329 picture_->playback(canvas, callback); |
| 330 SkIRect bounds; | 330 SkIRect bounds; |
| 331 canvas->getClipDeviceBounds(&bounds); | 331 canvas->getClipDeviceBounds(&bounds); |
| 332 TRACE_EVENT_END1("cc", "Picture::Replay", | 332 TRACE_EVENT_END1("cc", "Picture::Replay", |
| 333 "num_pixels_replayed", bounds.width() * bounds.height()); | 333 "num_pixels_replayed", bounds.width() * bounds.height()); |
| 334 } | 334 } |
| 335 | 335 |
| 336 scoped_ptr<base::Value> Picture::AsValue() const { | 336 scoped_ptr<base::Value> Picture::AsValue() const { |
| 337 // Encode the picture as base64. | 337 // Encode the picture as base64. |
| 338 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); | 338 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
| 339 res->Set("params.layer_rect", MathUtil::AsValue(layer_rect_).release()); | 339 res->Set("params.layer_rect", MathUtil::AsValue(layer_rect_).release()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 473 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 474 Picture::AsTraceableRecordData() const { | 474 Picture::AsTraceableRecordData() const { |
| 475 scoped_refptr<base::trace_event::TracedValue> record_data = | 475 scoped_refptr<base::trace_event::TracedValue> record_data = |
| 476 new base::trace_event::TracedValue(); | 476 new base::trace_event::TracedValue(); |
| 477 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); | 477 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); |
| 478 MathUtil::AddToTracedValue("layer_rect", layer_rect_, record_data.get()); | 478 MathUtil::AddToTracedValue("layer_rect", layer_rect_, record_data.get()); |
| 479 return record_data; | 479 return record_data; |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace cc | 482 } // namespace cc |
| OLD | NEW |