blob: 62026d7227c3fd6f0e796a29bf1af8af3c23f3ce [file] [log] [blame]
[email protected]94f206c12012-08-25 00:09:141// Copyright 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5
6#include "config.h"
7
8#if USE(ACCELERATED_COMPOSITING)
9
10#include "SkPictureCanvasLayerTextureUpdater.h"
11
12#include "LayerPainterChromium.h"
13#include "SkCanvas.h"
14#include "TraceEvent.h"
15
[email protected]9c88e562012-09-14 22:21:3016namespace cc {
[email protected]94f206c12012-08-25 00:09:1417
18SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter)
19 : CanvasLayerTextureUpdater(painter)
20 , m_layerIsOpaque(false)
21{
22}
23
24SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater()
25{
26}
27
28void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats)
29{
30 SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height());
31 paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats);
32 m_picture.endRecording();
33}
34
35void SkPictureCanvasLayerTextureUpdater::drawPicture(SkCanvas* canvas)
36{
37 TRACE_EVENT0("cc", "SkPictureCanvasLayerTextureUpdater::drawPicture");
38 canvas->drawPicture(m_picture);
39}
40
41void SkPictureCanvasLayerTextureUpdater::setOpaque(bool opaque)
42{
43 m_layerIsOpaque = opaque;
44}
45
[email protected]9c88e562012-09-14 22:21:3046} // namespace cc
[email protected]94f206c12012-08-25 00:09:1447#endif // USE(ACCELERATED_COMPOSITING)