diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 09:48:18 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 09:48:18 +0000 |
commit | 5be57366f46238abee983be39f50e503212f3ba3 (patch) | |
tree | be068256619b18f50670207092dbaf619e01d809 | |
parent | 2e237f3cc53d7a4d027fa017af1e1dfbd62a8eea (diff) | |
download | chromium_src-5be57366f46238abee983be39f50e503212f3ba3.zip chromium_src-5be57366f46238abee983be39f50e503212f3ba3.tar.gz chromium_src-5be57366f46238abee983be39f50e503212f3ba3.tar.bz2 |
cc: Remove FrameBufferSkPictureCanvasLayerTextureUpdater class.
SkPictureCanvasLayerTextureUpdater is all we need for accelerated
painting. Add SkPictureCanvasLayerTextureUpdater::Texture and
make SkPictureCanvasLayerTextureUpdater instantiable.
BUG=
TEST=cc_unittests
Review URL: https://chromiumcodereview.appspot.com/11236048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163534 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/cc.gyp | 2 | ||||
-rw-r--r-- | cc/content_layer.cc | 3 | ||||
-rw-r--r-- | cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc | 47 | ||||
-rw-r--r-- | cc/frame_buffer_skpicture_canvas_layer_texture_updater.h | 40 | ||||
-rw-r--r-- | cc/skpicture_canvas_layer_texture_updater.cc | 25 | ||||
-rw-r--r-- | cc/skpicture_canvas_layer_texture_updater.h | 16 |
6 files changed, 42 insertions, 91 deletions
@@ -177,8 +177,6 @@ 'content_layer_client.h', 'delegated_renderer_layer.cc', 'delegated_renderer_layer.h', - 'frame_buffer_skpicture_canvas_layer_texture_updater.cc', - 'frame_buffer_skpicture_canvas_layer_texture_updater.h', 'geometry_binding.cc', 'geometry_binding.h', 'heads_up_display_layer.cc', diff --git a/cc/content_layer.cc b/cc/content_layer.cc index c4be3c8..f60b3ec 100644 --- a/cc/content_layer.cc +++ b/cc/content_layer.cc @@ -11,7 +11,6 @@ #include "cc/bitmap_canvas_layer_texture_updater.h" #include "cc/bitmap_skpicture_canvas_layer_texture_updater.h" #include "cc/content_layer_client.h" -#include "cc/frame_buffer_skpicture_canvas_layer_texture_updater.h" #include "cc/layer_painter.h" #include "cc/layer_tree_host.h" #include "cc/settings.h" @@ -89,7 +88,7 @@ void ContentLayer::createTextureUpdaterIfNeeded() return; scoped_ptr<LayerPainter> painter = ContentLayerPainter::create(m_client).PassAs<LayerPainter>(); if (layerTreeHost()->settings().acceleratePainting) - m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.Pass()); + m_textureUpdater = SkPictureCanvasLayerTextureUpdater::create(painter.Pass()); else if (Settings::perTilePaintingEnabled()) m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.Pass()); else diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc deleted file mode 100644 index 39983b9..0000000 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2011 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 "config.h" - -#include "cc/frame_buffer_skpicture_canvas_layer_texture_updater.h" - -#include "cc/layer_painter.h" - -namespace cc { - -FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::Texture(FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<PrioritizedTexture> texture) - : LayerTextureUpdater::Texture(texture.Pass()) - , m_textureUpdater(textureUpdater) -{ -} - -FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::~Texture() -{ -} - -void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::update(TextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) -{ - textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate); -} - -scoped_refptr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainter> painter) -{ - return make_scoped_refptr(new FrameBufferSkPictureCanvasLayerTextureUpdater(painter.Pass())); -} - -FrameBufferSkPictureCanvasLayerTextureUpdater::FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter> painter) - : SkPictureCanvasLayerTextureUpdater(painter.Pass()) -{ -} - -FrameBufferSkPictureCanvasLayerTextureUpdater::~FrameBufferSkPictureCanvasLayerTextureUpdater() -{ -} - -scoped_ptr<LayerTextureUpdater::Texture> FrameBufferSkPictureCanvasLayerTextureUpdater::createTexture(PrioritizedTextureManager* manager) -{ - return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, PrioritizedTexture::create(manager))); -} - -} // namespace cc diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h deleted file mode 100644 index c55a567..0000000 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2011 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 FrameBufferSkPictureCanvasLayerTextureUpdater_h -#define FrameBufferSkPictureCanvasLayerTextureUpdater_h - -#include "cc/skpicture_canvas_layer_texture_updater.h" - -namespace cc { - -// This class records the contentRect into an SkPicture, then uses accelerated -// drawing to update the texture. The accelerated drawing goes to an -// intermediate framebuffer and then is copied to the destination texture once done. -class FrameBufferSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { -public: - class Texture : public LayerTextureUpdater::Texture { - public: - Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, scoped_ptr<PrioritizedTexture>); - virtual ~Texture(); - - virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; - - private: - FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } - - FrameBufferSkPictureCanvasLayerTextureUpdater* m_textureUpdater; - }; - - static scoped_refptr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainter>); - - virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(PrioritizedTextureManager*) OVERRIDE; - -private: - explicit FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); - virtual ~FrameBufferSkPictureCanvasLayerTextureUpdater(); -}; -} // namespace cc -#endif // FrameBufferSkPictureCanvasLayerTextureUpdater_h diff --git a/cc/skpicture_canvas_layer_texture_updater.cc b/cc/skpicture_canvas_layer_texture_updater.cc index af62f43..1bb20df 100644 --- a/cc/skpicture_canvas_layer_texture_updater.cc +++ b/cc/skpicture_canvas_layer_texture_updater.cc @@ -13,6 +13,21 @@ namespace cc { +SkPictureCanvasLayerTextureUpdater::Texture::Texture(SkPictureCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<PrioritizedTexture> texture) + : LayerTextureUpdater::Texture(texture.Pass()) + , m_textureUpdater(textureUpdater) +{ +} + +SkPictureCanvasLayerTextureUpdater::Texture::~Texture() +{ +} + +void SkPictureCanvasLayerTextureUpdater::Texture::update(TextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) +{ + textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate); +} + SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter> painter) : CanvasLayerTextureUpdater(painter.Pass()) , m_layerIsOpaque(false) @@ -23,6 +38,16 @@ SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() { } +scoped_refptr<SkPictureCanvasLayerTextureUpdater> SkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainter> painter) +{ + return make_scoped_refptr(new SkPictureCanvasLayerTextureUpdater(painter.Pass())); +} + +scoped_ptr<LayerTextureUpdater::Texture> SkPictureCanvasLayerTextureUpdater::createTexture(PrioritizedTextureManager* manager) +{ + return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, PrioritizedTexture::create(manager))); +} + void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats& stats) { SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height()); diff --git a/cc/skpicture_canvas_layer_texture_updater.h b/cc/skpicture_canvas_layer_texture_updater.h index 0b9701cb..42709cb 100644 --- a/cc/skpicture_canvas_layer_texture_updater.h +++ b/cc/skpicture_canvas_layer_texture_updater.h @@ -22,6 +22,22 @@ class LayerPainter; // implementations. class SkPictureCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { public: + class Texture : public LayerTextureUpdater::Texture { + public: + Texture(SkPictureCanvasLayerTextureUpdater*, scoped_ptr<PrioritizedTexture>); + virtual ~Texture(); + + virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; + + private: + SkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } + + SkPictureCanvasLayerTextureUpdater* m_textureUpdater; + }; + + static scoped_refptr<SkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainter>); + + virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(PrioritizedTextureManager*) OVERRIDE; virtual void setOpaque(bool) OVERRIDE; protected: |