summaryrefslogtreecommitdiffstats
path: root/cc/bitmap_content_layer_updater.cc
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-17 21:41:13 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-17 21:41:13 +0000
commitfdb5bf603b530aa06c77850fe3b289445a75b836 (patch)
treec6092c8d80abb59c213e84b671327515a9014ff6 /cc/bitmap_content_layer_updater.cc
parentfa4b57f767c80add910ff81565d9217dfdc53386 (diff)
downloadchromium_src-fdb5bf603b530aa06c77850fe3b289445a75b836.zip
chromium_src-fdb5bf603b530aa06c77850fe3b289445a75b836.tar.gz
chromium_src-fdb5bf603b530aa06c77850fe3b289445a75b836.tar.bz2
cc: Chromify all the layer updaters
R=danakj@chromium.org BUG=none Review URL: https://chromiumcodereview.appspot.com/12636008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188653 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/bitmap_content_layer_updater.cc')
-rw-r--r--cc/bitmap_content_layer_updater.cc127
1 files changed, 70 insertions, 57 deletions
diff --git a/cc/bitmap_content_layer_updater.cc b/cc/bitmap_content_layer_updater.cc
index fc2c05b..ce456cb 100644
--- a/cc/bitmap_content_layer_updater.cc
+++ b/cc/bitmap_content_layer_updater.cc
@@ -13,75 +13,88 @@
namespace cc {
-BitmapContentLayerUpdater::Resource::Resource(BitmapContentLayerUpdater* updater, scoped_ptr<PrioritizedResource> texture)
- : LayerUpdater::Resource(texture.Pass())
- , m_updater(updater)
-{
+BitmapContentLayerUpdater::Resource::Resource(
+ BitmapContentLayerUpdater* updater,
+ scoped_ptr<PrioritizedResource> texture)
+ : LayerUpdater::Resource(texture.Pass()), updater_(updater) {}
+
+BitmapContentLayerUpdater::Resource::~Resource() {}
+
+void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset,
+ bool partial_update,
+ RenderingStats* stats) {
+ updater_->UpdateTexture(
+ queue, texture(), source_rect, dest_offset, partial_update);
}
-BitmapContentLayerUpdater::Resource::~Resource()
-{
+scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::Create(
+ scoped_ptr<LayerPainter> painter) {
+ return make_scoped_refptr(new BitmapContentLayerUpdater(painter.Pass()));
}
-void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, gfx::Rect sourceRect, gfx::Vector2d destOffset, bool partialUpdate, RenderingStats* stats)
-{
- updater()->updateTexture(*queue, texture(), sourceRect, destOffset, partialUpdate);
-}
-
-scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::create(scoped_ptr<LayerPainter> painter)
-{
- return make_scoped_refptr(new BitmapContentLayerUpdater(painter.Pass()));
-}
-
-BitmapContentLayerUpdater::BitmapContentLayerUpdater(scoped_ptr<LayerPainter> painter)
- : ContentLayerUpdater(painter.Pass())
- , m_opaque(false)
-{
-}
+BitmapContentLayerUpdater::BitmapContentLayerUpdater(
+ scoped_ptr<LayerPainter> painter)
+ : ContentLayerUpdater(painter.Pass()), opaque_(false) {}
-BitmapContentLayerUpdater::~BitmapContentLayerUpdater()
-{
-}
+BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {}
-scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource(PrioritizedResourceManager* manager)
-{
- return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
+scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource(
+ PrioritizedResourceManager* manager) {
+ return scoped_ptr<LayerUpdater::Resource>(
+ new Resource(this, PrioritizedResource::create(manager)));
}
-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();
- m_canvas = make_scoped_ptr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_canvasSize.height(), m_opaque));
- }
-
- if (stats)
- stats->totalPixelsRasterized += contentRect.width() * contentRect.height();
-
- paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, *resultingOpaqueRect, stats);
+void BitmapContentLayerUpdater::PrepareToUpdate(
+ gfx::Rect content_rect,
+ gfx::Size tile_size,
+ float contents_width_scale,
+ float contents_height_scale,
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {
+ if (canvas_size_ != content_rect.size()) {
+ canvas_size_ = content_rect.size();
+ canvas_ = make_scoped_ptr(skia::CreateBitmapCanvas(
+ canvas_size_.width(), canvas_size_.height(), opaque_));
+ }
+
+ if (stats) {
+ stats->totalPixelsRasterized +=
+ content_rect.width() * content_rect.height();
+ }
+
+ PaintContents(canvas_.get(),
+ content_rect,
+ contents_width_scale,
+ contents_height_scale,
+ resulting_opaque_rect,
+ stats);
}
-void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
-{
- ResourceUpdate upload = ResourceUpdate::Create(
- texture,
- &m_canvas->getDevice()->accessBitmap(false),
- contentRect(),
- sourceRect,
- destOffset);
- if (partialUpdate)
- queue.appendPartialUpload(upload);
- else
- queue.appendFullUpload(upload);
+void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
+ PrioritizedResource* texture,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset,
+ bool partial_update) {
+ ResourceUpdate upload =
+ ResourceUpdate::Create(texture,
+ &canvas_->getDevice()->accessBitmap(false),
+ content_rect(),
+ source_rect,
+ dest_offset);
+ if (partial_update)
+ queue->appendPartialUpload(upload);
+ else
+ queue->appendFullUpload(upload);
}
-void BitmapContentLayerUpdater::SetOpaque(bool opaque)
-{
- if (opaque != m_opaque) {
- m_canvas.reset();
- m_canvasSize = gfx::Size();
- }
- m_opaque = opaque;
+void BitmapContentLayerUpdater::SetOpaque(bool opaque) {
+ if (opaque != opaque_) {
+ canvas_.reset();
+ canvas_size_ = gfx::Size();
+ }
+ opaque_ = opaque;
}
} // namespace cc