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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 canvas->scale(contents_scale, contents_scale); | 311 canvas->scale(contents_scale, contents_scale); |
312 canvas->translate(layer_rect_.x(), layer_rect_.y()); | 312 canvas->translate(layer_rect_.x(), layer_rect_.y()); |
313 picture_->draw(canvas, callback); | 313 picture_->draw(canvas, callback); |
314 SkIRect bounds; | 314 SkIRect bounds; |
315 canvas->getClipDeviceBounds(&bounds); | 315 canvas->getClipDeviceBounds(&bounds); |
316 canvas->restore(); | 316 canvas->restore(); |
317 TRACE_EVENT_END1("cc", "Picture::Raster", | 317 TRACE_EVENT_END1("cc", "Picture::Raster", |
318 "num_pixels_rasterized", bounds.width() * bounds.height()); | 318 "num_pixels_rasterized", bounds.width() * bounds.height()); |
319 } | 319 } |
320 | 320 |
321 scoped_ptr<Value> Picture::AsValue() const { | 321 scoped_ptr<base::Value> Picture::AsValue() const { |
322 SkDynamicMemoryWStream stream; | 322 SkDynamicMemoryWStream stream; |
323 | 323 |
324 // Serialize the picture. | 324 // Serialize the picture. |
325 picture_->serialize(&stream, &EncodeBitmap); | 325 picture_->serialize(&stream, &EncodeBitmap); |
326 | 326 |
327 // Encode the picture as base64. | 327 // Encode the picture as base64. |
328 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); | 328 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
329 res->Set("params.layer_rect", MathUtil::AsValue(layer_rect_).release()); | 329 res->Set("params.layer_rect", MathUtil::AsValue(layer_rect_).release()); |
330 res->Set("params.opaque_rect", MathUtil::AsValue(opaque_rect_).release()); | 330 res->Set("params.opaque_rect", MathUtil::AsValue(opaque_rect_).release()); |
331 | 331 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 raster_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); | 448 raster_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); |
449 raster_data->SetDouble("scale", scale); | 449 raster_data->SetDouble("scale", scale); |
450 raster_data->SetDouble("rect_x", rect.x()); | 450 raster_data->SetDouble("rect_x", rect.x()); |
451 raster_data->SetDouble("rect_y", rect.y()); | 451 raster_data->SetDouble("rect_y", rect.y()); |
452 raster_data->SetDouble("rect_width", rect.width()); | 452 raster_data->SetDouble("rect_width", rect.width()); |
453 raster_data->SetDouble("rect_height", rect.height()); | 453 raster_data->SetDouble("rect_height", rect.height()); |
454 return TracedValue::FromValue(raster_data.release()); | 454 return TracedValue::FromValue(raster_data.release()); |
455 } | 455 } |
456 | 456 |
457 } // namespace cc | 457 } // namespace cc |
OLD | NEW |