mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This includes the switch to libc++ on Android. Other fixes: *) Add (dumb) impl of OrderingBarrier() to command buffer *) "base/debug/trace_event.h" -> "base/trace_event/trace_event.h" *) Added a few <cmath> includes to sky Review URL: https://codereview.chromium.org/903273002
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
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/compositor/rasterizer_ganesh.h"
|
|
|
|
#include "base/trace_event/trace_event.h"
|
|
#include "mojo/skia/ganesh_surface.h"
|
|
#include "sky/compositor/layer_host.h"
|
|
#include "third_party/skia/include/core/SkCanvas.h"
|
|
#include "third_party/skia/include/core/SkPicture.h"
|
|
|
|
namespace sky {
|
|
|
|
RasterizerGanesh::RasterizerGanesh(LayerHost* host) : host_(host) {
|
|
DCHECK(host_);
|
|
}
|
|
|
|
RasterizerGanesh::~RasterizerGanesh() {
|
|
}
|
|
|
|
scoped_ptr<mojo::GLTexture> RasterizerGanesh::Rasterize(SkPicture* picture) {
|
|
TRACE_EVENT0("sky", "RasterizerGanesh::Rasterize");
|
|
|
|
SkRect cull_rect = picture->cullRect();
|
|
gfx::Size size(cull_rect.width(), cull_rect.height());
|
|
|
|
mojo::GaneshSurface surface(host_->ganesh_context(),
|
|
host_->resource_manager()->CreateTexture(size));
|
|
|
|
SkCanvas* canvas = surface.canvas();
|
|
canvas->drawPicture(picture);
|
|
canvas->flush();
|
|
|
|
return surface.TakeTexture();
|
|
}
|
|
|
|
} // namespace sky
|