| 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 "LayerPainterChromium.h" | 12 #include "LayerPainterChromium.h" |
| 13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
| 14 #include "TraceEvent.h" | 14 #include "TraceEvent.h" |
| 15 #include "skia/ext/platform_picture_skia.h" |
| 15 | 16 |
| 16 namespace WebCore { | 17 namespace WebCore { |
| 17 | 18 |
| 18 SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(PassOwnPt
r<LayerPainterChromium> painter) | 19 SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(PassOwnPt
r<LayerPainterChromium> painter) |
| 19 : CanvasLayerTextureUpdater(painter) | 20 : CanvasLayerTextureUpdater(painter) |
| 21 , m_picture(adoptPtr(new skia::PlatformPictureSkia)) |
| 20 , m_layerIsOpaque(false) | 22 , m_layerIsOpaque(false) |
| 21 { | 23 { |
| 22 } | 24 } |
| 23 | 25 |
| 24 SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() | 26 SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() |
| 25 { | 27 { |
| 26 } | 28 } |
| 27 | 29 |
| 28 void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentR
ect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRec
t& resultingOpaqueRect, CCRenderingStats& stats) | 30 void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentR
ect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRec
t& resultingOpaqueRect, CCRenderingStats& stats) |
| 29 { | 31 { |
| 30 SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect
.height()); | 32 SkCanvas* canvas = m_picture->beginRecording(contentRect.width(), contentRec
t.height()); |
| 31 paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale,
resultingOpaqueRect, stats); | 33 paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale,
resultingOpaqueRect, stats); |
| 32 m_picture.endRecording(); | 34 m_picture->endRecording(); |
| 33 } | 35 } |
| 34 | 36 |
| 35 void SkPictureCanvasLayerTextureUpdater::drawPicture(SkCanvas* canvas) | 37 void SkPictureCanvasLayerTextureUpdater::drawPicture(SkCanvas* canvas) |
| 36 { | 38 { |
| 37 TRACE_EVENT0("cc", "SkPictureCanvasLayerTextureUpdater::drawPicture"); | 39 TRACE_EVENT0("cc", "SkPictureCanvasLayerTextureUpdater::drawPicture"); |
| 38 canvas->drawPicture(m_picture); | 40 m_picture->drawPicture(canvas); |
| 39 } | 41 } |
| 40 | 42 |
| 41 void SkPictureCanvasLayerTextureUpdater::setOpaque(bool opaque) | 43 void SkPictureCanvasLayerTextureUpdater::setOpaque(bool opaque) |
| 42 { | 44 { |
| 43 m_layerIsOpaque = opaque; | 45 m_layerIsOpaque = opaque; |
| 44 } | 46 } |
| 45 | 47 |
| 46 } // namespace WebCore | 48 } // namespace WebCore |
| 47 #endif // USE(ACCELERATED_COMPOSITING) | 49 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |