summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-06 01:01:57 +0000
committerskaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-06 01:01:57 +0000
commitbd3d1ce09646cfc1279ccf9054dc9a01ee64c5ce (patch)
treed46d6de81dfce568fa8617184a6bb8e9eb42c4b4
parent8be1c58da8394b427173443933f66958b6068f69 (diff)
downloadchromium_src-bd3d1ce09646cfc1279ccf9054dc9a01ee64c5ce.zip
chromium_src-bd3d1ce09646cfc1279ccf9054dc9a01ee64c5ce.tar.gz
chromium_src-bd3d1ce09646cfc1279ccf9054dc9a01ee64c5ce.tar.bz2
Changed SoftwareOutputDevice interface.
+ Some of the necessary changes to the renderer for software compositing. BUG=124671, 161008 Review URL: https://chromiumcodereview.appspot.com/12379055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186310 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/DEPS1
-rw-r--r--cc/cc.gyp4
-rw-r--r--cc/cc_tests.gyp2
-rw-r--r--cc/compositor_frame.cc1
-rw-r--r--cc/compositor_frame.h2
-rw-r--r--cc/compositor_frame_ack.cc4
-rw-r--r--cc/compositor_frame_ack.h2
-rw-r--r--cc/gl_renderer.cc7
-rw-r--r--cc/gl_renderer.h2
-rw-r--r--cc/layer_tree_host_impl.cc2
-rw-r--r--cc/output_surface.h4
-rw-r--r--cc/picture_layer_impl_unittest.cc1
-rw-r--r--cc/software_frame_data.cc14
-rw-r--r--cc/software_frame_data.h26
-rw-r--r--cc/software_output_device.cc61
-rw-r--r--cc/software_output_device.h45
-rw-r--r--cc/software_renderer.cc66
-rw-r--r--cc/software_renderer.h15
-rw-r--r--cc/software_renderer_unittest.cc8
-rw-r--r--cc/test/fake_layer_tree_host_client.cc4
-rw-r--r--cc/test/fake_output_surface.h2
-rw-r--r--cc/test/fake_software_output_device.cc33
-rw-r--r--cc/test/fake_software_output_device.h33
-rw-r--r--content/renderer/gpu/compositor_software_output_device_gl_adapter.cc127
-rw-r--r--content/renderer/gpu/compositor_software_output_device_gl_adapter.h33
-rw-r--r--webkit/compositor_bindings/compositor_bindings.gyp2
-rw-r--r--webkit/compositor_bindings/web_compositor_support_impl.cc9
-rw-r--r--webkit/compositor_bindings/web_compositor_support_software_output_device.cc35
-rw-r--r--webkit/compositor_bindings/web_compositor_support_software_output_device.h35
-rw-r--r--webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc10
30 files changed, 283 insertions, 307 deletions
diff --git a/cc/DEPS b/cc/DEPS
index d9760e6..3982777 100644
--- a/cc/DEPS
+++ b/cc/DEPS
@@ -8,6 +8,7 @@ include_rules = [
"+third_party/khronos/GLES2/gl2ext.h",
"+ui/gfx",
"+ui/gl",
+ "+ui/surface",
# TODO(danakj): Drop dependencies on WebKit Platform API from cc.
"+third_party/WebKit/Source/Platform/chromium/public",
# TODO(jamesr): Remove once cc depends on GLES2Interface instead of WGC3D
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 79d8f21..3f340f7 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -247,6 +247,9 @@
'single_thread_proxy.h',
'skpicture_content_layer_updater.cc',
'skpicture_content_layer_updater.h',
+ 'software_frame_data.cc',
+ 'software_frame_data.h',
+ 'software_output_device.cc',
'software_output_device.h',
'software_renderer.cc',
'software_renderer.h',
@@ -347,6 +350,7 @@
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/ui/gl/gl.gyp:gl',
+ '<(DEPTH)/ui/surface/surface.gyp:surface',
'<(DEPTH)/ui/ui.gyp:ui',
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
],
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 20237cb..c2a8e5d 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -105,8 +105,6 @@
'test/fake_tile_manager_client.h',
'test/fake_output_surface.cc',
'test/fake_output_surface.h',
- 'test/fake_software_output_device.cc',
- 'test/fake_software_output_device.h',
'test/fake_video_frame_provider.cc',
'test/fake_video_frame_provider.h',
'test/fake_web_scrollbar.cc',
diff --git a/cc/compositor_frame.cc b/cc/compositor_frame.cc
index 69119b0..d8a5511 100644
--- a/cc/compositor_frame.cc
+++ b/cc/compositor_frame.cc
@@ -13,6 +13,7 @@ CompositorFrame::~CompositorFrame() {}
void CompositorFrame::AssignTo(CompositorFrame* target) {
target->delegated_frame_data = delegated_frame_data.Pass();
target->gl_frame_data = gl_frame_data.Pass();
+ target->software_frame_data = software_frame_data.Pass();
target->metadata = metadata;
}
diff --git a/cc/compositor_frame.h b/cc/compositor_frame.h
index b82f600..ce1f95b 100644
--- a/cc/compositor_frame.h
+++ b/cc/compositor_frame.h
@@ -10,6 +10,7 @@
#include "cc/compositor_frame_metadata.h"
#include "cc/delegated_frame_data.h"
#include "cc/gl_frame_data.h"
+#include "cc/software_frame_data.h"
namespace cc {
@@ -21,6 +22,7 @@ class CC_EXPORT CompositorFrame {
CompositorFrameMetadata metadata;
scoped_ptr<DelegatedFrameData> delegated_frame_data;
scoped_ptr<GLFrameData> gl_frame_data;
+ scoped_ptr<SoftwareFrameData> software_frame_data;
void AssignTo(CompositorFrame* target);
};
diff --git a/cc/compositor_frame_ack.cc b/cc/compositor_frame_ack.cc
index 2709c0f..1ad1093 100644
--- a/cc/compositor_frame_ack.cc
+++ b/cc/compositor_frame_ack.cc
@@ -6,7 +6,9 @@
namespace cc {
-CompositorFrameAck::CompositorFrameAck() {}
+CompositorFrameAck::CompositorFrameAck()
+ : last_content_dib(TransportDIB::DefaultHandleValue()) {
+}
CompositorFrameAck::~CompositorFrameAck() {}
diff --git a/cc/compositor_frame_ack.h b/cc/compositor_frame_ack.h
index 117f6a6..4d72548 100644
--- a/cc/compositor_frame_ack.h
+++ b/cc/compositor_frame_ack.h
@@ -9,6 +9,7 @@
#include "cc/cc_export.h"
#include "cc/gl_frame_data.h"
#include "cc/transferable_resource.h"
+#include "ui/surface/transport_dib.h"
namespace cc {
@@ -19,6 +20,7 @@ class CC_EXPORT CompositorFrameAck {
TransferableResourceArray resources;
scoped_ptr<GLFrameData> gl_frame_data;
+ TransportDIB::Handle last_content_dib;
};
} // namespace cc
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index 0e3e03f..63378f8 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -21,6 +21,7 @@
#include "cc/gl_frame_data.h"
#include "cc/layer_quad.h"
#include "cc/math_util.h"
+#include "cc/output_surface.h"
#include "cc/priority_calculator.h"
#include "cc/proxy.h"
#include "cc/render_pass.h"
@@ -80,14 +81,16 @@ bool needsIOSurfaceReadbackWorkaround()
scoped_ptr<GLRenderer> GLRenderer::create(RendererClient* client, OutputSurface* outputSurface, ResourceProvider* resourceProvider)
{
- scoped_ptr<GLRenderer> renderer(make_scoped_ptr(new GLRenderer(client, outputSurface, resourceProvider)));
+ scoped_ptr<GLRenderer> renderer(new GLRenderer(client, outputSurface, resourceProvider));
if (!renderer->initialize())
return scoped_ptr<GLRenderer>();
return renderer.Pass();
}
-GLRenderer::GLRenderer(RendererClient* client, OutputSurface* outputSurface, ResourceProvider* resourceProvider)
+GLRenderer::GLRenderer(RendererClient* client,
+ OutputSurface* outputSurface,
+ ResourceProvider* resourceProvider)
: DirectRenderer(client, resourceProvider)
, m_offscreenFramebufferId(0)
, m_sharedGeometryQuad(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f))
diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h
index 4fe0c48..750530d 100644
--- a/cc/gl_renderer.h
+++ b/cc/gl_renderer.h
@@ -11,7 +11,6 @@
#include "cc/direct_renderer.h"
#include "cc/gl_renderer_draw_cache.h"
#include "cc/io_surface_draw_quad.h"
-#include "cc/output_surface.h"
#include "cc/render_pass_draw_quad.h"
#include "cc/renderer.h"
#include "cc/solid_color_draw_quad.h"
@@ -23,6 +22,7 @@
namespace cc {
+class OutputSurface;
class ScopedResource;
class StreamVideoDrawQuad;
class TextureDrawQuad;
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index c6ce9b4..486f283 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -1086,7 +1086,7 @@ bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurfa
else if (outputSurface->context3d())
m_renderer = GLRenderer::create(this, outputSurface.get(), resourceProvider.get());
else if (outputSurface->software_device())
- m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), outputSurface->software_device());
+ m_renderer = SoftwareRenderer::create(this, outputSurface.get(), resourceProvider.get());
if (!m_renderer)
return false;
diff --git a/cc/output_surface.h b/cc/output_surface.h
index 0b02e50..69b9914 100644
--- a/cc/output_surface.h
+++ b/cc/output_surface.h
@@ -7,6 +7,7 @@
#define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this.
+#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "cc/cc_export.h"
#include "cc/software_output_device.h"
@@ -95,6 +96,9 @@ class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface {
scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
scoped_ptr<cc::SoftwareOutputDevice> software_device_;
bool has_gl_discard_backbuffer_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OutputSurface);
};
} // namespace cc
diff --git a/cc/picture_layer_impl_unittest.cc b/cc/picture_layer_impl_unittest.cc
index 02b59da..03fc5bd 100644
--- a/cc/picture_layer_impl_unittest.cc
+++ b/cc/picture_layer_impl_unittest.cc
@@ -11,6 +11,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/skia/include/core/SkDevice.h"
#include "ui/gfx/rect_conversions.h"
namespace cc {
diff --git a/cc/software_frame_data.cc b/cc/software_frame_data.cc
new file mode 100644
index 0000000..72c2037
--- /dev/null
+++ b/cc/software_frame_data.cc
@@ -0,0 +1,14 @@
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/software_frame_data.h"
+
+namespace cc {
+
+SoftwareFrameData::SoftwareFrameData()
+ : content_dib(TransportDIB::DefaultHandleValue()) {
+}
+
+SoftwareFrameData::~SoftwareFrameData() {}
+
+} // namespace cc
diff --git a/cc/software_frame_data.h b/cc/software_frame_data.h
new file mode 100644
index 0000000..4fa4ad6
--- /dev/null
+++ b/cc/software_frame_data.h
@@ -0,0 +1,26 @@
+// Copyright 2013 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.
+
+#ifndef CC_SOFTWARE_FRAME_DATA_H_
+#define CC_SOFTWARE_FRAME_DATA_H_
+
+#include "base/basictypes.h"
+#include "cc/cc_export.h"
+#include "ui/gfx/rect.h"
+#include "ui/surface/transport_dib.h"
+
+namespace cc {
+
+class CC_EXPORT SoftwareFrameData {
+ public:
+ SoftwareFrameData();
+ ~SoftwareFrameData();
+
+ gfx::Rect damage_rect;
+ TransportDIB::Handle content_dib;
+};
+
+} // namespace cc
+
+#endif // CC_SOFTWARE_FRAME_DATA_H_
diff --git a/cc/software_output_device.cc b/cc/software_output_device.cc
new file mode 100644
index 0000000..1e693e7
--- /dev/null
+++ b/cc/software_output_device.cc
@@ -0,0 +1,61 @@
+// Copyright 2013 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 "cc/software_output_device.h"
+
+#include "base/logging.h"
+#include "cc/software_frame_data.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkDevice.h"
+
+namespace cc {
+
+SoftwareOutputDevice::SoftwareOutputDevice() {}
+
+SoftwareOutputDevice::~SoftwareOutputDevice() {}
+
+void SoftwareOutputDevice::Resize(const gfx::Size& viewport_size) {
+ if (viewport_size_ == viewport_size)
+ return;
+
+ viewport_size_ = viewport_size;
+ device_ = skia::AdoptRef(new SkDevice(SkBitmap::kARGB_8888_Config,
+ viewport_size.width(), viewport_size.height(), true));
+ canvas_ = skia::AdoptRef(new SkCanvas(device_.get()));
+}
+
+SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) {
+ DCHECK(device_);
+ damage_rect_ = damage_rect;
+ return canvas_.get();
+}
+
+void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) {
+ DCHECK(device_);
+ if (frame_data) {
+ frame_data->damage_rect = damage_rect_;
+ frame_data->content_dib = TransportDIB::DefaultHandleValue();
+ }
+}
+
+void SoftwareOutputDevice::CopyToBitmap(
+ const gfx::Rect& rect, SkBitmap* output) {
+ DCHECK(device_);
+ SkIRect invertRect = SkIRect::MakeXYWH(
+ rect.x(), viewport_size_.height() - rect.bottom(),
+ rect.width(), rect.height());
+ const SkBitmap& bitmap = device_->accessBitmap(false);
+ bitmap.extractSubset(output, invertRect);
+}
+
+void SoftwareOutputDevice::Scroll(
+ const gfx::Vector2d& delta, const gfx::Rect& clip_rect) {
+ NOTIMPLEMENTED();
+}
+
+void SoftwareOutputDevice::ReclaimDIB(TransportDIB::Handle handle) {
+ NOTIMPLEMENTED();
+}
+
+} // namespace cc
diff --git a/cc/software_output_device.h b/cc/software_output_device.h
index 0581b2b..f397a56 100644
--- a/cc/software_output_device.h
+++ b/cc/software_output_device.h
@@ -5,25 +5,50 @@
#ifndef CC_SOFTWARE_OUTPUT_DEVICE_H_
#define CC_SOFTWARE_OUTPUT_DEVICE_H_
-#include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h"
+#include "base/basictypes.h"
+#include "cc/cc_export.h"
+#include "skia/ext/refptr.h"
+#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
+#include "ui/gfx/vector2d.h"
+#include "ui/surface/transport_dib.h"
+
+class SkBitmap;
+class SkDevice;
+class SkCanvas;
namespace cc {
+class SoftwareFrameData;
+
// This is a "tear-off" class providing software drawing support to
// OutputSurface, such as to a platform-provided window framebuffer.
-class SoftwareOutputDevice {
+class CC_EXPORT SoftwareOutputDevice {
public:
- virtual ~SoftwareOutputDevice() {}
- // Lock the framebuffer and return a pointer to a WebImage referring to its
- // pixels. Set forWrite if you intend to change the pixels. Readback
- // is supported whether or not forWrite is set.
- // TODO(danakj): Switch this from WebImage to a Skia type.
- virtual WebKit::WebImage* Lock(bool forWrite) = 0;
- virtual void Unlock() = 0;
+ SoftwareOutputDevice();
+ virtual ~SoftwareOutputDevice();
+
+ // SoftwareOutputDevice implementation
+ virtual void Resize(const gfx::Size& size);
+
+ virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect);
+ virtual void EndPaint(SoftwareFrameData* frame_data=NULL);
+
+ virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output);
+ virtual void Scroll(const gfx::Vector2d& delta,
+ const gfx::Rect& clip_rect);
+
+ // TODO(skaslev) Remove this after UberCompositor lands.
+ virtual void ReclaimDIB(TransportDIB::Handle handle);
+
+protected:
+ gfx::Size viewport_size_;
+ gfx::Rect damage_rect_;
+ skia::RefPtr<SkDevice> device_;
+ skia::RefPtr<SkCanvas> canvas_;
- virtual void DidChangeViewportSize(gfx::Size) = 0;
+ DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDevice);
};
} // namespace cc
diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc
index e1764c7..9b025c8 100644
--- a/cc/software_renderer.cc
+++ b/cc/software_renderer.cc
@@ -5,8 +5,12 @@
#include "cc/software_renderer.h"
#include "base/debug/trace_event.h"
+#include "cc/compositor_frame.h"
+#include "cc/compositor_frame_ack.h"
+#include "cc/compositor_frame_metadata.h"
#include "cc/debug_border_draw_quad.h"
#include "cc/math_util.h"
+#include "cc/output_surface.h"
#include "cc/render_pass_draw_quad.h"
#include "cc/software_output_device.h"
#include "cc/solid_color_draw_quad.h"
@@ -52,16 +56,19 @@ bool isScaleAndTranslate(const SkMatrix& matrix)
} // anonymous namespace
-scoped_ptr<SoftwareRenderer> SoftwareRenderer::create(RendererClient* client, ResourceProvider* resourceProvider, SoftwareOutputDevice* outputDevice)
+scoped_ptr<SoftwareRenderer> SoftwareRenderer::create(RendererClient* client, OutputSurface* outputSurface, ResourceProvider* resourceProvider)
{
- return make_scoped_ptr(new SoftwareRenderer(client, resourceProvider, outputDevice));
+ return make_scoped_ptr(new SoftwareRenderer(client, outputSurface, resourceProvider));
}
-SoftwareRenderer::SoftwareRenderer(RendererClient* client, ResourceProvider* resourceProvider, SoftwareOutputDevice* outputDevice)
+SoftwareRenderer::SoftwareRenderer(RendererClient* client,
+ OutputSurface* outputSurface,
+ ResourceProvider* resourceProvider)
: DirectRenderer(client, resourceProvider)
+ , m_outputSurface(outputSurface)
, m_visible(true)
, m_isScissorEnabled(false)
- , m_outputDevice(outputDevice)
+ , m_outputDevice(outputSurface->software_device())
, m_skCurrentCanvas(0)
{
m_resourceProvider->setDefaultResourceType(ResourceProvider::Bitmap);
@@ -72,6 +79,9 @@ SoftwareRenderer::SoftwareRenderer(RendererClient* client, ResourceProvider* res
// The updater can access bitmaps while the SoftwareRenderer is using them.
m_capabilities.allowPartialTextureUpdates = true;
m_capabilities.usingPartialSwap = true;
+ if (m_client->hasImplThread())
+ m_capabilities.usingSwapCompleteCallback = true;
+ m_compositorFrame.software_frame_data.reset(new SoftwareFrameData());
viewportChanged();
}
@@ -87,22 +97,42 @@ const RendererCapabilities& SoftwareRenderer::capabilities() const
void SoftwareRenderer::viewportChanged()
{
- m_outputDevice->DidChangeViewportSize(viewportSize());
+ m_outputDevice->Resize(viewportSize());
}
void SoftwareRenderer::beginDrawingFrame(DrawingFrame& frame)
{
TRACE_EVENT0("cc", "SoftwareRenderer::beginDrawingFrame");
- m_skRootCanvas = make_scoped_ptr(new SkCanvas(m_outputDevice->Lock(true)->getSkBitmap()));
+ m_skRootCanvas = m_outputDevice->BeginPaint(
+ gfx::ToEnclosingRect(frame.rootDamageRect));
}
void SoftwareRenderer::finishDrawingFrame(DrawingFrame& frame)
{
TRACE_EVENT0("cc", "SoftwareRenderer::finishDrawingFrame");
m_currentFramebufferLock.reset();
- m_skCurrentCanvas = 0;
- m_skRootCanvas.reset();
- m_outputDevice->Unlock();
+ m_skCurrentCanvas = NULL;
+ m_skRootCanvas = NULL;
+ if (settings().compositorFrameMessage) {
+ m_compositorFrame.metadata = m_client->makeCompositorFrameMetadata();
+ m_outputDevice->EndPaint(m_compositorFrame.software_frame_data.get());
+ } else {
+ m_outputDevice->EndPaint();
+ }
+}
+
+bool SoftwareRenderer::swapBuffers()
+{
+ if (settings().compositorFrameMessage)
+ m_outputSurface->SendFrameToParentCompositor(&m_compositorFrame);
+ return true;
+}
+
+void SoftwareRenderer::receiveCompositorFrameAck(const CompositorFrameAck& ack)
+{
+ if (m_client->hasImplThread())
+ m_client->onSwapBuffersComplete();
+ m_outputDevice->ReclaimDIB(ack.last_content_dib);
}
bool SoftwareRenderer::flippedFramebuffer() const
@@ -134,7 +164,7 @@ void SoftwareRenderer::finish()
void SoftwareRenderer::bindFramebufferToOutputSurface(DrawingFrame& frame)
{
m_currentFramebufferLock.reset();
- m_skCurrentCanvas = m_skRootCanvas.get();
+ m_skCurrentCanvas = m_skRootCanvas;
}
bool SoftwareRenderer::bindFramebufferToTexture(DrawingFrame& frame, const ScopedResource* texture, const gfx::Rect& framebufferRect)
@@ -374,22 +404,14 @@ void SoftwareRenderer::drawUnsupportedQuad(const DrawingFrame& frame, const Draw
m_skCurrentCanvas->drawRect(gfx::RectFToSkRect(quadVertexRect()), m_skCurrentPaint);
}
-bool SoftwareRenderer::swapBuffers()
-{
- if (m_client->hasImplThread())
- m_client->onSwapBuffersComplete();
- return true;
-}
-
void SoftwareRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect)
{
TRACE_EVENT0("cc", "SoftwareRenderer::getFramebufferPixels");
- SkBitmap fullBitmap = m_outputDevice->Lock(false)->getSkBitmap();
SkBitmap subsetBitmap;
- SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - rect.bottom(), rect.width(), rect.height());
- fullBitmap.extractSubset(&subsetBitmap, invertRect);
- subsetBitmap.copyPixelsTo(pixels, rect.width() * rect.height() * 4, rect.width() * 4);
- m_outputDevice->Unlock();
+ m_outputDevice->CopyToBitmap(rect, &subsetBitmap);
+ subsetBitmap.copyPixelsTo(pixels,
+ 4 * rect.width() * rect.height(),
+ 4 * rect.width());
}
void SoftwareRenderer::setVisible(bool visible)
diff --git a/cc/software_renderer.h b/cc/software_renderer.h
index 5b9baa4..8b5067f 100644
--- a/cc/software_renderer.h
+++ b/cc/software_renderer.h
@@ -7,22 +7,25 @@
#include "base/basictypes.h"
#include "cc/cc_export.h"
+#include "cc/compositor_frame.h"
#include "cc/direct_renderer.h"
namespace cc {
+class OutputSurface;
+class SoftwareOutputDevice;
class DebugBorderDrawQuad;
class RendererClient;
class RenderPassDrawQuad;
class ResourceProvider;
-class SoftwareOutputDevice;
class SolidColorDrawQuad;
class TextureDrawQuad;
class TileDrawQuad;
class CC_EXPORT SoftwareRenderer : public DirectRenderer {
public:
- static scoped_ptr<SoftwareRenderer> create(RendererClient*, ResourceProvider*, SoftwareOutputDevice*);
+ static scoped_ptr<SoftwareRenderer> create(RendererClient*, OutputSurface*, ResourceProvider*);
+
virtual ~SoftwareRenderer();
virtual const RendererCapabilities& capabilities() const OVERRIDE;
@@ -39,6 +42,8 @@ public:
virtual void sendManagedMemoryStats(size_t bytesVisible, size_t bytesVisibleAndNearby, size_t bytesAllocated) OVERRIDE { }
+ virtual void receiveCompositorFrameAck(const CompositorFrameAck&) OVERRIDE;
+
protected:
virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedResource*, const gfx::Rect& framebufferRect) OVERRIDE;
@@ -53,7 +58,7 @@ protected:
virtual void ensureScissorTestDisabled() OVERRIDE;
private:
- SoftwareRenderer(RendererClient*, ResourceProvider*, SoftwareOutputDevice*);
+ SoftwareRenderer(RendererClient*, OutputSurface*, ResourceProvider*);
void clearCanvas(SkColor color);
void setClipRect(const gfx::Rect& rect);
@@ -71,11 +76,13 @@ private:
bool m_isScissorEnabled;
gfx::Rect m_scissorRect;
+ OutputSurface* m_outputSurface;
SoftwareOutputDevice* m_outputDevice;
- scoped_ptr<SkCanvas> m_skRootCanvas;
+ SkCanvas* m_skRootCanvas;
SkCanvas* m_skCurrentCanvas;
SkPaint m_skCurrentPaint;
scoped_ptr<ResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLock;
+ CompositorFrame m_compositorFrame;
DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer);
};
diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc
index cf4c2b4..bacea0c 100644
--- a/cc/software_renderer_unittest.cc
+++ b/cc/software_renderer_unittest.cc
@@ -8,10 +8,10 @@
#include "cc/quad_sink.h"
#include "cc/render_pass.h"
#include "cc/render_pass_draw_quad.h"
+#include "cc/software_output_device.h"
#include "cc/solid_color_draw_quad.h"
#include "cc/test/animation_test_common.h"
#include "cc/test/fake_output_surface.h"
-#include "cc/test/fake_software_output_device.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/render_pass_test_common.h"
#include "cc/test/render_pass_test_utils.h"
@@ -32,13 +32,11 @@ public:
}
void initializeRenderer() {
- m_outputSurface = FakeOutputSurface::CreateSoftware(scoped_ptr<SoftwareOutputDevice>(new FakeSoftwareOutputDevice));
+ m_outputSurface = FakeOutputSurface::CreateSoftware(make_scoped_ptr(new SoftwareOutputDevice));
m_resourceProvider = ResourceProvider::create(m_outputSurface.get());
- m_renderer = SoftwareRenderer::create(this, resourceProvider(), softwareDevice());
+ m_renderer = SoftwareRenderer::create(this, m_outputSurface.get(), resourceProvider());
}
- SoftwareOutputDevice* softwareDevice() const { return m_outputSurface->software_device(); }
- FakeOutputSurface* outputSurface() const { return m_outputSurface.get(); }
ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
SoftwareRenderer* renderer() const { return m_renderer.get(); }
void setViewportSize(const gfx::Size& viewportSize) { m_viewportSize = viewportSize; }
diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc
index 253f5fd..dbb51b6 100644
--- a/cc/test/fake_layer_tree_host_client.cc
+++ b/cc/test/fake_layer_tree_host_client.cc
@@ -21,9 +21,9 @@ scoped_ptr<OutputSurface> FakeLayerImplTreeHostClient::createOutputSurface()
{
if (m_useSoftwareRendering) {
if (m_useDelegatingRenderer)
- return FakeOutputSurface::CreateDelegatingSoftware(make_scoped_ptr(new FakeSoftwareOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurface>();
+ return FakeOutputSurface::CreateDelegatingSoftware(make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>();
- return FakeOutputSurface::CreateSoftware(make_scoped_ptr(new FakeSoftwareOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurface>();
+ return FakeOutputSurface::CreateSoftware(make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>();
}
WebKit::WebGraphicsContext3D::Attributes attrs;
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h
index 2ab7906..aaf0ec6 100644
--- a/cc/test/fake_output_surface.h
+++ b/cc/test/fake_output_surface.h
@@ -7,7 +7,7 @@
#include "cc/compositor_frame.h"
#include "cc/output_surface.h"
-#include "cc/test/fake_software_output_device.h"
+#include "cc/software_output_device.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
diff --git a/cc/test/fake_software_output_device.cc b/cc/test/fake_software_output_device.cc
deleted file mode 100644
index eebf2b9..0000000
--- a/cc/test/fake_software_output_device.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2012 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 "cc/test/fake_software_output_device.h"
-
-namespace cc {
-
-FakeSoftwareOutputDevice::FakeSoftwareOutputDevice() {}
-
-FakeSoftwareOutputDevice::~FakeSoftwareOutputDevice() {}
-
-WebKit::WebImage* FakeSoftwareOutputDevice::Lock(bool forWrite) {
- DCHECK(device_);
- image_ = device_->accessBitmap(forWrite);
- return &image_;
-}
-
-void FakeSoftwareOutputDevice::Unlock() {
- image_.reset();
-}
-
-void FakeSoftwareOutputDevice::DidChangeViewportSize(gfx::Size size) {
- if (device_.get() &&
- size.width() == device_->width() &&
- size.height() == device_->height())
- return;
-
- device_ = skia::AdoptRef(new SkDevice(
- SkBitmap::kARGB_8888_Config, size.width(), size.height(), true));
-}
-
-} // namespace cc
diff --git a/cc/test/fake_software_output_device.h b/cc/test/fake_software_output_device.h
deleted file mode 100644
index 0ee28a3..0000000
--- a/cc/test/fake_software_output_device.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2012 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.
-
-#ifndef CC_TEST_FAKE_SOFTWARE_OUTPUT_DEVICE_H_
-#define CC_TEST_FAKE_SOFTWARE_OUTPUT_DEVICE_H_
-
-#include "base/logging.h"
-#include "cc/software_output_device.h"
-#include "skia/ext/refptr.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h"
-#include "third_party/skia/include/core/SkDevice.h"
-
-namespace cc {
-
-class FakeSoftwareOutputDevice : public SoftwareOutputDevice {
- public:
- FakeSoftwareOutputDevice();
- virtual ~FakeSoftwareOutputDevice();
-
- virtual WebKit::WebImage* Lock(bool forWrite) OVERRIDE;
- virtual void Unlock() OVERRIDE;
-
- virtual void DidChangeViewportSize(gfx::Size size) OVERRIDE;
-
- private:
- skia::RefPtr<SkDevice> device_;
- WebKit::WebImage image_;
-};
-
-} // namespace cc
-
-#endif // CC_TEST_FAKE_SOFTWARE_OUTPUT_DEVICE_H_
diff --git a/content/renderer/gpu/compositor_software_output_device_gl_adapter.cc b/content/renderer/gpu/compositor_software_output_device_gl_adapter.cc
index dbcdc0d..5491441 100644
--- a/content/renderer/gpu/compositor_software_output_device_gl_adapter.cc
+++ b/content/renderer/gpu/compositor_software_output_device_gl_adapter.cc
@@ -5,62 +5,72 @@
#include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h"
#include "base/debug/trace_event.h"
-#include "base/logging.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/skia/include/core/SkPixelRef.h"
+#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
+#include "third_party/skia/include/core/SkPixelRef.h"
#include <GLES2/gl2.h>
-using WebKit::WebImage;
-using WebKit::WebGraphicsContext3D;
-using WebKit::WebSize;
-
namespace content {
-//------------------------------------------------------------------------------
-
CompositorSoftwareOutputDeviceGLAdapter::
- CompositorSoftwareOutputDeviceGLAdapter(WebGraphicsContext3D* context3D)
- : initialized_(false),
- program_(0),
+ CompositorSoftwareOutputDeviceGLAdapter(
+ WebKit::WebGraphicsContext3D* context3d)
+ : program_(0),
vertex_shader_(0),
fragment_shader_(0),
vertex_buffer_(0),
- framebuffer_texture_id_(0),
- context3d_(context3D),
- locked_for_write_(false) {
+ texture_id_(0),
+ context3d_(context3d) {
+ CHECK(context3d);
}
CompositorSoftwareOutputDeviceGLAdapter::
~CompositorSoftwareOutputDeviceGLAdapter() {
- Destroy();
-}
+ if (!device_)
+ return;
-WebImage* CompositorSoftwareOutputDeviceGLAdapter::Lock(bool forWrite) {
- locked_for_write_ = forWrite;
- image_ = device_->accessBitmap(forWrite);
- return &image_;
+ context3d_->makeContextCurrent();
+ context3d_->deleteShader(vertex_shader_);
+ context3d_->deleteShader(fragment_shader_);
+ context3d_->deleteProgram(program_);
+ context3d_->deleteBuffer(vertex_buffer_);
+ context3d_->deleteTexture(texture_id_);
}
-void CompositorSoftwareOutputDeviceGLAdapter::Unlock() {
- if (locked_for_write_)
- Draw(device_->accessBitmap(false).pixelRef()->pixels());
- image_.reset();
+void CompositorSoftwareOutputDeviceGLAdapter::Resize(
+ const gfx::Size& viewport_size) {
+ if (!device_)
+ InitShaders();
+
+ cc::SoftwareOutputDevice::Resize(viewport_size);
+
+ context3d_->makeContextCurrent();
+ context3d_->ensureBackbufferCHROMIUM();
+ context3d_->viewport(0, 0, viewport_size.width(), viewport_size.height());
+ context3d_->reshape(viewport_size.width(), viewport_size.height());
}
-void CompositorSoftwareOutputDeviceGLAdapter::DidChangeViewportSize(
- gfx::Size size) {
- if (!initialized_)
- Initialize();
+void CompositorSoftwareOutputDeviceGLAdapter::EndPaint(
+ cc::SoftwareFrameData* frame_data) {
+ DCHECK(device_);
+ DCHECK(frame_data == NULL);
- if (framebuffer_texture_size_ != gfx::Size(size))
- Resize(size);
+ TRACE_EVENT0("renderer", "CompositorSoftwareOutputDeviceGLAdapter::EndPaint");
+ const SkBitmap& bitmap = device_->accessBitmap(false);
+
+ context3d_->makeContextCurrent();
+ context3d_->ensureBackbufferCHROMIUM();
+ context3d_->clear(GL_COLOR_BUFFER_BIT);
+ context3d_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
+ viewport_size_.width(), viewport_size_.height(),
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap.pixelRef()->pixels());
+ context3d_->drawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ context3d_->prepareTexture();
}
-void CompositorSoftwareOutputDeviceGLAdapter::Initialize() {
+void CompositorSoftwareOutputDeviceGLAdapter::InitShaders() {
// Vertex shader that flips the y axis.
static const char g_vertex_shader[] =
"attribute vec4 a_Position;"
@@ -126,59 +136,12 @@ void CompositorSoftwareOutputDeviceGLAdapter::Initialize() {
context3d_->disable(GL_SCISSOR_TEST);
context3d_->clearColor(0, 0, 1, 1);
- initialized_ = true;
-}
-
-void CompositorSoftwareOutputDeviceGLAdapter::Destroy() {
- if (!initialized_)
- return;
-
- context3d_->makeContextCurrent();
- context3d_->deleteShader(vertex_shader_);
- context3d_->deleteShader(fragment_shader_);
- context3d_->deleteProgram(program_);
- context3d_->deleteBuffer(vertex_buffer_);
- if (framebuffer_texture_id_)
- context3d_->deleteTexture(framebuffer_texture_id_);
-}
-
-void CompositorSoftwareOutputDeviceGLAdapter::Resize(
- const gfx::Size& viewport_size) {
- framebuffer_texture_size_ = viewport_size;
- device_.reset(new SkDevice(SkBitmap::kARGB_8888_Config,
- viewport_size.width(), viewport_size.height(), true));
-
- context3d_->makeContextCurrent();
- context3d_->ensureBackbufferCHROMIUM();
- framebuffer_texture_id_ = context3d_->createTexture();
- context3d_->bindTexture(GL_TEXTURE_2D, framebuffer_texture_id_);
+ texture_id_ = context3d_->createTexture();
+ context3d_->bindTexture(GL_TEXTURE_2D, texture_id_);
context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
context3d_->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- context3d_->viewport(0, 0, viewport_size.width(), viewport_size.height());
- context3d_->reshape(viewport_size.width(), viewport_size.height());
-}
-
-void CompositorSoftwareOutputDeviceGLAdapter::Draw(void* pixels) {
- TRACE_EVENT0("renderer", "CompositorSoftwareOutputDeviceGLAdapter::Draw");
- if (!initialized_)
- NOTREACHED();
- if (!framebuffer_texture_id_)
- NOTREACHED();
-
- context3d_->makeContextCurrent();
- context3d_->ensureBackbufferCHROMIUM();
- context3d_->clear(GL_COLOR_BUFFER_BIT);
-
- context3d_->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- framebuffer_texture_size_.width(), framebuffer_texture_size_.height(),
- 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
-
- context3d_->drawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- context3d_->prepareTexture();
}
} // namespace content
diff --git a/content/renderer/gpu/compositor_software_output_device_gl_adapter.h b/content/renderer/gpu/compositor_software_output_device_gl_adapter.h
index 5d77edc..85e7af4 100644
--- a/content/renderer/gpu/compositor_software_output_device_gl_adapter.h
+++ b/content/renderer/gpu/compositor_software_output_device_gl_adapter.h
@@ -5,16 +5,10 @@
#ifndef CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_
#define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/ref_counted.h"
#include "base/threading/non_thread_safe.h"
#include "cc/software_output_device.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
-#include "ui/gfx/size.h"
namespace content {
@@ -28,29 +22,18 @@ public:
WebKit::WebGraphicsContext3D* context3d);
virtual ~CompositorSoftwareOutputDeviceGLAdapter();
- // cc::SoftwareOutputDevice implementation
- virtual WebKit::WebImage* Lock(bool forWrite) OVERRIDE;
- virtual void Unlock() OVERRIDE;
- virtual void DidChangeViewportSize(gfx::Size size) OVERRIDE;
+ virtual void Resize(const gfx::Size& size) OVERRIDE;
+ virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE;
private:
- void Initialize();
- void Destroy();
- void Resize(const gfx::Size& viewportSize);
- void Draw(void* pixels);
-
- bool initialized_;
- int program_;
- int vertex_shader_;
- int fragment_shader_;
- unsigned int vertex_buffer_;
- unsigned framebuffer_texture_id_;
- gfx::Size framebuffer_texture_size_;
+ void InitShaders();
+ unsigned program_;
+ unsigned vertex_shader_;
+ unsigned fragment_shader_;
+ unsigned vertex_buffer_;
+ unsigned texture_id_;
scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
- scoped_ptr<SkDevice> device_;
- WebKit::WebImage image_;
- bool locked_for_write_;
};
} // namespace content
diff --git a/webkit/compositor_bindings/compositor_bindings.gyp b/webkit/compositor_bindings/compositor_bindings.gyp
index 9afddfb..4b1fe6f 100644
--- a/webkit/compositor_bindings/compositor_bindings.gyp
+++ b/webkit/compositor_bindings/compositor_bindings.gyp
@@ -9,8 +9,6 @@
'web_animation_curve_common.h',
'web_animation_impl.cc',
'web_animation_impl.h',
- 'web_compositor_support_software_output_device.cc',
- 'web_compositor_support_software_output_device.h',
'web_content_layer_impl.cc',
'web_content_layer_impl.h',
'web_external_texture_layer_impl.cc',
diff --git a/webkit/compositor_bindings/web_compositor_support_impl.cc b/webkit/compositor_bindings/web_compositor_support_impl.cc
index 382505c..59d6214 100644
--- a/webkit/compositor_bindings/web_compositor_support_impl.cc
+++ b/webkit/compositor_bindings/web_compositor_support_impl.cc
@@ -7,10 +7,10 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop_proxy.h"
#include "cc/output_surface.h"
+#include "cc/software_output_device.h"
#include "cc/thread_impl.h"
#include "cc/transform_operations.h"
#include "webkit/compositor_bindings/web_animation_impl.h"
-#include "webkit/compositor_bindings/web_compositor_support_software_output_device.h"
#include "webkit/compositor_bindings/web_content_layer_impl.h"
#include "webkit/compositor_bindings/web_external_texture_layer_impl.h"
#include "webkit/compositor_bindings/web_float_animation_curve_impl.h"
@@ -87,10 +87,9 @@ WebCompositorSupportImpl::createOutputSurfaceFor3D(
WebKit::WebCompositorOutputSurface*
WebCompositorSupportImpl::createOutputSurfaceForSoftware() {
- scoped_ptr<WebCompositorSupportSoftwareOutputDevice> software_device =
- make_scoped_ptr(new WebCompositorSupportSoftwareOutputDevice);
- return new cc::OutputSurface(
- software_device.PassAs<cc::SoftwareOutputDevice>());
+ scoped_ptr<cc::SoftwareOutputDevice> software_device =
+ make_scoped_ptr(new cc::SoftwareOutputDevice);
+ return new cc::OutputSurface(software_device.Pass());
}
WebLayer* WebCompositorSupportImpl::createLayer() {
diff --git a/webkit/compositor_bindings/web_compositor_support_software_output_device.cc b/webkit/compositor_bindings/web_compositor_support_software_output_device.cc
deleted file mode 100644
index f4aa34b..0000000
--- a/webkit/compositor_bindings/web_compositor_support_software_output_device.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2012 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 "webkit/compositor_bindings/web_compositor_support_software_output_device.h"
-
-namespace webkit {
-
-WebCompositorSupportSoftwareOutputDevice::
- WebCompositorSupportSoftwareOutputDevice() {}
-
-WebCompositorSupportSoftwareOutputDevice::
- ~WebCompositorSupportSoftwareOutputDevice() {}
-
-WebKit::WebImage* WebCompositorSupportSoftwareOutputDevice::Lock(
- bool for_write) {
- DCHECK(device_);
- image_ = device_->accessBitmap(for_write);
- return &image_;
-}
-
-void WebCompositorSupportSoftwareOutputDevice::Unlock() { image_.reset(); }
-
-void WebCompositorSupportSoftwareOutputDevice::DidChangeViewportSize(
- gfx::Size size) {
- if (device_.get() &&
- size.width() == device_->width() &&
- size.height() == device_->height())
- return;
-
- device_ = skia::AdoptRef(new SkDevice(
- SkBitmap::kARGB_8888_Config, size.width(), size.height(), true));
-}
-
-} // namespace webkit
diff --git a/webkit/compositor_bindings/web_compositor_support_software_output_device.h b/webkit/compositor_bindings/web_compositor_support_software_output_device.h
deleted file mode 100644
index fffc250..0000000
--- a/webkit/compositor_bindings/web_compositor_support_software_output_device.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2012 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.
-
-#ifndef WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_SOFTWARE_OUTPUT_DEVICE_H_
-#define WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_SOFTWARE_OUTPUT_DEVICE_H_
-
-#include "base/logging.h"
-#include "cc/software_output_device.h"
-#include "skia/ext/refptr.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h"
-#include "third_party/skia/include/core/SkDevice.h"
-#include "webkit/compositor_bindings/webkit_compositor_bindings_export.h"
-
-namespace webkit {
-
-class WebCompositorSupportSoftwareOutputDevice :
- public cc::SoftwareOutputDevice {
- public:
- WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebCompositorSupportSoftwareOutputDevice();
- virtual ~WebCompositorSupportSoftwareOutputDevice();
-
- virtual WebKit::WebImage* Lock(bool for_write) OVERRIDE;
- virtual void Unlock() OVERRIDE;
-
- virtual void DidChangeViewportSize(gfx::Size size) OVERRIDE;
-
- private:
- skia::RefPtr<SkDevice> device_;
- WebKit::WebImage image_;
-};
-
-} // namespace webkit
-
-#endif // WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_SOFTWARE_OUTPUT_DEVICE_H_
diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc
index ecfe511..1e7f38e 100644
--- a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc
+++ b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc
@@ -13,6 +13,7 @@
#include "cc/layer.h"
#include "cc/layer_tree_host.h"
#include "cc/output_surface.h"
+#include "cc/software_output_device.h"
#include "cc/switches.h"
#include "cc/thread.h"
#include "cc/thread_impl.h"
@@ -24,7 +25,6 @@
#include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "webkit/compositor_bindings/web_compositor_support_impl.h"
-#include "webkit/compositor_bindings/web_compositor_support_software_output_device.h"
#include "webkit/compositor_bindings/web_layer_impl.h"
#include "webkit/compositor_bindings/web_rendering_stats_impl.h"
#include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h"
@@ -184,11 +184,9 @@ WebLayerTreeViewImplForTesting::createOutputSurface() {
break;
}
case webkit_support::SOFTWARE_CONTEXT: {
- using webkit::WebCompositorSupportSoftwareOutputDevice;
- scoped_ptr<WebCompositorSupportSoftwareOutputDevice> software_device =
- make_scoped_ptr(new WebCompositorSupportSoftwareOutputDevice);
- surface.reset(new cc::OutputSurface(
- software_device.PassAs<cc::SoftwareOutputDevice>()));
+ scoped_ptr<cc::SoftwareOutputDevice> software_device =
+ make_scoped_ptr(new cc::SoftwareOutputDevice);
+ surface.reset(new cc::OutputSurface(software_device.Pass()));
break;
}
case webkit_support::MESA_CONTEXT: {