| Index: sky/compositor/rasterizer_bitmap.cc
|
| diff --git a/sky/compositor/display_delegate_bitmap.cc b/sky/compositor/rasterizer_bitmap.cc
|
| similarity index 50%
|
| rename from sky/compositor/display_delegate_bitmap.cc
|
| rename to sky/compositor/rasterizer_bitmap.cc
|
| index c8ba5537846fc3ebd1e2b666a61cb062166ba2a4..ee926f212de68ce57798d5775d8e70c7a126fc2f 100644
|
| --- a/sky/compositor/display_delegate_bitmap.cc
|
| +++ b/sky/compositor/rasterizer_bitmap.cc
|
| @@ -1,39 +1,43 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// 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/display_delegate_bitmap.h"
|
| +#include "sky/compositor/rasterizer_bitmap.h"
|
|
|
| #include "sky/compositor/layer_client.h"
|
| +#include "sky/compositor/layer_host.h"
|
| #include "third_party/skia/include/core/SkBitmapDevice.h"
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| +#include "third_party/skia/include/core/SkPicture.h"
|
| #include "ui/gfx/codec/png_codec.h"
|
| #include "ui/gfx/geometry/rect.h"
|
|
|
| namespace sky {
|
|
|
| -DisplayDelegateBitmap::DisplayDelegateBitmap(LayerClient* client)
|
| - : client_(client) {}
|
| -
|
| -DisplayDelegateBitmap::~DisplayDelegateBitmap() {}
|
| +RasterizerBitmap::RasterizerBitmap(LayerHost* host) : host_(host) {
|
| + DCHECK(host_);
|
| +}
|
|
|
| -DisplayDelegate* DisplayDelegateBitmap::create(LayerClient* client) {
|
| - return new DisplayDelegateBitmap(client);
|
| +RasterizerBitmap::~RasterizerBitmap() {
|
| }
|
|
|
| -void DisplayDelegateBitmap::GetPixelsForTesting(std::vector<unsigned char>* pixels) {
|
| +void RasterizerBitmap::GetPixelsForTesting(std::vector<unsigned char>* pixels) {
|
| gfx::PNGCodec::EncodeBGRASkBitmap(bitmap_, true, pixels);
|
| }
|
|
|
| -void DisplayDelegateBitmap::Paint(mojo::GaneshSurface& surface, const gfx::Rect& size) {
|
| +scoped_ptr<mojo::GLTexture> RasterizerBitmap::Rasterize(SkPicture* picture) {
|
| + auto size = picture->cullRect();
|
| bitmap_.allocN32Pixels(size.width(), size.height());
|
| +
|
| SkBitmapDevice device(bitmap_);
|
| SkCanvas canvas(&device);
|
| // Draw red so we can see when we fail to paint.
|
| canvas.drawColor(SK_ColorRED);
|
| -
|
| - client_->PaintContents(&canvas, size);
|
| + canvas.drawPicture(picture);
|
| canvas.flush();
|
| +
|
| + return host_->resource_manager()->CreateTexture(
|
| + gfx::Size(size.width(), size.height()));
|
| }
|
|
|
| } // namespace sky
|
|
|