| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/skpicture_content_layer_updater.h" | 5 #include "cc/resources/skpicture_content_layer_updater.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/resources/layer_painter.h" | 8 #include "cc/resources/layer_painter.h" |
| 9 #include "cc/resources/prioritized_resource.h" | 9 #include "cc/resources/prioritized_resource.h" |
| 10 #include "cc/resources/resource_update_queue.h" | 10 #include "cc/resources/resource_update_queue.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource( | 42 scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource( |
| 43 PrioritizedResourceManager* manager) { | 43 PrioritizedResourceManager* manager) { |
| 44 return scoped_ptr<LayerUpdater::Resource>( | 44 return scoped_ptr<LayerUpdater::Resource>( |
| 45 new Resource(this, PrioritizedResource::Create(manager))); | 45 new Resource(this, PrioritizedResource::Create(manager))); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void SkPictureContentLayerUpdater::PrepareToUpdate( | 48 void SkPictureContentLayerUpdater::PrepareToUpdate( |
| 49 gfx::Rect content_rect, | 49 gfx::Rect content_rect, |
| 50 gfx::Size, | 50 gfx::Size, |
| 51 float contentsWidthScale, | 51 float contents_width_scale, |
| 52 float contents_height_scale, | 52 float contents_height_scale, |
| 53 gfx::Rect* resultingOpaqueRect, | 53 gfx::Rect* resulting_opaque_rect, |
| 54 RenderingStats* stats) { | 54 RenderingStats* stats) { |
| 55 SkCanvas* canvas = | 55 SkCanvas* canvas = |
| 56 picture_.beginRecording(content_rect.width(), content_rect.height()); | 56 picture_.beginRecording(content_rect.width(), content_rect.height()); |
| 57 PaintContents(canvas, | 57 PaintContents(canvas, |
| 58 content_rect, | 58 content_rect, |
| 59 contentsWidthScale, | 59 contents_width_scale, |
| 60 contents_height_scale, | 60 contents_height_scale, |
| 61 resultingOpaqueRect, | 61 resulting_opaque_rect, |
| 62 stats); | 62 stats); |
| 63 picture_.endRecording(); | 63 picture_.endRecording(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) { | 66 void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) { |
| 67 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::drawPicture"); | 67 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::DrawPicture"); |
| 68 canvas->drawPicture(picture_); | 68 canvas->drawPicture(picture_); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, | 71 void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, |
| 72 PrioritizedResource* texture, | 72 PrioritizedResource* texture, |
| 73 gfx::Rect source_rect, | 73 gfx::Rect source_rect, |
| 74 gfx::Vector2d dest_offset, | 74 gfx::Vector2d dest_offset, |
| 75 bool partial_update) { | 75 bool partial_update) { |
| 76 ResourceUpdate upload = ResourceUpdate::CreateFromPicture( | 76 ResourceUpdate upload = ResourceUpdate::CreateFromPicture( |
| 77 texture, &picture_, content_rect(), source_rect, dest_offset); | 77 texture, &picture_, content_rect(), source_rect, dest_offset); |
| 78 if (partial_update) | 78 if (partial_update) |
| 79 queue->AppendPartialUpload(upload); | 79 queue->AppendPartialUpload(upload); |
| 80 else | 80 else |
| 81 queue->AppendFullUpload(upload); | 81 queue->AppendFullUpload(upload); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void SkPictureContentLayerUpdater::SetOpaque(bool opaque) { | 84 void SkPictureContentLayerUpdater::SetOpaque(bool opaque) { |
| 85 layer_is_opaque_ = opaque; | 85 layer_is_opaque_ = opaque; |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace cc | 88 } // namespace cc |
| OLD | NEW |