summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-15 23:55:55 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-15 23:55:55 +0000
commit9c9f6bcf24fcc3485ed0d67280fe6239723d5b85 (patch)
treec66eb98ee99e88803a6499dcf4a18b8253ef0ec9
parent8af4d5e43646529448d460cd6031613379b57861 (diff)
downloadchromium_src-9c9f6bcf24fcc3485ed0d67280fe6239723d5b85.zip
chromium_src-9c9f6bcf24fcc3485ed0d67280fe6239723d5b85.tar.gz
chromium_src-9c9f6bcf24fcc3485ed0d67280fe6239723d5b85.tar.bz2
cc: Chromify LayerUpdater
R=danakj@chromium.org BUG=none Review URL: https://chromiumcodereview.appspot.com/12850006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188515 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/bitmap_content_layer_updater.cc12
-rw-r--r--cc/bitmap_content_layer_updater.h10
-rw-r--r--cc/bitmap_skpicture_content_layer_updater.cc8
-rw-r--r--cc/bitmap_skpicture_content_layer_updater.h4
-rw-r--r--cc/caching_bitmap_content_layer_updater.cc10
-rw-r--r--cc/caching_bitmap_content_layer_updater.h6
-rw-r--r--cc/content_layer.cc4
-rw-r--r--cc/content_layer_unittest.cc4
-rw-r--r--cc/image_layer_updater.cc6
-rw-r--r--cc/image_layer_updater.h4
-rw-r--r--cc/layer_updater.cc11
-rw-r--r--cc/layer_updater.h91
-rw-r--r--cc/nine_patch_layer.cc2
-rw-r--r--cc/scrollbar_layer.cc12
-rw-r--r--cc/skpicture_content_layer_updater.cc12
-rw-r--r--cc/skpicture_content_layer_updater.h8
-rw-r--r--cc/test/tiled_layer_test_common.cc12
-rw-r--r--cc/test/tiled_layer_test_common.h6
-rw-r--r--cc/tiled_layer.cc10
19 files changed, 117 insertions, 115 deletions
diff --git a/cc/bitmap_content_layer_updater.cc b/cc/bitmap_content_layer_updater.cc
index 2dd4d29..fc2c05b 100644
--- a/cc/bitmap_content_layer_updater.cc
+++ b/cc/bitmap_content_layer_updater.cc
@@ -23,9 +23,9 @@ BitmapContentLayerUpdater::Resource::~Resource()
{
}
-void BitmapContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*)
+void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats)
{
- updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
+ updater()->updateTexture(*queue, texture(), sourceRect, destOffset, partialUpdate);
}
scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::create(scoped_ptr<LayerPainter> painter)
@@ -43,12 +43,12 @@ BitmapContentLayerUpdater::~BitmapContentLayerUpdater()
{
}
-scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::createResource(PrioritizedResourceManager* manager)
+scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource(PrioritizedResourceManager* manager)
{
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
-void BitmapContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats* stats)
+void BitmapContentLayerUpdater::PrepareToUpdate(gfx::Rect contentRect, gfx::Size tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect* resultingOpaqueRect, RenderingStats* stats)
{
if (m_canvasSize != contentRect.size()) {
m_canvasSize = contentRect.size();
@@ -58,7 +58,7 @@ void BitmapContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, co
if (stats)
stats->totalPixelsRasterized += contentRect.width() * contentRect.height();
- paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats);
+ paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, *resultingOpaqueRect, stats);
}
void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
@@ -75,7 +75,7 @@ void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, Priori
queue.appendFullUpload(upload);
}
-void BitmapContentLayerUpdater::setOpaque(bool opaque)
+void BitmapContentLayerUpdater::SetOpaque(bool opaque)
{
if (opaque != m_opaque) {
m_canvas.reset();
diff --git a/cc/bitmap_content_layer_updater.h b/cc/bitmap_content_layer_updater.h
index 9f6af1c..38f161e 100644
--- a/cc/bitmap_content_layer_updater.h
+++ b/cc/bitmap_content_layer_updater.h
@@ -25,7 +25,7 @@ public:
Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
virtual ~Resource();
- virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*) OVERRIDE;
+ virtual void Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats) OVERRIDE;
private:
BitmapContentLayerUpdater* updater() { return m_updater; }
@@ -35,11 +35,11 @@ public:
static scoped_refptr<BitmapContentLayerUpdater> create(scoped_ptr<LayerPainter>);
- virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
- virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats*) OVERRIDE;
- void updateTexture(ResourceUpdateQueue&, PrioritizedResource*, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
+ virtual scoped_ptr<LayerUpdater::Resource> CreateResource(PrioritizedResourceManager*) OVERRIDE;
+ virtual void PrepareToUpdate(gfx::Rect contentRect, gfx::Size tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect* resultingOpaqueRect, RenderingStats*) OVERRIDE;
+ void updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* resource, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
- virtual void setOpaque(bool) OVERRIDE;
+ virtual void SetOpaque(bool) OVERRIDE;
protected:
explicit BitmapContentLayerUpdater(scoped_ptr<LayerPainter>);
diff --git a/cc/bitmap_skpicture_content_layer_updater.cc b/cc/bitmap_skpicture_content_layer_updater.cc
index dab97b1..0ceffcc 100644
--- a/cc/bitmap_skpicture_content_layer_updater.cc
+++ b/cc/bitmap_skpicture_content_layer_updater.cc
@@ -20,7 +20,7 @@ BitmapSkPictureContentLayerUpdater::Resource::Resource(BitmapSkPictureContentLay
{
}
-void BitmapSkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats* stats)
+void BitmapSkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats)
{
m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height());
m_bitmap.allocPixels();
@@ -37,9 +37,9 @@ void BitmapSkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& q
ResourceUpdate upload = ResourceUpdate::Create(
texture(), &m_bitmap, sourceRect, sourceRect, destOffset);
if (partialUpdate)
- queue.appendPartialUpload(upload);
+ queue->appendPartialUpload(upload);
else
- queue.appendFullUpload(upload);
+ queue->appendFullUpload(upload);
}
scoped_refptr<BitmapSkPictureContentLayerUpdater> BitmapSkPictureContentLayerUpdater::create(scoped_ptr<LayerPainter> painter)
@@ -56,7 +56,7 @@ BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater()
{
}
-scoped_ptr<LayerUpdater::Resource> BitmapSkPictureContentLayerUpdater::createResource(PrioritizedResourceManager* manager)
+scoped_ptr<LayerUpdater::Resource> BitmapSkPictureContentLayerUpdater::CreateResource(PrioritizedResourceManager* manager)
{
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
diff --git a/cc/bitmap_skpicture_content_layer_updater.h b/cc/bitmap_skpicture_content_layer_updater.h
index 60c7745..adbb84d 100644
--- a/cc/bitmap_skpicture_content_layer_updater.h
+++ b/cc/bitmap_skpicture_content_layer_updater.h
@@ -18,7 +18,7 @@ public:
public:
Resource(BitmapSkPictureContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
- virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*) OVERRIDE;
+ virtual void Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats) OVERRIDE;
private:
BitmapSkPictureContentLayerUpdater* updater() { return m_updater; }
@@ -29,7 +29,7 @@ public:
static scoped_refptr<BitmapSkPictureContentLayerUpdater> create(scoped_ptr<LayerPainter>);
- virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
+ virtual scoped_ptr<LayerUpdater::Resource> CreateResource(PrioritizedResourceManager*) OVERRIDE;
void paintContentsRect(SkCanvas*, const gfx::Rect& sourceRect, RenderingStats*);
private:
diff --git a/cc/caching_bitmap_content_layer_updater.cc b/cc/caching_bitmap_content_layer_updater.cc
index 83280bc..dcd4fc6 100644
--- a/cc/caching_bitmap_content_layer_updater.cc
+++ b/cc/caching_bitmap_content_layer_updater.cc
@@ -28,14 +28,14 @@ CachingBitmapContentLayerUpdater::
{
}
-void CachingBitmapContentLayerUpdater::prepareToUpdate(
- const gfx::Rect& content_rect,
- const gfx::Size& tile_size,
+void CachingBitmapContentLayerUpdater::PrepareToUpdate(
+ gfx::Rect content_rect,
+ gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect& resulting_opaque_rect,
+ gfx::Rect* resulting_opaque_rect,
RenderingStats* stats) {
- BitmapContentLayerUpdater::prepareToUpdate(
+ BitmapContentLayerUpdater::PrepareToUpdate(
content_rect,
tile_size,
contents_width_scale,
diff --git a/cc/caching_bitmap_content_layer_updater.h b/cc/caching_bitmap_content_layer_updater.h
index 79f215ce..d1ac7a2 100644
--- a/cc/caching_bitmap_content_layer_updater.h
+++ b/cc/caching_bitmap_content_layer_updater.h
@@ -17,11 +17,11 @@ class CachingBitmapContentLayerUpdater
static scoped_refptr<CachingBitmapContentLayerUpdater> Create(
scoped_ptr<LayerPainter>);
- virtual void prepareToUpdate(const gfx::Rect& content_rect,
- const gfx::Size& tile_size,
+ virtual void PrepareToUpdate(gfx::Rect content_rect,
+ gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect& resulting_opaque_rect,
+ gfx::Rect* resulting_opaque_rect,
RenderingStats*) OVERRIDE;
bool pixelsDidChange() const;
diff --git a/cc/content_layer.cc b/cc/content_layer.cc
index a318b1e..d0c7269 100644
--- a/cc/content_layer.cc
+++ b/cc/content_layer.cc
@@ -98,7 +98,7 @@ void ContentLayer::CreateUpdaterIfNeeded() {
updater_ = BitmapSkPictureContentLayerUpdater::create(painter.Pass());
else
updater_ = BitmapContentLayerUpdater::create(painter.Pass());
- updater_->setOpaque(contents_opaque());
+ updater_->SetOpaque(contents_opaque());
unsigned texture_format =
layer_tree_host()->GetRendererCapabilities().best_texture_format;
@@ -108,7 +108,7 @@ void ContentLayer::CreateUpdaterIfNeeded() {
void ContentLayer::SetContentsOpaque(bool opaque) {
Layer::SetContentsOpaque(opaque);
if (updater_)
- updater_->setOpaque(opaque);
+ updater_->SetOpaque(opaque);
}
} // namespace cc
diff --git a/cc/content_layer_unittest.cc b/cc/content_layer_unittest.cc
index 01a2a00..cbd9746 100644
--- a/cc/content_layer_unittest.cc
+++ b/cc/content_layer_unittest.cc
@@ -43,11 +43,11 @@ TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) {
PassAs<LayerPainter>());
gfx::Rect resulting_opaque_rect;
- updater->prepareToUpdate(content_rect,
+ updater->PrepareToUpdate(content_rect,
gfx::Size(256, 256),
contents_scale,
contents_scale,
- resulting_opaque_rect,
+ &resulting_opaque_rect,
NULL);
EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space),
diff --git a/cc/image_layer_updater.cc b/cc/image_layer_updater.cc
index 621b1eb..910a082 100644
--- a/cc/image_layer_updater.cc
+++ b/cc/image_layer_updater.cc
@@ -18,9 +18,9 @@ ImageLayerUpdater::Resource::~Resource()
{
}
-void ImageLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*)
+void ImageLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats*)
{
- m_updater->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
+ m_updater->updateTexture(*queue, texture(), sourceRect, destOffset, partialUpdate);
}
// static
@@ -29,7 +29,7 @@ scoped_refptr<ImageLayerUpdater> ImageLayerUpdater::create()
return make_scoped_refptr(new ImageLayerUpdater());
}
-scoped_ptr<LayerUpdater::Resource> ImageLayerUpdater::createResource(
+scoped_ptr<LayerUpdater::Resource> ImageLayerUpdater::CreateResource(
PrioritizedResourceManager* manager)
{
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
diff --git a/cc/image_layer_updater.h b/cc/image_layer_updater.h
index 042047aa..7bd040a 100644
--- a/cc/image_layer_updater.h
+++ b/cc/image_layer_updater.h
@@ -19,7 +19,7 @@ public:
Resource(ImageLayerUpdater* updater, scoped_ptr<PrioritizedResource> texture);
virtual ~Resource();
- virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*) OVERRIDE;
+ virtual void Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats) OVERRIDE;
private:
ImageLayerUpdater* m_updater;
@@ -27,7 +27,7 @@ public:
static scoped_refptr<ImageLayerUpdater> create();
- virtual scoped_ptr<LayerUpdater::Resource> createResource(
+ virtual scoped_ptr<LayerUpdater::Resource> CreateResource(
PrioritizedResourceManager*) OVERRIDE;
void updateTexture(ResourceUpdateQueue&, PrioritizedResource*, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
diff --git a/cc/layer_updater.cc b/cc/layer_updater.cc
index 2172952..43073aa 100644
--- a/cc/layer_updater.cc
+++ b/cc/layer_updater.cc
@@ -9,15 +9,8 @@
namespace cc {
LayerUpdater::Resource::Resource(scoped_ptr<PrioritizedResource> texture)
- : m_texture(texture.Pass()) {
-}
+ : texture_(texture.Pass()) {}
-void LayerUpdater::Resource::swapTextureWith(
- scoped_ptr<PrioritizedResource>& texture) {
- m_texture.swap(texture);
-}
-
-LayerUpdater::Resource::~Resource() {
-}
+LayerUpdater::Resource::~Resource() {}
} // namespace cc
diff --git a/cc/layer_updater.h b/cc/layer_updater.h
index ee2287e..af07254 100644
--- a/cc/layer_updater.h
+++ b/cc/layer_updater.h
@@ -8,12 +8,8 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/cc_export.h"
-
-namespace gfx {
-class Rect;
-class Size;
-class Vector2d;
-}
+#include "ui/gfx/rect.h"
+#include "ui/gfx/vector2d.h"
namespace cc {
@@ -24,41 +20,54 @@ class TextureManager;
struct RenderingStats;
class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> {
-public:
- // Allows updaters to store per-resource update properties.
- class CC_EXPORT Resource {
- public:
- virtual ~Resource();
-
- PrioritizedResource* texture() { return m_texture.get(); }
- void swapTextureWith(scoped_ptr<PrioritizedResource>& texture);
- // TODO(reveman): partialUpdate should be a property of this class
- // instead of an argument passed to update().
- virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*) = 0;
- protected:
- explicit Resource(scoped_ptr<PrioritizedResource> texture);
-
- private:
- scoped_ptr<PrioritizedResource> m_texture;
-
- DISALLOW_COPY_AND_ASSIGN(Resource);
- };
-
- LayerUpdater() { }
-
- virtual scoped_ptr<Resource> createResource(PrioritizedResourceManager*) = 0;
- // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater,
- // then this region should be ignored in preference for the entire layer's area.
- virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats*) { }
-
- // Set true by the layer when it is known that the entire output is going to be opaque.
- virtual void setOpaque(bool) { }
-
-protected:
- virtual ~LayerUpdater() { }
-
-private:
- friend class base::RefCounted<LayerUpdater>;
+ public:
+ // Allows updaters to store per-resource update properties.
+ class CC_EXPORT Resource {
+ public:
+ virtual ~Resource();
+
+ PrioritizedResource* texture() { return texture_.get(); }
+ // TODO(reveman): partial_update should be a property of this class
+ // instead of an argument passed to Update().
+ virtual void Update(ResourceUpdateQueue* queue,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset,
+ bool partial_update,
+ RenderingStats* stats) = 0;
+ protected:
+ explicit Resource(scoped_ptr<PrioritizedResource> texture);
+
+ private:
+ scoped_ptr<PrioritizedResource> texture_;
+
+ DISALLOW_COPY_AND_ASSIGN(Resource);
+ };
+
+ LayerUpdater() {}
+
+ virtual scoped_ptr<Resource> CreateResource(
+ PrioritizedResourceManager* manager) = 0;
+ // The |resulting_opaque_rect| gives back a region of the layer that was
+ // painted opaque. If the layer is marked opaque in the updater, then this
+ // region should be ignored in preference for the entire layer's area.
+ virtual void PrepareToUpdate(gfx::Rect content_rect,
+ gfx::Size tile_size,
+ float contents_width_scale,
+ float contents_height_scale,
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {}
+
+ // Set true by the layer when it is known that the entire output is going to
+ // be opaque.
+ virtual void SetOpaque(bool opaque) {}
+
+ protected:
+ virtual ~LayerUpdater() {}
+
+ private:
+ friend class base::RefCounted<LayerUpdater>;
+
+ DISALLOW_COPY_AND_ASSIGN(LayerUpdater);
};
} // namespace cc
diff --git a/cc/nine_patch_layer.cc b/cc/nine_patch_layer.cc
index 69c4518..51e6196 100644
--- a/cc/nine_patch_layer.cc
+++ b/cc/nine_patch_layer.cc
@@ -88,7 +88,7 @@ void NinePatchLayer::CreateResource() {
needs_display_ = false;
if (!resource_) {
- resource_ = updater_->createResource(
+ resource_ = updater_->CreateResource(
layer_tree_host()->contents_texture_manager());
}
}
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index cd7b5d0..d5b1240 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -274,7 +274,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() {
WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>());
}
if (!back_track_) {
- back_track_ = back_track_updater_->createResource(
+ back_track_ = back_track_updater_->CreateResource(
layer_tree_host()->contents_texture_manager());
}
@@ -290,7 +290,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() {
WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>());
}
if (!fore_track_) {
- fore_track_ = fore_track_updater_->createResource(
+ fore_track_ = fore_track_updater_->CreateResource(
layer_tree_host()->contents_texture_manager());
}
}
@@ -302,7 +302,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() {
geometry_.get()).PassAs<LayerPainter>());
}
if (!thumb_) {
- thumb_ = thumb_updater_->createResource(
+ thumb_ = thumb_updater_->CreateResource(
layer_tree_host()->contents_texture_manager());
}
}
@@ -329,11 +329,11 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
// Paint and upload the entire part.
gfx::Rect painted_opaque_rect;
- painter->prepareToUpdate(rect,
+ painter->PrepareToUpdate(rect,
rect.size(),
contents_scale_x(),
contents_scale_y(),
- painted_opaque_rect,
+ &painted_opaque_rect,
stats);
if (!painter->pixelsDidChange() &&
resource->texture()->haveBackingTexture()) {
@@ -348,7 +348,7 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
resource->texture()->returnBackingTexture();
gfx::Vector2d dest_offset(0, 0);
- resource->update(*queue, rect, dest_offset, partial_updates_allowed, stats);
+ resource->Update(queue, rect, dest_offset, partial_updates_allowed, stats);
}
gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect(
diff --git a/cc/skpicture_content_layer_updater.cc b/cc/skpicture_content_layer_updater.cc
index 819e03f..db96ba7 100644
--- a/cc/skpicture_content_layer_updater.cc
+++ b/cc/skpicture_content_layer_updater.cc
@@ -22,9 +22,9 @@ SkPictureContentLayerUpdater::Resource::~Resource()
{
}
-void SkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*)
+void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats*)
{
- updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
+ updater()->updateTexture(*queue, texture(), sourceRect, destOffset, partialUpdate);
}
SkPictureContentLayerUpdater::SkPictureContentLayerUpdater(scoped_ptr<LayerPainter> painter)
@@ -42,15 +42,15 @@ scoped_refptr<SkPictureContentLayerUpdater> SkPictureContentLayerUpdater::create
return make_scoped_refptr(new SkPictureContentLayerUpdater(painter.Pass()));
}
-scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::createResource(PrioritizedResourceManager* manager)
+scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource(PrioritizedResourceManager* manager)
{
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
-void SkPictureContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats* stats)
+void SkPictureContentLayerUpdater::PrepareToUpdate(gfx::Rect contentRect, gfx::Size, float contentsWidthScale, float contentsHeightScale, gfx::Rect* resultingOpaqueRect, RenderingStats* stats)
{
SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height());
- paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats);
+ paintContents(canvas, contentRect, contentsWidthScale, contentsHeightScale, *resultingOpaqueRect, stats);
m_picture.endRecording();
}
@@ -70,7 +70,7 @@ void SkPictureContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, Pri
queue.appendFullUpload(upload);
}
-void SkPictureContentLayerUpdater::setOpaque(bool opaque)
+void SkPictureContentLayerUpdater::SetOpaque(bool opaque)
{
m_layerIsOpaque = opaque;
}
diff --git a/cc/skpicture_content_layer_updater.h b/cc/skpicture_content_layer_updater.h
index 840eba6..93a4b5f 100644
--- a/cc/skpicture_content_layer_updater.h
+++ b/cc/skpicture_content_layer_updater.h
@@ -27,7 +27,7 @@ public:
Resource(SkPictureContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
virtual ~Resource();
- virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*) OVERRIDE;
+ virtual void Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats) OVERRIDE;
private:
SkPictureContentLayerUpdater* updater() { return m_updater; }
@@ -37,14 +37,14 @@ public:
static scoped_refptr<SkPictureContentLayerUpdater> create(scoped_ptr<LayerPainter>);
- virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
- virtual void setOpaque(bool) OVERRIDE;
+ virtual scoped_ptr<LayerUpdater::Resource> CreateResource(PrioritizedResourceManager*) OVERRIDE;
+ virtual void SetOpaque(bool) OVERRIDE;
protected:
explicit SkPictureContentLayerUpdater(scoped_ptr<LayerPainter>);
virtual ~SkPictureContentLayerUpdater();
- virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats*) OVERRIDE;
+ virtual void PrepareToUpdate(gfx::Rect contentRect, gfx::Size tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect* resultingOpaqueRect, RenderingStats*) OVERRIDE;
void drawPicture(SkCanvas*);
void updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index 5e7ebbb..1a779ba 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -27,15 +27,15 @@ FakeLayerUpdater::Resource::~Resource()
{
}
-void FakeLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect&, const gfx::Vector2d&, bool partialUpdate, RenderingStats*)
+void FakeLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats)
{
const gfx::Rect rect(0, 0, 10, 10);
ResourceUpdate upload = ResourceUpdate::Create(
texture(), &m_bitmap, rect, rect, gfx::Vector2d());
if (partialUpdate)
- queue.appendPartialUpload(upload);
+ queue->appendPartialUpload(upload);
else
- queue.appendFullUpload(upload);
+ queue->appendFullUpload(upload);
m_layer->update();
}
@@ -50,7 +50,7 @@ FakeLayerUpdater::~FakeLayerUpdater()
{
}
-void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, RenderingStats*)
+void FakeLayerUpdater::PrepareToUpdate(gfx::Rect contentRect, gfx::Size, float, float, gfx::Rect* resultingOpaqueRect, RenderingStats*)
{
m_prepareCount++;
m_lastUpdateRect = contentRect;
@@ -59,7 +59,7 @@ void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
m_rectToInvalidate = gfx::Rect();
m_layer = NULL;
}
- resultingOpaqueRect = m_opaquePaintRect;
+ *resultingOpaqueRect = m_opaquePaintRect;
}
void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer)
@@ -68,7 +68,7 @@ void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer
m_layer = layer;
}
-scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedResourceManager* manager)
+scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::CreateResource(PrioritizedResourceManager* manager)
{
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
}
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index 1c8fd1c..17f802b 100644
--- a/cc/test/tiled_layer_test_common.h
+++ b/cc/test/tiled_layer_test_common.h
@@ -28,7 +28,7 @@ public:
Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedResource>);
virtual ~Resource();
- virtual void update(cc::ResourceUpdateQueue&, const gfx::Rect&, const gfx::Vector2d&, bool, cc::RenderingStats*) OVERRIDE;
+ virtual void Update(cc::ResourceUpdateQueue* queue, gfx::Rect source_rect, gfx::Vector2d dest_offset, bool partial_update, cc::RenderingStats* stats) OVERRIDE;
private:
FakeLayerUpdater* m_layer;
@@ -37,9 +37,9 @@ public:
FakeLayerUpdater();
- virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::PrioritizedResourceManager*) OVERRIDE;
+ virtual scoped_ptr<cc::LayerUpdater::Resource> CreateResource(cc::PrioritizedResourceManager* resource) OVERRIDE;
- virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, cc::RenderingStats*) OVERRIDE;
+ virtual void PrepareToUpdate(gfx::Rect content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, gfx::Rect* resulting_opaque_rect, RenderingStats* stats) OVERRIDE;
// Sets the rect to invalidate during the next call to prepareToUpdate(). After the next
// call to prepareToUpdate() the rect is reset.
void setRectToInvalidate(const gfx::Rect&, FakeTiledLayer*);
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc
index aea900e..cc97967 100644
--- a/cc/tiled_layer.cc
+++ b/cc/tiled_layer.cc
@@ -263,7 +263,7 @@ UpdatableTile* TiledLayer::CreateTile(int i, int j) {
CreateUpdaterIfNeeded();
scoped_ptr<UpdatableTile> tile(
- UpdatableTile::Create(Updater()->createResource(ResourceManager())));
+ UpdatableTile::Create(Updater()->CreateResource(ResourceManager())));
tile->managed_resource()->setDimensions(tiler_->tileSize(), texture_format_);
UpdatableTile* added_tile = tile.get();
@@ -479,11 +479,11 @@ void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect,
// hold the updater alive until the paint completes.
scoped_refptr<LayerUpdater> protector(Updater());
gfx::Rect painted_opaque_rect;
- Updater()->prepareToUpdate(paint_rect,
+ Updater()->PrepareToUpdate(paint_rect,
tiler_->tileSize(),
1.f / width_scale,
1.f / height_scale,
- painted_opaque_rect,
+ &painted_opaque_rect,
stats);
for (int j = top; j <= bottom; ++j) {
@@ -548,8 +548,8 @@ void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect,
CHECK_LE(paint_offset.x() + source_rect.width(), paint_rect.width());
CHECK_LE(paint_offset.y() + source_rect.height(), paint_rect.height());
- tile->updater_resource()->update(
- *queue, source_rect, dest_offset, tile->partial_update, stats);
+ tile->updater_resource()->Update(
+ queue, source_rect, dest_offset, tile->partial_update, stats);
if (occlusion) {
occlusion->overdraw_metrics()->
DidUpload(gfx::Transform(), source_rect, tile->opaqueRect());