| 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_canvas_layer_texture_updater.h" | 7 #include "cc/skpicture_canvas_layer_texture_updater.h" |
| 8 | 8 |
| 9 #include "CCTextureUpdateQueue.h" | 9 #include "CCTextureUpdateQueue.h" |
| 10 #include "TraceEvent.h" | 10 #include "TraceEvent.h" |
| 11 #include "cc/layer_painter.h" | 11 #include "cc/layer_painter.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 SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(scoped_pt
r<LayerPainterChromium> painter) | 16 SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(scoped_pt
r<LayerPainter> painter) |
| 17 : CanvasLayerTextureUpdater(painter.Pass()) | 17 : CanvasLayerTextureUpdater(painter.Pass()) |
| 18 , m_layerIsOpaque(false) | 18 , m_layerIsOpaque(false) |
| 19 { | 19 { |
| 20 } | 20 } |
| 21 | 21 |
| 22 SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() | 22 SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() |
| 23 { | 23 { |
| 24 } | 24 } |
| 25 | 25 |
| 26 void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentR
ect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRec
t& resultingOpaqueRect, CCRenderingStats& stats) | 26 void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentR
ect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRec
t& resultingOpaqueRect, RenderingStats& stats) |
| 27 { | 27 { |
| 28 SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect
.height()); | 28 SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect
.height()); |
| 29 paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale,
resultingOpaqueRect, stats); | 29 paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale,
resultingOpaqueRect, stats); |
| 30 m_picture.endRecording(); | 30 m_picture.endRecording(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void SkPictureCanvasLayerTextureUpdater::drawPicture(SkCanvas* canvas) | 33 void SkPictureCanvasLayerTextureUpdater::drawPicture(SkCanvas* canvas) |
| 34 { | 34 { |
| 35 TRACE_EVENT0("cc", "SkPictureCanvasLayerTextureUpdater::drawPicture"); | 35 TRACE_EVENT0("cc", "SkPictureCanvasLayerTextureUpdater::drawPicture"); |
| 36 canvas->drawPicture(m_picture); | 36 canvas->drawPicture(m_picture); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void SkPictureCanvasLayerTextureUpdater::updateTexture(CCTextureUpdateQueue& que
ue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& des
tOffset, bool partialUpdate) | 39 void SkPictureCanvasLayerTextureUpdater::updateTexture(TextureUpdateQueue& queue
, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOff
set, bool partialUpdate) |
| 40 { | 40 { |
| 41 TextureUploader::Parameters upload = { texture, NULL, &m_picture, { contentR
ect(), sourceRect, destOffset } }; | 41 TextureUploader::Parameters upload = { texture, NULL, &m_picture, { contentR
ect(), sourceRect, destOffset } }; |
| 42 if (partialUpdate) | 42 if (partialUpdate) |
| 43 queue.appendPartialUpload(upload); | 43 queue.appendPartialUpload(upload); |
| 44 else | 44 else |
| 45 queue.appendFullUpload(upload); | 45 queue.appendFullUpload(upload); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void SkPictureCanvasLayerTextureUpdater::setOpaque(bool opaque) | 48 void SkPictureCanvasLayerTextureUpdater::setOpaque(bool opaque) |
| 49 { | 49 { |
| 50 m_layerIsOpaque = opaque; | 50 m_layerIsOpaque = opaque; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace cc | 53 } // namespace cc |
| OLD | NEW |