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