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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 max_x = std::max(max_x, max.x()); | 291 max_x = std::max(max_x, max.x()); |
292 max_y = std::max(max_y, max.y()); | 292 max_y = std::max(max_y, max.y()); |
293 } | 293 } |
294 | 294 |
295 min_pixel_cell_ = gfx::Point(min_x, min_y); | 295 min_pixel_cell_ = gfx::Point(min_x, min_y); |
296 max_pixel_cell_ = gfx::Point(max_x, max_y); | 296 max_pixel_cell_ = gfx::Point(max_x, max_y); |
297 } | 297 } |
298 | 298 |
299 int Picture::Raster( | 299 int Picture::Raster( |
300 SkCanvas* canvas, | 300 SkCanvas* canvas, |
| 301 SkDrawPictureCallback* callback, |
301 const Region& negated_content_region, | 302 const Region& negated_content_region, |
302 float contents_scale) { | 303 float contents_scale) { |
303 TRACE_EVENT_BEGIN1( | 304 TRACE_EVENT_BEGIN1( |
304 "cc", | 305 "cc", |
305 "Picture::Raster", | 306 "Picture::Raster", |
306 "data", | 307 "data", |
307 AsTraceableRasterData(contents_scale)); | 308 AsTraceableRasterData(contents_scale)); |
308 | 309 |
309 DCHECK(picture_); | 310 DCHECK(picture_); |
310 | 311 |
311 canvas->save(); | 312 canvas->save(); |
312 | 313 |
313 for (Region::Iterator it(negated_content_region); it.has_rect(); it.next()) | 314 for (Region::Iterator it(negated_content_region); it.has_rect(); it.next()) |
314 canvas->clipRect(gfx::RectToSkRect(it.rect()), SkRegion::kDifference_Op); | 315 canvas->clipRect(gfx::RectToSkRect(it.rect()), SkRegion::kDifference_Op); |
315 | 316 |
316 canvas->scale(contents_scale, contents_scale); | 317 canvas->scale(contents_scale, contents_scale); |
317 canvas->translate(layer_rect_.x(), layer_rect_.y()); | 318 canvas->translate(layer_rect_.x(), layer_rect_.y()); |
318 picture_->draw(canvas); | 319 picture_->draw(canvas, callback); |
319 SkIRect bounds; | 320 SkIRect bounds; |
320 canvas->getClipDeviceBounds(&bounds); | 321 canvas->getClipDeviceBounds(&bounds); |
321 canvas->restore(); | 322 canvas->restore(); |
322 TRACE_EVENT_END1( | 323 TRACE_EVENT_END1( |
323 "cc", "Picture::Raster", | 324 "cc", "Picture::Raster", |
324 "num_pixels_rasterized", bounds.width() * bounds.height()); | 325 "num_pixels_rasterized", bounds.width() * bounds.height()); |
325 return bounds.width() * bounds.height(); | 326 return bounds.width() * bounds.height(); |
326 } | 327 } |
327 | 328 |
328 void Picture::Replay(SkCanvas* canvas) { | 329 void Picture::Replay(SkCanvas* canvas) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 scoped_refptr<base::debug::ConvertableToTraceFormat> | 481 scoped_refptr<base::debug::ConvertableToTraceFormat> |
481 Picture::AsTraceableRecordData() const { | 482 Picture::AsTraceableRecordData() const { |
482 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); | 483 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); |
483 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); | 484 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); |
484 record_data->SetInteger("width", layer_rect_.width()); | 485 record_data->SetInteger("width", layer_rect_.width()); |
485 record_data->SetInteger("height", layer_rect_.height()); | 486 record_data->SetInteger("height", layer_rect_.height()); |
486 return TracedValue::FromValue(record_data.release()); | 487 return TracedValue::FromValue(record_data.release()); |
487 } | 488 } |
488 | 489 |
489 } // namespace cc | 490 } // namespace cc |
OLD | NEW |