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