1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkHwuiRenderer_DEFINED
9#define SkHwuiRenderer_DEFINED
10
11#include "DisplayListCanvas.h"
12#include "RenderNode.h"
13#include "SkTypes.h"
14#include "gui/CpuConsumer.h"
15#include "gui/IGraphicBufferConsumer.h"
16#include "gui/IGraphicBufferProducer.h"
17#include "gui/Surface.h"
18#include "renderthread/RenderProxy.h"
19
20class SkBitmap;
21
22struct SkHwuiRenderer {
23    SkAutoTDelete<android::uirenderer::RenderNode> rootNode;
24    SkAutoTDelete<android::uirenderer::renderthread::RenderProxy> proxy;
25    SkAutoTDelete<android::uirenderer::DisplayListCanvas> canvas;
26    android::sp<android::IGraphicBufferProducer> producer;
27    android::sp<android::IGraphicBufferConsumer> consumer;
28    android::sp<android::CpuConsumer> cpuConsumer;
29    android::sp<android::Surface> androidSurface;
30    SkISize size;
31
32    void initialize(SkISize size);
33
34    /// Returns a canvas to draw into.
35    SkCanvas* prepareToDraw();
36
37    void finishDrawing();
38
39    bool capturePixels(SkBitmap* bmp);
40};
41
42#endif  // SkHwuiRenderer_DEFINED
43