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