flutter_flutter/shell/gpu/ganesh_surface.cc
Adam Barth 3b32bd6a72 Teach SkyShell how to draw with Ganesh
This CL adds support to SkyShell for drawing with Ganesh. Currently, we don't
actually create any SkPictures to draw, but that will come in a later CL.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/891143002
2015-02-01 00:39:36 -08:00

31 lines
858 B
C++

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/gpu/ganesh_surface.h"
#include "base/logging.h"
#include "third_party/skia/include/gpu/GrContext.h"
namespace sky {
namespace shell {
GaneshSurface::GaneshSurface(GaneshContext* context, const gfx::Size& size) {
GrBackendRenderTargetDesc desc;
desc.fWidth = size.width();
desc.fHeight = size.height();
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
auto target = skia::AdoptRef(context->gr()->wrapBackendRenderTarget(desc));
DCHECK(target);
surface_ = skia::AdoptRef(SkSurface::NewRenderTargetDirect(target.get()));
DCHECK(surface_);
}
GaneshSurface::~GaneshSurface() {
}
} // namespace shell
} // namespace sky