| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/skpicture_content_layer_updater.h" | 7 #include "cc/skpicture_content_layer_updater.h" |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/layer_painter.h" | 10 #include "cc/layer_painter.h" |
| 11 #include "cc/texture_update_queue.h" | 11 #include "cc/resource_update_queue.h" |
| 12 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 SkPictureContentLayerUpdater::Resource::Resource(SkPictureContentLayerUpdater* u
pdater, scoped_ptr<PrioritizedTexture> texture) | 16 SkPictureContentLayerUpdater::Resource::Resource(SkPictureContentLayerUpdater* u
pdater, scoped_ptr<PrioritizedTexture> texture) |
| 17 : LayerUpdater::Resource(texture.Pass()) | 17 : LayerUpdater::Resource(texture.Pass()) |
| 18 , m_updater(updater) | 18 , m_updater(updater) |
| 19 { | 19 { |
| 20 } | 20 } |
| 21 | 21 |
| 22 SkPictureContentLayerUpdater::Resource::~Resource() | 22 SkPictureContentLayerUpdater::Resource::~Resource() |
| 23 { | 23 { |
| 24 } | 24 } |
| 25 | 25 |
| 26 void SkPictureContentLayerUpdater::Resource::update(TextureUpdateQueue& queue, c
onst IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, Renderi
ngStats&) | 26 void SkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue,
const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, Render
ingStats&) |
| 27 { | 27 { |
| 28 updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUp
date); | 28 updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUp
date); |
| 29 } | 29 } |
| 30 | 30 |
| 31 SkPictureContentLayerUpdater::SkPictureContentLayerUpdater(scoped_ptr<LayerPaint
er> painter) | 31 SkPictureContentLayerUpdater::SkPictureContentLayerUpdater(scoped_ptr<LayerPaint
er> painter) |
| 32 : ContentLayerUpdater(painter.Pass()) | 32 : ContentLayerUpdater(painter.Pass()) |
| 33 , m_layerIsOpaque(false) | 33 , m_layerIsOpaque(false) |
| 34 { | 34 { |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 54 paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale,
resultingOpaqueRect, stats); | 54 paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale,
resultingOpaqueRect, stats); |
| 55 m_picture.endRecording(); | 55 m_picture.endRecording(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void SkPictureContentLayerUpdater::drawPicture(SkCanvas* canvas) | 58 void SkPictureContentLayerUpdater::drawPicture(SkCanvas* canvas) |
| 59 { | 59 { |
| 60 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::drawPicture"); | 60 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::drawPicture"); |
| 61 canvas->drawPicture(m_picture); | 61 canvas->drawPicture(m_picture); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SkPictureContentLayerUpdater::updateTexture(TextureUpdateQueue& queue, Prio
ritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, b
ool partialUpdate) | 64 void SkPictureContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, Pri
oritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset,
bool partialUpdate) |
| 65 { | 65 { |
| 66 ResourceUpdate upload = ResourceUpdate::CreateFromPicture( | 66 ResourceUpdate upload = ResourceUpdate::CreateFromPicture( |
| 67 texture, &m_picture, contentRect(), sourceRect, destOffset); | 67 texture, &m_picture, contentRect(), sourceRect, destOffset); |
| 68 if (partialUpdate) | 68 if (partialUpdate) |
| 69 queue.appendPartialUpload(upload); | 69 queue.appendPartialUpload(upload); |
| 70 else | 70 else |
| 71 queue.appendFullUpload(upload); | 71 queue.appendFullUpload(upload); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void SkPictureContentLayerUpdater::setOpaque(bool opaque) | 74 void SkPictureContentLayerUpdater::setOpaque(bool opaque) |
| 75 { | 75 { |
| 76 m_layerIsOpaque = opaque; | 76 m_layerIsOpaque = opaque; |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace cc | 79 } // namespace cc |
| OLD | NEW |