summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-31 20:52:25 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-31 20:52:25 +0000
commitf809d3bb86532d666d6094497b5b7f93f3b32a9e (patch)
treee37a05eb364b08446fbdd4a11e77a79eabf48d02
parentd388fe22c8c1c6e80c990be37fe067634bfed7a9 (diff)
downloadchromium_src-f809d3bb86532d666d6094497b5b7f93f3b32a9e.zip
chromium_src-f809d3bb86532d666d6094497b5b7f93f3b32a9e.tar.gz
chromium_src-f809d3bb86532d666d6094497b5b7f93f3b32a9e.tar.bz2
Use gfx:: Geometry types for the resource provider and layer updater classes.
This depends on the gfx::Vector2d class from https://codereview.chromium.org/11269022/ Covered by existing tests, just changing data types. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11266030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165225 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/bitmap_content_layer_updater.cc8
-rw-r--r--cc/bitmap_content_layer_updater.h8
-rw-r--r--cc/bitmap_skpicture_content_layer_updater.cc4
-rw-r--r--cc/bitmap_skpicture_content_layer_updater.h4
-rw-r--r--cc/caching_bitmap_content_layer_updater.cc6
-rw-r--r--cc/caching_bitmap_content_layer_updater.h6
-rw-r--r--cc/content_layer.cc2
-rw-r--r--cc/content_layer.h4
-rw-r--r--cc/content_layer_client.h9
-rw-r--r--cc/content_layer_unittest.cc22
-rw-r--r--cc/content_layer_updater.cc19
-rw-r--r--cc/content_layer_updater.h6
-rw-r--r--cc/gl_renderer.cc2
-rw-r--r--cc/heads_up_display_layer_impl.cc4
-rw-r--r--cc/image_layer.cc12
-rw-r--r--cc/layer_painter.h10
-rw-r--r--cc/layer_tree_host_common_unittest.cc2
-rw-r--r--cc/layer_tree_host_unittest.cc9
-rw-r--r--cc/layer_unittest.cc2
-rw-r--r--cc/layer_updater.h11
-rw-r--r--cc/prioritized_texture.cc14
-rw-r--r--cc/prioritized_texture.h21
-rw-r--r--cc/prioritized_texture_manager.cc2
-rw-r--r--cc/prioritized_texture_manager.h7
-rw-r--r--cc/prioritized_texture_unittest.cc2
-rw-r--r--cc/resource_provider.cc19
-rw-r--r--cc/resource_provider.h24
-rw-r--r--cc/resource_provider_unittest.cc68
-rw-r--r--cc/resource_update.cc16
-rw-r--r--cc/resource_update.h21
-rw-r--r--cc/resource_update_controller.cc16
-rw-r--r--cc/resource_update_controller_unittest.cc10
-rw-r--r--cc/scrollbar_layer.cc11
-rw-r--r--cc/skpicture_content_layer_updater.cc6
-rw-r--r--cc/skpicture_content_layer_updater.h6
-rw-r--r--cc/software_renderer_unittest.cc4
-rw-r--r--cc/stubs/int_rect.h3
-rw-r--r--cc/test/tiled_layer_test_common.cc8
-rw-r--r--cc/test/tiled_layer_test_common.h12
-rw-r--r--cc/texture.cc6
-rw-r--r--cc/texture.h12
-rw-r--r--cc/texture_uploader.cc68
-rw-r--r--cc/texture_uploader.h35
-rw-r--r--cc/texture_uploader_unittest.cc8
-rw-r--r--cc/tiled_layer.cc12
-rw-r--r--cc/tiled_layer_unittest.cc8
-rw-r--r--cc/video_layer_impl.cc4
-rw-r--r--webkit/compositor_bindings/web_content_layer_impl.cc6
-rw-r--r--webkit/compositor_bindings/web_content_layer_impl.h2
49 files changed, 300 insertions, 281 deletions
diff --git a/cc/bitmap_content_layer_updater.cc b/cc/bitmap_content_layer_updater.cc
index 66828ff..3ff4ba6 100644
--- a/cc/bitmap_content_layer_updater.cc
+++ b/cc/bitmap_content_layer_updater.cc
@@ -23,7 +23,7 @@ BitmapContentLayerUpdater::Resource::~Resource()
{
}
-void BitmapContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&)
+void BitmapContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&)
{
updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
}
@@ -48,7 +48,7 @@ scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::createResource(Pri
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
}
-void BitmapContentLayerUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats& stats)
+void BitmapContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const 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 IntRect& contentRect, cons
paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect, stats);
}
-void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate)
+void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
{
ResourceUpdate upload = ResourceUpdate::Create(
texture,
@@ -76,7 +76,7 @@ void BitmapContentLayerUpdater::setOpaque(bool opaque)
{
if (opaque != m_opaque) {
m_canvas.reset();
- m_canvasSize = IntSize();
+ m_canvasSize = gfx::Size();
}
m_opaque = opaque;
}
diff --git a/cc/bitmap_content_layer_updater.h b/cc/bitmap_content_layer_updater.h
index cdac5be..da14817 100644
--- a/cc/bitmap_content_layer_updater.h
+++ b/cc/bitmap_content_layer_updater.h
@@ -24,7 +24,7 @@ public:
Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedTexture>);
virtual ~Resource();
- virtual void update(ResourceUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
+ virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
private:
BitmapContentLayerUpdater* updater() { return m_updater; }
@@ -35,8 +35,8 @@ public:
static scoped_refptr<BitmapContentLayerUpdater> create(scoped_ptr<LayerPainter>);
virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedTextureManager*) OVERRIDE;
- virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&) OVERRIDE;
- void updateTexture(ResourceUpdateQueue&, PrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate);
+ virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats&) OVERRIDE;
+ void updateTexture(ResourceUpdateQueue&, PrioritizedTexture*, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
virtual void setOpaque(bool) OVERRIDE;
@@ -45,7 +45,7 @@ protected:
virtual ~BitmapContentLayerUpdater();
scoped_ptr<SkCanvas> m_canvas;
- IntSize m_canvasSize;
+ gfx::Size m_canvasSize;
bool m_opaque;
};
diff --git a/cc/bitmap_skpicture_content_layer_updater.cc b/cc/bitmap_skpicture_content_layer_updater.cc
index 6efc9ed..f035aab 100644
--- a/cc/bitmap_skpicture_content_layer_updater.cc
+++ b/cc/bitmap_skpicture_content_layer_updater.cc
@@ -21,7 +21,7 @@ BitmapSkPictureContentLayerUpdater::Resource::Resource(BitmapSkPictureContentLay
{
}
-void BitmapSkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats& stats)
+void BitmapSkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats& stats)
{
m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height());
m_bitmap.allocPixels();
@@ -59,7 +59,7 @@ scoped_ptr<LayerUpdater::Resource> BitmapSkPictureContentLayerUpdater::createRes
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
}
-void BitmapSkPictureContentLayerUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect, RenderingStats& stats)
+void BitmapSkPictureContentLayerUpdater::paintContentsRect(SkCanvas* canvas, const gfx::Rect& sourceRect, RenderingStats& stats)
{
// Translate the origin of contentRect to that of sourceRect.
canvas->translate(contentRect().x() - sourceRect.x(),
diff --git a/cc/bitmap_skpicture_content_layer_updater.h b/cc/bitmap_skpicture_content_layer_updater.h
index cd52b46..7b2bf1fb 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<PrioritizedTexture>);
- virtual void update(ResourceUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
+ virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
private:
BitmapSkPictureContentLayerUpdater* updater() { return m_updater; }
@@ -30,7 +30,7 @@ public:
static scoped_refptr<BitmapSkPictureContentLayerUpdater> create(scoped_ptr<LayerPainter>);
virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedTextureManager*) OVERRIDE;
- void paintContentsRect(SkCanvas*, const IntRect& sourceRect, RenderingStats&);
+ void paintContentsRect(SkCanvas*, const gfx::Rect& sourceRect, RenderingStats&);
private:
explicit BitmapSkPictureContentLayerUpdater(scoped_ptr<LayerPainter>);
diff --git a/cc/caching_bitmap_content_layer_updater.cc b/cc/caching_bitmap_content_layer_updater.cc
index 3e3d058..3c538b8 100644
--- a/cc/caching_bitmap_content_layer_updater.cc
+++ b/cc/caching_bitmap_content_layer_updater.cc
@@ -30,11 +30,11 @@ CachingBitmapContentLayerUpdater::
}
void CachingBitmapContentLayerUpdater::prepareToUpdate(
- const IntRect& content_rect,
- const IntSize& tile_size,
+ const gfx::Rect& content_rect,
+ const gfx::Size& tile_size,
float contents_width_scale,
float contents_height_scale,
- IntRect& resulting_opaque_rect,
+ gfx::Rect& resulting_opaque_rect,
RenderingStats& stats) {
BitmapContentLayerUpdater::prepareToUpdate(content_rect,
tile_size,
diff --git a/cc/caching_bitmap_content_layer_updater.h b/cc/caching_bitmap_content_layer_updater.h
index 334a26e..f7be2ee 100644
--- a/cc/caching_bitmap_content_layer_updater.h
+++ b/cc/caching_bitmap_content_layer_updater.h
@@ -16,11 +16,11 @@ class CachingBitmapContentLayerUpdater
static scoped_refptr<CachingBitmapContentLayerUpdater> Create(
scoped_ptr<LayerPainter>);
- virtual void prepareToUpdate(const IntRect& content_rect,
- const IntSize& tile_size,
+ virtual void prepareToUpdate(const gfx::Rect& content_rect,
+ const gfx::Size& tile_size,
float contents_width_scale,
float contents_height_scale,
- IntRect& 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 a8e10e6..0cf5471 100644
--- a/cc/content_layer.cc
+++ b/cc/content_layer.cc
@@ -27,7 +27,7 @@ scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient*
return make_scoped_ptr(new ContentLayerPainter(client));
}
-void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, FloatRect& opaque)
+void ContentLayerPainter::paint(SkCanvas* canvas, const gfx::Rect& contentRect, gfx::RectF& opaque)
{
base::TimeTicks paintStart = base::TimeTicks::HighResNow();
m_client->paintContents(canvas, contentRect, opaque);
diff --git a/cc/content_layer.h b/cc/content_layer.h
index 96319ba..4b0b905 100644
--- a/cc/content_layer.h
+++ b/cc/content_layer.h
@@ -14,15 +14,13 @@ class SkCanvas;
namespace cc {
class ContentLayerClient;
-class FloatRect;
-class IntRect;
class LayerUpdater;
class ContentLayerPainter : public LayerPainter {
public:
static scoped_ptr<ContentLayerPainter> create(ContentLayerClient*);
- virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE;
+ virtual void paint(SkCanvas*, const gfx::Rect& contentRect, gfx::RectF& opaque) OVERRIDE;
private:
explicit ContentLayerPainter(ContentLayerClient*);
diff --git a/cc/content_layer_client.h b/cc/content_layer_client.h
index 1dbb1a9..f2bd52a 100644
--- a/cc/content_layer_client.h
+++ b/cc/content_layer_client.h
@@ -7,13 +7,16 @@
class SkCanvas;
+namespace gfx {
+class Rect;
+class RectF;
+}
+
namespace cc {
-class FloatRect;
-class IntRect;
class ContentLayerClient {
public:
- virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0;
+ virtual void paintContents(SkCanvas*, const gfx::Rect& clip, gfx::RectF& opaque) = 0;
protected:
virtual ~ContentLayerClient() { }
diff --git a/cc/content_layer_unittest.cc b/cc/content_layer_unittest.cc
index 3287aeb..8eb9960 100644
--- a/cc/content_layer_unittest.cc
+++ b/cc/content_layer_unittest.cc
@@ -12,6 +12,7 @@
#include "cc/test/geometry_test_utils.h"
#include "skia/ext/platform_canvas.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/rect_conversions.h"
#include <public/WebFloatRect.h>
#include <public/WebRect.h>
@@ -22,35 +23,34 @@ namespace {
class MockContentLayerClient : public ContentLayerClient {
public:
- explicit MockContentLayerClient(IntRect opaqueLayerRect)
+ explicit MockContentLayerClient(gfx::Rect opaqueLayerRect)
: m_opaqueLayerRect(opaqueLayerRect)
{
}
- virtual void paintContents(SkCanvas*, const IntRect&, FloatRect& opaque) OVERRIDE
+ virtual void paintContents(SkCanvas*, const gfx::Rect&, gfx::RectF& opaque) OVERRIDE
{
- opaque = FloatRect(m_opaqueLayerRect);
+ opaque = gfx::RectF(m_opaqueLayerRect);
}
private:
- IntRect m_opaqueLayerRect;
+ gfx::Rect m_opaqueLayerRect;
};
TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale)
{
float contentsScale = 2;
- IntRect contentRect(10, 10, 100, 100);
- IntRect opaqueRectInLayerSpace(5, 5, 20, 20);
- IntRect opaqueRectInContentSpace = opaqueRectInLayerSpace;
- opaqueRectInContentSpace.scale(contentsScale);
+ gfx::Rect contentRect(10, 10, 100, 100);
+ gfx::Rect opaqueRectInLayerSpace(5, 5, 20, 20);
+ gfx::RectF opaqueRectInContentSpace = gfx::ScaleRect(opaqueRectInLayerSpace, contentsScale, contentsScale);
MockContentLayerClient client(opaqueRectInLayerSpace);
scoped_refptr<BitmapContentLayerUpdater> updater = BitmapContentLayerUpdater::create(ContentLayerPainter::create(&client).PassAs<LayerPainter>());
- IntRect resultingOpaqueRect;
+ gfx::Rect resultingOpaqueRect;
RenderingStats stats;
- updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect, stats);
+ updater->prepareToUpdate(contentRect, gfx::Size(256, 256), contentsScale, contentsScale, resultingOpaqueRect, stats);
- EXPECT_RECT_EQ(opaqueRectInContentSpace, resultingOpaqueRect);
+ EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaqueRectInContentSpace), resultingOpaqueRect);
}
} // namespace
diff --git a/cc/content_layer_updater.cc b/cc/content_layer_updater.cc
index b151bfb..8888e0d 100644
--- a/cc/content_layer_updater.cc
+++ b/cc/content_layer_updater.cc
@@ -6,7 +6,6 @@
#include "cc/content_layer_updater.h"
-#include "FloatRect.h"
#include "SkiaUtils.h"
#include "base/debug/trace_event.h"
#include "base/time.h"
@@ -15,6 +14,8 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkRect.h"
+#include "ui/gfx/rect_conversions.h"
+#include "ui/gfx/rect_f.h"
namespace cc {
@@ -27,20 +28,19 @@ ContentLayerUpdater::~ContentLayerUpdater()
{
}
-void ContentLayerUpdater::paintContents(SkCanvas* canvas, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats& stats)
+void ContentLayerUpdater::paintContents(SkCanvas* canvas, const gfx::Rect& contentRect, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats& stats)
{
TRACE_EVENT0("cc", "ContentLayerUpdater::paintContents");
canvas->save();
canvas->translate(FloatToSkScalar(-contentRect.x()), FloatToSkScalar(-contentRect.y()));
- IntRect layerRect = contentRect;
+ gfx::Rect layerRect = contentRect;
if (contentsWidthScale != 1 || contentsHeightScale != 1) {
canvas->scale(FloatToSkScalar(contentsWidthScale), FloatToSkScalar(contentsHeightScale));
- FloatRect rect = contentRect;
- rect.scale(1 / contentsWidthScale, 1 / contentsHeightScale);
- layerRect = enclosingIntRect(rect);
+ gfx::RectF rect = gfx::ScaleRect(contentRect, 1 / contentsWidthScale, 1 / contentsHeightScale);
+ layerRect = gfx::ToEnclosingRect(rect);
}
SkPaint paint;
@@ -50,15 +50,14 @@ void ContentLayerUpdater::paintContents(SkCanvas* canvas, const IntRect& content
canvas->drawRect(layerSkRect, paint);
canvas->clipRect(layerSkRect);
- FloatRect opaqueLayerRect;
+ gfx::RectF opaqueLayerRect;
base::TimeTicks paintBeginTime = base::TimeTicks::Now();
m_painter->paint(canvas, layerRect, opaqueLayerRect);
stats.totalPaintTimeInSeconds += (base::TimeTicks::Now() - paintBeginTime).InSecondsF();
canvas->restore();
- FloatRect opaqueContentRect = opaqueLayerRect;
- opaqueContentRect.scale(contentsWidthScale, contentsHeightScale);
- resultingOpaqueRect = enclosedIntRect(opaqueContentRect);
+ gfx::RectF opaqueContentRect = gfx::ScaleRect(opaqueLayerRect, contentsWidthScale, contentsHeightScale);
+ resultingOpaqueRect = gfx::ToEnclosedRect(opaqueContentRect);
m_contentRect = contentRect;
}
diff --git a/cc/content_layer_updater.h b/cc/content_layer_updater.h
index 4d59587..2e44bf7 100644
--- a/cc/content_layer_updater.h
+++ b/cc/content_layer_updater.h
@@ -21,11 +21,11 @@ protected:
explicit ContentLayerUpdater(scoped_ptr<LayerPainter>);
virtual ~ContentLayerUpdater();
- void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&);
- const IntRect& contentRect() const { return m_contentRect; }
+ void paintContents(SkCanvas*, const gfx::Rect& contentRect, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats&);
+ const gfx::Rect& contentRect() const { return m_contentRect; }
private:
- IntRect m_contentRect;
+ gfx::Rect m_contentRect;
scoped_ptr<LayerPainter> m_painter;
};
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index 7172f93..c69f933 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -373,7 +373,7 @@ static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilte
renderer->context()->flush();
ResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourceTexture->id());
- SkBitmap source = RenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext);
+ SkBitmap source = RenderSurfaceFilters::apply(filters, lock.textureId(), cc::IntSize(sourceTexture->size()), filterContext, filterGrContext);
return source;
}
diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc
index 381fff5..ac1207c 100644
--- a/cc/heads_up_display_layer_impl.cc
+++ b/cc/heads_up_display_layer_impl.cc
@@ -105,9 +105,9 @@ void HeadsUpDisplayLayerImpl::updateHudTexture(ResourceProvider* resourceProvide
const SkBitmap* bitmap = &m_hudCanvas->getDevice()->accessBitmap(false);
SkAutoLockPixels locker(*bitmap);
- IntRect layerRect(IntPoint(), bounds());
+ gfx::Rect layerRect(gfx::Point(), bounds());
DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config);
- resourceProvider->upload(m_hudTexture->id(), static_cast<const uint8_t*>(bitmap->getPixels()), layerRect, layerRect, IntSize());
+ resourceProvider->upload(m_hudTexture->id(), static_cast<const uint8_t*>(bitmap->getPixels()), layerRect, layerRect, gfx::Vector2d());
}
void HeadsUpDisplayLayerImpl::didDraw(ResourceProvider* resourceProvider)
diff --git a/cc/image_layer.cc b/cc/image_layer.cc
index b347736..e162007 100644
--- a/cc/image_layer.cc
+++ b/cc/image_layer.cc
@@ -23,7 +23,7 @@ public:
{
}
- virtual void update(ResourceUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE
+ virtual void update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE
{
updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
}
@@ -45,15 +45,15 @@ public:
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
}
- void updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate)
+ void updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
{
// Source rect should never go outside the image pixels, even if this
// is requested because the texture extends outside the image.
- IntRect clippedSourceRect = sourceRect;
- IntRect imageRect = IntRect(0, 0, m_bitmap.width(), m_bitmap.height());
- clippedSourceRect.intersect(imageRect);
+ gfx::Rect clippedSourceRect = sourceRect;
+ gfx::Rect imageRect = gfx::Rect(0, 0, m_bitmap.width(), m_bitmap.height());
+ clippedSourceRect.Intersect(imageRect);
- IntSize clippedDestOffset = destOffset + IntSize(clippedSourceRect.location() - sourceRect.location());
+ gfx::Vector2d clippedDestOffset = destOffset + (clippedSourceRect.origin() - sourceRect.origin());
ResourceUpdate upload = ResourceUpdate::Create(texture,
&m_bitmap,
diff --git a/cc/layer_painter.h b/cc/layer_painter.h
index 282efdc..81b0e44 100644
--- a/cc/layer_painter.h
+++ b/cc/layer_painter.h
@@ -8,15 +8,17 @@
class SkCanvas;
-namespace cc {
+namespace gfx {
+class Rect;
+class RectF;
+}
-class FloatRect;
-class IntRect;
+namespace cc {
class LayerPainter {
public:
virtual ~LayerPainter() { }
- virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) = 0;
+ virtual void paint(SkCanvas*, const gfx::Rect& contentRect, gfx::RectF& opaque) = 0;
};
} // namespace cc
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index cf864f9..21b323a 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -132,7 +132,7 @@ class MockContentLayerClient : public ContentLayerClient {
public:
MockContentLayerClient() { }
virtual ~MockContentLayerClient() { }
- virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) OVERRIDE { }
+ virtual void paintContents(SkCanvas*, const gfx::Rect& clip, gfx::RectF& opaque) OVERRIDE { }
};
scoped_refptr<ContentLayer> createDrawableContentLayer(ContentLayerClient* delegate)
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 0556f14..86be122 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -1130,7 +1130,7 @@ public:
m_testLayer = testLayer;
}
- virtual void paintContents(SkCanvas*, const IntRect&, FloatRect&) OVERRIDE
+ virtual void paintContents(SkCanvas*, const gfx::Rect&, gfx::RectF&) OVERRIDE
{
// Set layer opacity to 0.
if (m_testLayer)
@@ -1216,7 +1216,7 @@ class MockContentLayerClient : public ContentLayerClient {
public:
bool drawsContent() const { return true; }
MOCK_CONST_METHOD0(preserves3D, bool());
- void paintContents(SkCanvas*, const IntRect&, FloatRect&) OVERRIDE { }
+ void paintContents(SkCanvas*, const gfx::Rect&, gfx::RectF&) OVERRIDE { }
void notifySyncRequired() { }
};
@@ -1273,6 +1273,7 @@ TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread)
runTest(true);
}
+
class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public LayerTreeHostTest {
public:
@@ -2679,10 +2680,10 @@ void EvictionTestLayer::update(ResourceUpdateQueue& queue, const OcclusionTracke
createTextureIfNeeded();
if (!m_texture.get())
return;
- IntRect fullRect(0, 0, 10, 10);
+ gfx::Rect fullRect(0, 0, 10, 10);
ResourceUpdate upload = ResourceUpdate::Create(
- m_texture.get(), &m_bitmap, fullRect, fullRect, IntSize());
+ m_texture.get(), &m_bitmap, fullRect, fullRect, gfx::Vector2d());
queue.appendFullUpload(upload);
}
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc
index 33f37e7..e2cb6b2 100644
--- a/cc/layer_unittest.cc
+++ b/cc/layer_unittest.cc
@@ -51,7 +51,7 @@ private:
class MockLayerPainter : public LayerPainter {
public:
- virtual void paint(SkCanvas*, const IntRect&, FloatRect&) OVERRIDE { }
+ virtual void paint(SkCanvas*, const gfx::Rect&, gfx::RectF&) OVERRIDE { }
};
diff --git a/cc/layer_updater.h b/cc/layer_updater.h
index 16e1a6a..bb04a1d 100644
--- a/cc/layer_updater.h
+++ b/cc/layer_updater.h
@@ -9,10 +9,13 @@
#include "cc/prioritized_texture.h"
#include "third_party/khronos/GLES2/gl2.h"
+namespace gfx {
+class Rect;
+class Vector2d;
+}
+
namespace cc {
-class IntRect;
-class IntSize;
class TextureManager;
struct RenderingStats;
class ResourceUpdateQueue;
@@ -28,7 +31,7 @@ public:
void swapTextureWith(scoped_ptr<PrioritizedTexture>& texture) { m_texture.swap(texture); }
// TODO(reveman): partialUpdate should be a property of this class
// instead of an argument passed to update().
- virtual void update(ResourceUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) = 0;
+ virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) = 0;
protected:
explicit Resource(scoped_ptr<PrioritizedTexture> texture);
@@ -41,7 +44,7 @@ public:
virtual scoped_ptr<Resource> createResource(PrioritizedTextureManager*) = 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 IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&) { }
+ 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) { }
diff --git a/cc/prioritized_texture.cc b/cc/prioritized_texture.cc
index 56d50f2..1c4428a 100644
--- a/cc/prioritized_texture.cc
+++ b/cc/prioritized_texture.cc
@@ -16,7 +16,7 @@ using namespace std;
namespace cc {
-PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, IntSize size, GLenum format)
+PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, gfx::Size size, GLenum format)
: m_size(size)
, m_format(format)
, m_bytes(0)
@@ -28,7 +28,7 @@ PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, IntSi
, m_manager(0)
{
// m_manager is set in registerTexture() so validity can be checked.
- DCHECK(format || size.isEmpty());
+ DCHECK(format || size.IsEmpty());
if (format)
m_bytes = Texture::memorySizeBytes(size, format);
if (manager)
@@ -51,7 +51,7 @@ void PrioritizedTexture::setTextureManager(PrioritizedTextureManager* manager)
manager->registerTexture(this);
}
-void PrioritizedTexture::setDimensions(IntSize size, GLenum format)
+void PrioritizedTexture::setDimensions(gfx::Size size, GLenum format)
{
if (m_format != format || m_size != size) {
m_isAbovePriorityCutoff = false;
@@ -91,8 +91,8 @@ ResourceProvider::ResourceId PrioritizedTexture::resourceId() const
}
void PrioritizedTexture::upload(ResourceProvider* resourceProvider,
- const uint8_t* image, const IntRect& imageRect,
- const IntRect& sourceRect, const IntSize& destOffset)
+ const uint8_t* image, const gfx::Rect& imageRect,
+ const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset)
{
DCHECK(m_isAbovePriorityCutoff);
if (m_isAbovePriorityCutoff)
@@ -127,12 +127,12 @@ void PrioritizedTexture::unlink()
void PrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes)
{
- setDimensions(IntSize(), GL_RGBA);
+ setDimensions(gfx::Size(), GL_RGBA);
setIsSelfManaged(true);
m_bytes = bytes;
}
-PrioritizedTexture::Backing::Backing(unsigned id, ResourceProvider* resourceProvider, IntSize size, GLenum format)
+PrioritizedTexture::Backing::Backing(unsigned id, ResourceProvider* resourceProvider, gfx::Size size, GLenum format)
: Texture(id, size, format)
, m_owner(0)
, m_priorityAtLastPriorityUpdate(PriorityCalculator::lowestPriority())
diff --git a/cc/prioritized_texture.h b/cc/prioritized_texture.h
index f0ab136..fed3470 100644
--- a/cc/prioritized_texture.h
+++ b/cc/prioritized_texture.h
@@ -5,14 +5,15 @@
#ifndef CCPrioritizedTexture_h
#define CCPrioritizedTexture_h
-#include "IntRect.h"
-#include "IntSize.h"
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "cc/priority_calculator.h"
#include "cc/resource_provider.h"
#include "cc/texture.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/size.h"
+#include "ui/gfx/vector2d.h"
#include "third_party/khronos/GLES2/gl2.h"
namespace cc {
@@ -21,13 +22,13 @@ class PrioritizedTextureManager;
class PrioritizedTexture {
public:
- static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* manager, IntSize size, GLenum format)
+ static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* manager, gfx::Size size, GLenum format)
{
return make_scoped_ptr(new PrioritizedTexture(manager, size, format));
}
static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* manager)
{
- return make_scoped_ptr(new PrioritizedTexture(manager, IntSize(), 0));
+ return make_scoped_ptr(new PrioritizedTexture(manager, gfx::Size(), 0));
}
~PrioritizedTexture();
@@ -35,9 +36,9 @@ public:
// Setting these to the same value is a no-op.
void setTextureManager(PrioritizedTextureManager*);
PrioritizedTextureManager* textureManager() { return m_manager; }
- void setDimensions(IntSize, GLenum format);
+ void setDimensions(gfx::Size, GLenum format);
GLenum format() const { return m_format; }
- IntSize size() const { return m_size; }
+ gfx::Size size() const { return m_size; }
size_t bytes() const { return m_bytes; }
bool contentsSwizzled() const { return m_contentsSwizzled; }
@@ -71,7 +72,7 @@ public:
bool requestLate();
// Uploads pixels into the backing resource. This functions will aquire the backing if needed.
- void upload(ResourceProvider*, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset);
+ void upload(ResourceProvider*, const uint8_t* image, const gfx::Rect& imageRect, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset);
ResourceProvider::ResourceId resourceId() const;
@@ -91,7 +92,7 @@ private:
class Backing : public Texture {
public:
- Backing(unsigned id, ResourceProvider*, IntSize, GLenum format);
+ Backing(unsigned id, ResourceProvider*, gfx::Size, GLenum format);
~Backing();
void updatePriority();
void updateInDrawingImplTree();
@@ -122,7 +123,7 @@ private:
DISALLOW_COPY_AND_ASSIGN(Backing);
};
- PrioritizedTexture(PrioritizedTextureManager*, IntSize, GLenum format);
+ PrioritizedTexture(PrioritizedTextureManager*, gfx::Size, GLenum format);
bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; }
void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; }
@@ -132,7 +133,7 @@ private:
void link(Backing*);
void unlink();
- IntSize m_size;
+ gfx::Size m_size;
GLenum m_format;
size_t m_bytes;
bool m_contentsSwizzled;
diff --git a/cc/prioritized_texture_manager.cc b/cc/prioritized_texture_manager.cc
index 79ecbc5..32944bf 100644
--- a/cc/prioritized_texture_manager.cc
+++ b/cc/prioritized_texture_manager.cc
@@ -394,7 +394,7 @@ void PrioritizedTextureManager::returnBackingTexture(PrioritizedTexture* texture
texture->unlink();
}
-PrioritizedTexture::Backing* PrioritizedTextureManager::createBacking(IntSize size, GLenum format, ResourceProvider* resourceProvider)
+PrioritizedTexture::Backing* PrioritizedTextureManager::createBacking(gfx::Size size, GLenum format, ResourceProvider* resourceProvider)
{
DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked());
DCHECK(resourceProvider);
diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h
index 952b584..92d739f 100644
--- a/cc/prioritized_texture_manager.h
+++ b/cc/prioritized_texture_manager.h
@@ -8,8 +8,6 @@
#include <list>
#include <vector>
-#include "IntRect.h"
-#include "IntSize.h"
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "base/memory/scoped_ptr.h"
@@ -17,6 +15,7 @@
#include "cc/priority_calculator.h"
#include "cc/texture.h"
#include "third_party/khronos/GLES2/gl2.h"
+#include "ui/gfx/size.h"
#if defined(COMPILER_GCC)
namespace BASE_HASH_NAMESPACE {
@@ -39,7 +38,7 @@ public:
{
return make_scoped_ptr(new PrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool));
}
- scoped_ptr<PrioritizedTexture> createTexture(IntSize size, GLenum format)
+ scoped_ptr<PrioritizedTexture> createTexture(gfx::Size size, GLenum format)
{
return make_scoped_ptr(new PrioritizedTexture(this, size, format));
}
@@ -145,7 +144,7 @@ private:
PrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool);
bool evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, EvictionPolicy, ResourceProvider*);
- PrioritizedTexture::Backing* createBacking(IntSize, GLenum format, ResourceProvider*);
+ PrioritizedTexture::Backing* createBacking(gfx::Size, GLenum format, ResourceProvider*);
void evictFirstBackingResource(ResourceProvider*);
void deleteUnlinkedEvictedBackings();
void sortBackings();
diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc
index 50d0356..9c37395 100644
--- a/cc/prioritized_texture_unittest.cc
+++ b/cc/prioritized_texture_unittest.cc
@@ -617,7 +617,7 @@ TEST_F(PrioritizedTextureTest, clearUploadsToEvictedResources)
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
for (size_t i = 0; i < maxTextures; ++i) {
const ResourceUpdate upload = ResourceUpdate::Create(
- textures[i].get(), NULL, IntRect(), IntRect(), IntSize());
+ textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d());
queue.appendFullUpload(upload);
}
diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc
index 4949a6b..33ed800 100644
--- a/cc/resource_provider.cc
+++ b/cc/resource_provider.cc
@@ -8,7 +8,6 @@
#include <limits.h>
-#include "IntRect.h"
#include "base/debug/alias.h"
#include "base/hash_tables.h"
#include "base/stl_util.h"
@@ -19,6 +18,8 @@
#include "cc/texture_uploader.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/vector2d.h"
#include <public/WebGraphicsContext3D.h>
@@ -80,7 +81,7 @@ ResourceProvider::Resource::Resource()
{
}
-ResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSize& size, GLenum format)
+ResourceProvider::Resource::Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum format)
: glId(textureId)
, pixels(0)
, pool(pool)
@@ -95,7 +96,7 @@ ResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSize
{
}
-ResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format)
+ResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format)
: glId(0)
, pixels(pixels)
, pool(pool)
@@ -150,7 +151,7 @@ bool ResourceProvider::inUseByConsumer(ResourceId id)
return !!resource->lockForReadCount || resource->exported;
}
-ResourceProvider::ResourceId ResourceProvider::createResource(int pool, const IntSize& size, GLenum format, TextureUsageHint hint)
+ResourceProvider::ResourceId ResourceProvider::createResource(int pool, const gfx::Size& size, GLenum format, TextureUsageHint hint)
{
switch (m_defaultResourceType) {
case GLTexture:
@@ -164,7 +165,7 @@ ResourceProvider::ResourceId ResourceProvider::createResource(int pool, const In
return 0;
}
-ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const IntSize& size, GLenum format, TextureUsageHint hint)
+ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const gfx::Size& size, GLenum format, TextureUsageHint hint)
{
DCHECK(Proxy::isImplThread());
unsigned textureId = 0;
@@ -190,7 +191,7 @@ ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const I
return id;
}
-ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const IntSize& size)
+ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const gfx::Size& size)
{
DCHECK(Proxy::isImplThread());
@@ -207,7 +208,7 @@ ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture
DCHECK(Proxy::isImplThread());
DCHECK(m_context->context3D());
ResourceId id = m_nextId++;
- Resource resource(textureId, 0, IntSize(), 0);
+ Resource resource(textureId, 0, gfx::Size(), 0);
resource.external = true;
m_resources[id] = resource;
return id;
@@ -265,7 +266,7 @@ ResourceProvider::ResourceType ResourceProvider::resourceType(ResourceId id)
return resource->type;
}
-void ResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset)
+void ResourceProvider::upload(ResourceId id, const uint8_t* image, const gfx::Rect& imageRect, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset)
{
DCHECK(Proxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
@@ -300,7 +301,7 @@ void ResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect
ScopedWriteLockSoftware lock(this, id);
SkCanvas* dest = lock.skCanvas();
- dest->writePixels(srcSubset, destOffset.width(), destOffset.height());
+ dest->writePixels(srcSubset, destOffset.x(), destOffset.y());
}
}
diff --git a/cc/resource_provider.h b/cc/resource_provider.h
index 3b66f9b..45b99eb 100644
--- a/cc/resource_provider.h
+++ b/cc/resource_provider.h
@@ -5,7 +5,6 @@
#ifndef CCResourceProvider_h
#define CCResourceProvider_h
-#include "IntSize.h"
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "base/memory/scoped_ptr.h"
@@ -14,6 +13,7 @@
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/gfx/size.h"
#include <deque>
#include <vector>
@@ -21,9 +21,13 @@ namespace WebKit {
class WebGraphicsContext3D;
}
+namespace gfx {
+class Rect;
+class Vector2d;
+}
+
namespace cc {
-class IntRect;
class LayerTextureSubImage;
class TextureCopier;
class TextureUploader;
@@ -46,7 +50,7 @@ public:
struct TransferableResource {
unsigned id;
GLenum format;
- IntSize size;
+ gfx::Size size;
Mailbox mailbox;
};
typedef std::vector<TransferableResource> TransferableResourceArray;
@@ -78,11 +82,11 @@ public:
ResourceType resourceType(ResourceId);
// Creates a resource of the default resource type.
- ResourceId createResource(int pool, const IntSize&, GLenum format, TextureUsageHint);
+ ResourceId createResource(int pool, const gfx::Size&, GLenum format, TextureUsageHint);
// You can also explicitly create a specific resource type.
- ResourceId createGLTexture(int pool, const IntSize&, GLenum format, TextureUsageHint);
- ResourceId createBitmap(int pool, const IntSize&);
+ ResourceId createGLTexture(int pool, const gfx::Size&, GLenum format, TextureUsageHint);
+ ResourceId createBitmap(int pool, const gfx::Size&);
// Wraps an external texture into a GL resource.
ResourceId createResourceFromExternalTexture(unsigned textureId);
@@ -92,7 +96,7 @@ public:
void deleteOwnedResources(int pool);
// Upload data from image, copying sourceRect (in image) into destRect (in the resource).
- void upload(ResourceId, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset);
+ void upload(ResourceId, const uint8_t* image, const gfx::Rect& imageRect, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset);
// Check upload status.
size_t numBlockingUploads();
@@ -219,8 +223,8 @@ public:
private:
struct Resource {
Resource();
- Resource(unsigned textureId, int pool, const IntSize& size, GLenum format);
- Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format);
+ Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum format);
+ Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format);
unsigned glId;
uint8_t* pixels;
@@ -230,7 +234,7 @@ private:
bool external;
bool exported;
bool markedForDeletion;
- IntSize size;
+ gfx::Size size;
GLenum format;
ResourceType type;
};
diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc
index 493991b..f3c852f 100644
--- a/cc/resource_provider_unittest.cc
+++ b/cc/resource_provider_unittest.cc
@@ -23,7 +23,7 @@ using namespace WebKit;
namespace {
-size_t textureSize(const IntSize& size, WGC3Denum format)
+size_t textureSize(const gfx::Size& size, WGC3Denum format)
{
unsigned int componentsPerPixel = 4;
unsigned int bytesPerComponent = 1;
@@ -31,14 +31,14 @@ size_t textureSize(const IntSize& size, WGC3Denum format)
}
struct Texture {
- Texture(const IntSize& size, WGC3Denum format)
+ Texture(const gfx::Size& size, WGC3Denum format)
: size(size)
, format(format)
, data(new uint8_t[textureSize(size, format)])
{
}
- IntSize size;
+ gfx::Size size;
WGC3Denum format;
scoped_array<uint8_t> data;
};
@@ -154,7 +154,7 @@ public:
default:
NOTREACHED();
}
- allocateTexture(IntSize(width, height), format);
+ allocateTexture(gfx::Size(width, height), format);
}
virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels)
@@ -165,7 +165,7 @@ public:
ASSERT_EQ(internalformat, format);
ASSERT_FALSE(border);
ASSERT_EQ(type, GL_UNSIGNED_BYTE);
- allocateTexture(IntSize(width, height), format);
+ allocateTexture(gfx::Size(width, height), format);
if (pixels)
setPixels(0, 0, width, height, pixels);
}
@@ -205,7 +205,7 @@ public:
m_textures.set(m_currentTexture, m_sharedData->consumeTexture(mailbox, m_lastWaitedSyncPoint));
}
- void getPixels(const IntSize& size, WGC3Denum format, uint8_t* pixels)
+ void getPixels(const gfx::Size& size, WGC3Denum format, uint8_t* pixels)
{
ASSERT_TRUE(m_currentTexture);
Texture* texture = m_textures.get(m_currentTexture);
@@ -229,7 +229,7 @@ protected:
{ }
private:
- void allocateTexture(const IntSize& size, WGC3Denum format)
+ void allocateTexture(const gfx::Size& size, WGC3Denum format)
{
ASSERT_TRUE(m_currentTexture);
m_textures.set(m_currentTexture, make_scoped_ptr(new Texture(size, format)));
@@ -243,9 +243,9 @@ private:
ASSERT_TRUE(xoffset >= 0 && xoffset+width <= texture->size.width());
ASSERT_TRUE(yoffset >= 0 && yoffset+height <= texture->size.height());
ASSERT_TRUE(pixels);
- size_t inPitch = textureSize(IntSize(width, 1), texture->format);
- size_t outPitch = textureSize(IntSize(texture->size.width(), 1), texture->format);
- uint8_t* dest = texture->data.get() + yoffset * outPitch + textureSize(IntSize(xoffset, 1), texture->format);
+ size_t inPitch = textureSize(gfx::Size(width, 1), texture->format);
+ size_t outPitch = textureSize(gfx::Size(texture->size.width(), 1), texture->format);
+ uint8_t* dest = texture->data.get() + yoffset * outPitch + textureSize(gfx::Size(xoffset, 1), texture->format);
const uint8_t* src = static_cast<const uint8_t*>(pixels);
for (int i = 0; i < height; ++i) {
memcpy(dest, src, inPitch);
@@ -279,7 +279,7 @@ public:
ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_context->context3D()); }
- void getResourcePixels(ResourceProvider::ResourceId id, const IntSize& size, WGC3Denum format, uint8_t* pixels)
+ void getResourcePixels(ResourceProvider::ResourceId id, const gfx::Size& size, WGC3Denum format, uint8_t* pixels)
{
if (GetParam() == ResourceProvider::GLTexture) {
ResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get(), id);
@@ -308,7 +308,7 @@ protected:
TEST_P(ResourceProviderTest, Basic)
{
- IntSize size(1, 1);
+ gfx::Size size(1, 1);
WGC3Denum format = GL_RGBA;
int pool = 1;
size_t pixelSize = textureSize(size, format);
@@ -318,8 +318,8 @@ TEST_P(ResourceProviderTest, Basic)
expectNumResources(1);
uint8_t data[4] = {1, 2, 3, 4};
- IntRect rect(IntPoint(), size);
- m_resourceProvider->upload(id, data, rect, rect, IntSize());
+ gfx::Rect rect(gfx::Point(), size);
+ m_resourceProvider->upload(id, data, rect, rect, gfx::Vector2d());
uint8_t result[4] = {0};
getResourcePixels(id, size, format, result);
@@ -331,7 +331,7 @@ TEST_P(ResourceProviderTest, Basic)
TEST_P(ResourceProviderTest, DeleteOwnedResources)
{
- IntSize size(1, 1);
+ gfx::Size size(1, 1);
WGC3Denum format = GL_RGBA;
int pool = 1;
@@ -349,7 +349,7 @@ TEST_P(ResourceProviderTest, DeleteOwnedResources)
TEST_P(ResourceProviderTest, Upload)
{
- IntSize size(2, 2);
+ gfx::Size size(2, 2);
WGC3Denum format = GL_RGBA;
int pool = 1;
size_t pixelSize = textureSize(size, format);
@@ -358,16 +358,16 @@ TEST_P(ResourceProviderTest, Upload)
ResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny);
uint8_t image[16] = {0};
- IntRect imageRect(IntPoint(), size);
- m_resourceProvider->upload(id, image, imageRect, imageRect, IntSize());
+ gfx::Rect imageRect(gfx::Point(), size);
+ m_resourceProvider->upload(id, image, imageRect, imageRect, gfx::Vector2d());
for (uint8_t i = 0 ; i < pixelSize; ++i)
image[i] = i;
uint8_t result[16] = {0};
{
- IntRect sourceRect(0, 0, 1, 1);
- IntSize destOffset(0, 0);
+ gfx::Rect sourceRect(0, 0, 1, 1);
+ gfx::Vector2d destOffset(0, 0);
m_resourceProvider->upload(id, image, imageRect, sourceRect, destOffset);
uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0,
@@ -376,8 +376,8 @@ TEST_P(ResourceProviderTest, Upload)
EXPECT_EQ(0, memcmp(expected, result, pixelSize));
}
{
- IntRect sourceRect(0, 0, 1, 1);
- IntSize destOffset(1, 1);
+ gfx::Rect sourceRect(0, 0, 1, 1);
+ gfx::Vector2d destOffset(1, 1);
m_resourceProvider->upload(id, image, imageRect, sourceRect, destOffset);
uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0,
@@ -386,8 +386,8 @@ TEST_P(ResourceProviderTest, Upload)
EXPECT_EQ(0, memcmp(expected, result, pixelSize));
}
{
- IntRect sourceRect(1, 0, 1, 1);
- IntSize destOffset(0, 1);
+ gfx::Rect sourceRect(1, 0, 1, 1);
+ gfx::Vector2d destOffset(0, 1);
m_resourceProvider->upload(id, image, imageRect, sourceRect, destOffset);
uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0,
@@ -396,9 +396,9 @@ TEST_P(ResourceProviderTest, Upload)
EXPECT_EQ(0, memcmp(expected, result, pixelSize));
}
{
- IntRect offsetImageRect(IntPoint(100, 100), size);
- IntRect sourceRect(100, 100, 1, 1);
- IntSize destOffset(1, 0);
+ gfx::Rect offsetImageRect(gfx::Point(100, 100), size);
+ gfx::Rect sourceRect(100, 100, 1, 1);
+ gfx::Vector2d destOffset(1, 0);
m_resourceProvider->upload(id, image, offsetImageRect, sourceRect, destOffset);
uint8_t expected[16] = {0, 1, 2, 3, 0, 1, 2, 3,
@@ -420,7 +420,7 @@ TEST_P(ResourceProviderTest, TransferResources)
scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>()));
scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.get()));
- IntSize size(1, 1);
+ gfx::Size size(1, 1);
WGC3Denum format = GL_RGBA;
int pool = 1;
size_t pixelSize = textureSize(size, format);
@@ -428,12 +428,12 @@ TEST_P(ResourceProviderTest, TransferResources)
ResourceProvider::ResourceId id1 = childResourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny);
uint8_t data1[4] = {1, 2, 3, 4};
- IntRect rect(IntPoint(), size);
- childResourceProvider->upload(id1, data1, rect, rect, IntSize());
+ gfx::Rect rect(gfx::Point(), size);
+ childResourceProvider->upload(id1, data1, rect, rect, gfx::Vector2d());
ResourceProvider::ResourceId id2 = childResourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny);
uint8_t data2[4] = {5, 5, 5, 5};
- childResourceProvider->upload(id2, data2, rect, rect, IntSize());
+ childResourceProvider->upload(id2, data2, rect, rect, gfx::Vector2d());
int childPool = 2;
int childId = m_resourceProvider->createChild(childPool);
@@ -537,7 +537,7 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources)
scoped_ptr<GraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>()));
scoped_ptr<ResourceProvider> childResourceProvider(ResourceProvider::create(childContext.get()));
- IntSize size(1, 1);
+ gfx::Size size(1, 1);
WGC3Denum format = GL_RGBA;
int pool = 1;
size_t pixelSize = textureSize(size, format);
@@ -545,8 +545,8 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources)
ResourceProvider::ResourceId id = childResourceProvider->createResource(pool, size, format, ResourceProvider::TextureUsageAny);
uint8_t data[4] = {1, 2, 3, 4};
- IntRect rect(IntPoint(), size);
- childResourceProvider->upload(id, data, rect, rect, IntSize());
+ gfx::Rect rect(gfx::Point(), size);
+ childResourceProvider->upload(id, data, rect, rect, gfx::Vector2d());
int childPool = 2;
int childId = m_resourceProvider->createChild(childPool);
diff --git a/cc/resource_update.cc b/cc/resource_update.cc
index c31e7be..b50e36c 100644
--- a/cc/resource_update.cc
+++ b/cc/resource_update.cc
@@ -12,10 +12,10 @@ namespace cc {
ResourceUpdate ResourceUpdate::Create(PrioritizedTexture* texture,
const SkBitmap* bitmap,
- IntRect content_rect,
- IntRect source_rect,
- IntSize dest_offset) {
- CHECK(content_rect.contains(source_rect));
+ gfx::Rect content_rect,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset) {
+ CHECK(content_rect.Contains(source_rect));
ResourceUpdate update;
update.texture = texture;
update.bitmap = bitmap;
@@ -27,10 +27,10 @@ ResourceUpdate ResourceUpdate::Create(PrioritizedTexture* texture,
ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedTexture* texture,
SkPicture* picture,
- IntRect content_rect,
- IntRect source_rect,
- IntSize dest_offset) {
- CHECK(content_rect.contains(source_rect));
+ gfx::Rect content_rect,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset) {
+ CHECK(content_rect.Contains(source_rect));
ResourceUpdate update;
update.texture = texture;
update.picture = picture;
diff --git a/cc/resource_update.h b/cc/resource_update.h
index 1fac43a..78f5fdf 100644
--- a/cc/resource_update.h
+++ b/cc/resource_update.h
@@ -5,7 +5,8 @@
#ifndef CC_RESOURCE_UPDATE_H_
#define CC_RESOURCE_UPDATE_H_
-#include "IntRect.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/vector2d.h"
class SkBitmap;
class SkPicture;
@@ -17,14 +18,14 @@ class PrioritizedTexture;
struct ResourceUpdate {
static ResourceUpdate Create(PrioritizedTexture*,
const SkBitmap*,
- IntRect content_rect,
- IntRect source_rect,
- IntSize dest_offset);
+ gfx::Rect content_rect,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset);
static ResourceUpdate CreateFromPicture(PrioritizedTexture*,
SkPicture*,
- IntRect content_rect,
- IntRect source_rect,
- IntSize dest_offset);
+ gfx::Rect content_rect,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset);
ResourceUpdate();
virtual ~ResourceUpdate();
@@ -32,9 +33,9 @@ struct ResourceUpdate {
PrioritizedTexture* texture;
const SkBitmap* bitmap;
SkPicture* picture;
- IntRect content_rect;
- IntRect source_rect;
- IntSize dest_offset;
+ gfx::Rect content_rect;
+ gfx::Rect source_rect;
+ gfx::Vector2d dest_offset;
};
}
diff --git a/cc/resource_update_controller.cc b/cc/resource_update_controller.cc
index b3133c9..55c5277 100644
--- a/cc/resource_update_controller.cc
+++ b/cc/resource_update_controller.cc
@@ -39,7 +39,7 @@ const int textureUploadFlushPeriod = 4;
const size_t maxBlockingUpdateIntervals = 4;
scoped_ptr<SkCanvas> createAcceleratedCanvas(
- GrContext* grContext, cc::IntSize canvasSize, unsigned textureId)
+ GrContext* grContext, gfx::Size canvasSize, unsigned textureId)
{
GrPlatformTextureDesc textureDesc;
textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag;
@@ -121,9 +121,9 @@ void ResourceUpdateController::updateTexture(ResourceUpdate update)
{
if (update.picture) {
PrioritizedTexture* texture = update.texture;
- IntRect pictureRect = update.content_rect;
- IntRect sourceRect = update.source_rect;
- IntSize destOffset = update.dest_offset;
+ gfx::Rect pictureRect = update.content_rect;
+ gfx::Rect sourceRect = update.source_rect;
+ gfx::Vector2d destOffset = update.dest_offset;
texture->acquireBackingTexture(m_resourceProvider);
DCHECK(texture->haveBackingTexture());
@@ -159,15 +159,15 @@ void ResourceUpdateController::updateTexture(ResourceUpdate update)
canvas->translate(0.0, texture->size().height());
canvas->scale(1.0, -1.0);
// Clip to the destination on the texture that must be updated.
- canvas->clipRect(SkRect::MakeXYWH(destOffset.width(),
- destOffset.height(),
+ canvas->clipRect(SkRect::MakeXYWH(destOffset.x(),
+ destOffset.y(),
sourceRect.width(),
sourceRect.height()));
// Translate the origin of pictureRect to destOffset.
// Note that destOffset is defined relative to sourceRect.
canvas->translate(
- pictureRect.x() - sourceRect.x() + destOffset.width(),
- pictureRect.y() - sourceRect.y() + destOffset.height());
+ pictureRect.x() - sourceRect.x() + destOffset.x(),
+ pictureRect.y() - sourceRect.y() + destOffset.y());
canvas->drawPicture(*update.picture);
// Flush ganesh context so that all the rendered stuff appears on the
diff --git a/cc/resource_update_controller_unittest.cc b/cc/resource_update_controller_unittest.cc
index ca3c3b8..9c46af5 100644
--- a/cc/resource_update_controller_unittest.cc
+++ b/cc/resource_update_controller_unittest.cc
@@ -116,7 +116,7 @@ protected:
for (int i = 0; i < 4; i++) {
m_textures[i] = PrioritizedTexture::create(
- m_textureManager.get(), IntSize(300, 150), GL_RGBA);
+ m_textureManager.get(), gfx::Size(300, 150), GL_RGBA);
m_textures[i]->setRequestPriority(
PriorityCalculator::visiblePriority(true));
}
@@ -132,9 +132,9 @@ protected:
m_fullUploadCountExpected += count;
m_totalUploadCountExpected += count;
- const IntRect rect(0, 0, 300, 150);
+ const gfx::Rect rect(0, 0, 300, 150);
const ResourceUpdate upload = ResourceUpdate::Create(
- m_textures[textureIndex].get(), &m_bitmap, rect, rect, IntSize());
+ m_textures[textureIndex].get(), &m_bitmap, rect, rect, gfx::Vector2d());
for (int i = 0; i < count; i++)
m_queue->appendFullUpload(upload);
}
@@ -149,9 +149,9 @@ protected:
m_partialCountExpected += count;
m_totalUploadCountExpected += count;
- const IntRect rect(0, 0, 100, 100);
+ const gfx::Rect rect(0, 0, 100, 100);
const ResourceUpdate upload = ResourceUpdate::Create(
- m_textures[textureIndex].get(), &m_bitmap, rect, rect, IntSize());
+ m_textures[textureIndex].get(), &m_bitmap, rect, rect, gfx::Vector2d());
for (int i = 0; i < count; i++)
m_queue->appendPartialUpload(upload);
}
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index 1a107bd..baecc14 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -80,12 +80,11 @@ public:
return make_scoped_ptr(new ScrollbarBackgroundPainter(scrollbar, painter, geometry, trackPart));
}
- virtual void paint(SkCanvas* skCanvas, const IntRect& contentRect, FloatRect&) OVERRIDE
+ virtual void paint(SkCanvas* skCanvas, const gfx::Rect& contentRect, gfx::RectF&) OVERRIDE
{
WebKit::WebCanvas* canvas = skCanvas;
// The following is a simplification of ScrollbarThemeComposite::paint.
- WebKit::WebRect contentWebRect(contentRect.x(), contentRect.y(), contentRect.width(), contentRect.height());
- m_painter.paintScrollbarBackground(canvas, contentWebRect);
+ m_painter.paintScrollbarBackground(canvas, contentRect);
if (m_geometry->hasButtons(m_scrollbar)) {
WebRect backButtonStartPaintRect = m_geometry->backButtonStartRect(m_scrollbar);
@@ -148,7 +147,7 @@ public:
return make_scoped_ptr(new ScrollbarThumbPainter(scrollbar, painter, geometry));
}
- virtual void paint(SkCanvas* skCanvas, const IntRect& contentRect, FloatRect& opaque) OVERRIDE
+ virtual void paint(SkCanvas* skCanvas, const gfx::Rect& contentRect, gfx::RectF& opaque) OVERRIDE
{
WebKit::WebCanvas* canvas = skCanvas;
@@ -226,14 +225,14 @@ void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer
// Paint and upload the entire part.
float widthScale = static_cast<float>(contentBounds().width()) / bounds().width();
float heightScale = static_cast<float>(contentBounds().height()) / bounds().height();
- IntRect paintedOpaqueRect;
+ gfx::Rect paintedOpaqueRect;
painter->prepareToUpdate(rect, rect.size(), widthScale, heightScale, paintedOpaqueRect, stats);
if (!painter->pixelsDidChange() && texture->texture()->haveBackingTexture()) {
TRACE_EVENT_INSTANT0("cc","ScrollbarLayer::updatePart no texture upload needed");
return;
}
- IntSize destOffset(0, 0);
+ gfx::Vector2d destOffset(0, 0);
texture->update(queue, rect, destOffset, false, stats);
}
diff --git a/cc/skpicture_content_layer_updater.cc b/cc/skpicture_content_layer_updater.cc
index e646945..0418941 100644
--- a/cc/skpicture_content_layer_updater.cc
+++ b/cc/skpicture_content_layer_updater.cc
@@ -23,7 +23,7 @@ SkPictureContentLayerUpdater::Resource::~Resource()
{
}
-void SkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&)
+void SkPictureContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&)
{
updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
}
@@ -48,7 +48,7 @@ scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::createResource(
return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedTexture::create(manager)));
}
-void SkPictureContentLayerUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats& stats)
+void SkPictureContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const 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);
@@ -61,7 +61,7 @@ void SkPictureContentLayerUpdater::drawPicture(SkCanvas* canvas)
canvas->drawPicture(m_picture);
}
-void SkPictureContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate)
+void SkPictureContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
{
ResourceUpdate upload = ResourceUpdate::CreateFromPicture(
texture, &m_picture, contentRect(), sourceRect, destOffset);
diff --git a/cc/skpicture_content_layer_updater.h b/cc/skpicture_content_layer_updater.h
index 72305cd..6f02c63 100644
--- a/cc/skpicture_content_layer_updater.h
+++ b/cc/skpicture_content_layer_updater.h
@@ -27,7 +27,7 @@ public:
Resource(SkPictureContentLayerUpdater*, scoped_ptr<PrioritizedTexture>);
virtual ~Resource();
- virtual void update(ResourceUpdateQueue&, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
+ virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
private:
SkPictureContentLayerUpdater* updater() { return m_updater; }
@@ -44,9 +44,9 @@ protected:
explicit SkPictureContentLayerUpdater(scoped_ptr<LayerPainter>);
virtual ~SkPictureContentLayerUpdater();
- virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, RenderingStats&) OVERRIDE;
+ virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats&) OVERRIDE;
void drawPicture(SkCanvas*);
- void updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate);
+ void updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
bool layerIsOpaque() const { return m_layerIsOpaque; }
diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc
index 2157549..f40720f 100644
--- a/cc/software_renderer_unittest.cc
+++ b/cc/software_renderer_unittest.cc
@@ -124,8 +124,8 @@ TEST_F(SoftwareRendererTest, tileQuad)
for (int i = 0; i < innerPixels; i++)
cyanPixels[i] = cyan;
- resourceProvider()->upload(resourceYellow, reinterpret_cast<uint8_t*>(yellowPixels.get()), IntRect(IntPoint(), outerSize), IntRect(IntPoint(), outerSize), IntSize());
- resourceProvider()->upload(resourceCyan, reinterpret_cast<uint8_t*>(cyanPixels.get()), IntRect(IntPoint(), innerSize), IntRect(IntPoint(), innerSize), IntSize());
+ resourceProvider()->upload(resourceYellow, reinterpret_cast<uint8_t*>(yellowPixels.get()), gfx::Rect(gfx::Point(), outerSize), gfx::Rect(gfx::Point(), outerSize), gfx::Vector2d());
+ resourceProvider()->upload(resourceCyan, reinterpret_cast<uint8_t*>(cyanPixels.get()), gfx::Rect(gfx::Point(), innerSize), gfx::Rect(gfx::Point(), innerSize), gfx::Vector2d());
IntRect rect = IntRect(IntPoint(), deviceViewportSize());
diff --git a/cc/stubs/int_rect.h b/cc/stubs/int_rect.h
index 4114d7b..c55ef96 100644
--- a/cc/stubs/int_rect.h
+++ b/cc/stubs/int_rect.h
@@ -47,6 +47,9 @@ public:
operator gfx::Rect() const { return gfx::Rect(x(), y(), width(), height()); }
+ IntPoint location() const { return WebCore::IntRect::location(); }
+ IntSize size() const { return WebCore::IntRect::size(); }
+
private:
#if defined(OS_MACOSX)
operator CGRect() const;
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index 2988e5e..9757617 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -22,11 +22,11 @@ FakeLayerUpdater::Resource::~Resource()
{
}
-void FakeLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const IntRect&, const IntSize&, bool partialUpdate, RenderingStats&)
+void FakeLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect&, const gfx::Vector2d&, bool partialUpdate, RenderingStats&)
{
- const IntRect rect(0, 0, 10, 10);
+ const gfx::Rect rect(0, 0, 10, 10);
ResourceUpdate upload = ResourceUpdate::Create(
- texture(), &m_bitmap, rect, rect, IntSize());
+ texture(), &m_bitmap, rect, rect, gfx::Vector2d());
if (partialUpdate)
queue.appendPartialUpload(upload);
else
@@ -45,7 +45,7 @@ FakeLayerUpdater::~FakeLayerUpdater()
{
}
-void FakeLayerUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, float, IntRect& resultingOpaqueRect, RenderingStats&)
+void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, RenderingStats&)
{
m_prepareCount++;
m_lastUpdateRect = contentRect;
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index 8344b3b..6c77c9d 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::PrioritizedTexture>);
virtual ~Resource();
- virtual void update(cc::ResourceUpdateQueue&, const cc::IntRect&, const cc::IntSize&, bool, cc::RenderingStats&) OVERRIDE;
+ virtual void update(cc::ResourceUpdateQueue&, const gfx::Rect&, const gfx::Vector2d&, bool, cc::RenderingStats&) OVERRIDE;
private:
FakeLayerUpdater* m_layer;
@@ -39,12 +39,12 @@ public:
virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::PrioritizedTextureManager*) OVERRIDE;
- virtual void prepareToUpdate(const cc::IntRect& contentRect, const cc::IntSize&, float, float, cc::IntRect& resultingOpaqueRect, cc::RenderingStats&) OVERRIDE;
+ virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, cc::RenderingStats&) 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 cc::IntRect&, FakeTiledLayer*);
// Last rect passed to prepareToUpdate().
- const cc::IntRect& lastUpdateRect() const { return m_lastUpdateRect; }
+ const gfx::Rect& lastUpdateRect() const { return m_lastUpdateRect; }
// Number of times prepareToUpdate has been invoked.
int prepareCount() const { return m_prepareCount; }
@@ -55,7 +55,7 @@ public:
void clearUpdateCount() { m_updateCount = 0; }
void update() { m_updateCount++; }
- void setOpaquePaintRect(const cc::IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; }
+ void setOpaquePaintRect(const gfx::Rect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; }
protected:
virtual ~FakeLayerUpdater();
@@ -64,8 +64,8 @@ private:
int m_prepareCount;
int m_updateCount;
cc::IntRect m_rectToInvalidate;
- cc::IntRect m_lastUpdateRect;
- cc::IntRect m_opaquePaintRect;
+ gfx::Rect m_lastUpdateRect;
+ gfx::Rect m_opaquePaintRect;
scoped_refptr<FakeTiledLayer> m_layer;
};
diff --git a/cc/texture.cc b/cc/texture.cc
index f6400eb..0b75834 100644
--- a/cc/texture.cc
+++ b/cc/texture.cc
@@ -9,7 +9,7 @@
namespace cc {
-void Texture::setDimensions(const IntSize& size, GLenum format)
+void Texture::setDimensions(const gfx::Size& size, GLenum format)
{
m_size = size;
m_format = format;
@@ -17,7 +17,7 @@ void Texture::setDimensions(const IntSize& size, GLenum format)
size_t Texture::bytes() const
{
- if (m_size.isEmpty())
+ if (m_size.IsEmpty())
return 0u;
return memorySizeBytes(m_size, m_format);
@@ -41,7 +41,7 @@ size_t Texture::bytesPerPixel(GLenum format)
return componentsPerPixel * bytesPerComponent;
}
-size_t Texture::memorySizeBytes(const IntSize& size, GLenum format)
+size_t Texture::memorySizeBytes(const gfx::Size& size, GLenum format)
{
return bytesPerPixel(format) * size.width() * size.height();
}
diff --git a/cc/texture.h b/cc/texture.h
index af5d40b..2ab8859 100644
--- a/cc/texture.h
+++ b/cc/texture.h
@@ -5,35 +5,35 @@
#ifndef CCTexture_h
#define CCTexture_h
-#include "IntSize.h"
#include "cc/resource_provider.h"
#include "third_party/khronos/GLES2/gl2.h"
+#include "ui/gfx/size.h"
namespace cc {
class Texture {
public:
Texture() : m_id(0) { }
- Texture(unsigned id, IntSize size, GLenum format)
+ Texture(unsigned id, gfx::Size size, GLenum format)
: m_id(id)
, m_size(size)
, m_format(format) { }
ResourceProvider::ResourceId id() const { return m_id; }
- const IntSize& size() const { return m_size; }
+ const gfx::Size& size() const { return m_size; }
GLenum format() const { return m_format; }
void setId(ResourceProvider::ResourceId id) { m_id = id; }
- void setDimensions(const IntSize&, GLenum format);
+ void setDimensions(const gfx::Size&, GLenum format);
size_t bytes() const;
static size_t bytesPerPixel(GLenum format);
- static size_t memorySizeBytes(const IntSize&, GLenum format);
+ static size_t memorySizeBytes(const gfx::Size&, GLenum format);
private:
ResourceProvider::ResourceId m_id;
- IntSize m_size;
+ gfx::Size m_size;
GLenum m_format;
};
diff --git a/cc/texture_uploader.cc b/cc/texture_uploader.cc
index 50e759e..6d4dc4f 100644
--- a/cc/texture_uploader.cc
+++ b/cc/texture_uploader.cc
@@ -16,6 +16,8 @@
#include "cc/prioritized_texture.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/vector2d.h"
#include <public/WebGraphicsContext3D.h>
namespace {
@@ -147,16 +149,16 @@ void TextureUploader::endQuery()
m_numBlockingTextureUploads++;
}
-void TextureUploader::upload(const uint8_t* image,
- const IntRect& image_rect,
- const IntRect& source_rect,
- const IntSize& dest_offset,
+void TextureUploader::upload(const uint8* image,
+ const gfx::Rect& image_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Vector2d& dest_offset,
GLenum format,
- IntSize size)
+ const gfx::Size& size)
{
- CHECK(image_rect.contains(source_rect));
+ CHECK(image_rect.Contains(source_rect));
- bool isFullUpload = dest_offset.isZero() && source_rect.size() == size;
+ bool isFullUpload = dest_offset.IsZero() && source_rect.size() == size;
if (isFullUpload)
beginQuery();
@@ -173,10 +175,10 @@ void TextureUploader::upload(const uint8_t* image,
endQuery();
}
-void TextureUploader::uploadWithTexSubImage(const uint8_t* image,
- const IntRect& image_rect,
- const IntRect& source_rect,
- const IntSize& dest_offset,
+void TextureUploader::uploadWithTexSubImage(const uint8* image,
+ const gfx::Rect& image_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Vector2d& dest_offset,
GLenum format)
{
// Instrumentation to debug issue 156107
@@ -188,8 +190,8 @@ void TextureUploader::uploadWithTexSubImage(const uint8_t* image,
int image_rect_y = image_rect.y();
int image_rect_width = image_rect.width();
int image_rect_height = image_rect.height();
- int dest_offset_width = dest_offset.width();
- int dest_offset_height = dest_offset.height();
+ int dest_offset_x = dest_offset.x();
+ int dest_offset_y = dest_offset.y();
base::debug::Alias(&image);
base::debug::Alias(&source_rect_x);
base::debug::Alias(&source_rect_y);
@@ -199,15 +201,14 @@ void TextureUploader::uploadWithTexSubImage(const uint8_t* image,
base::debug::Alias(&image_rect_y);
base::debug::Alias(&image_rect_width);
base::debug::Alias(&image_rect_height);
- base::debug::Alias(&dest_offset_width);
- base::debug::Alias(&dest_offset_height);
+ base::debug::Alias(&dest_offset_x);
+ base::debug::Alias(&dest_offset_y);
TRACE_EVENT0("cc", "TextureUploader::uploadWithTexSubImage");
// Offset from image-rect to source-rect.
- IntPoint offset(source_rect.x() - image_rect.x(),
- source_rect.y() - image_rect.y());
+ gfx::Vector2d offset(source_rect.origin() - image_rect.origin());
- const uint8_t* pixel_source;
+ const uint8* pixel_source;
unsigned int bytes_per_pixel = Texture::bytesPerPixel(format);
if (image_rect.width() == source_rect.width() && !offset.x()) {
@@ -215,7 +216,7 @@ void TextureUploader::uploadWithTexSubImage(const uint8_t* image,
} else {
size_t needed_size = source_rect.width() * source_rect.height() * bytes_per_pixel;
if (m_subImageSize < needed_size) {
- m_subImage.reset(new uint8_t[needed_size]);
+ m_subImage.reset(new uint8[needed_size]);
m_subImageSize = needed_size;
}
// Strides not equal, so do a row-by-row memcpy from the
@@ -231,8 +232,8 @@ void TextureUploader::uploadWithTexSubImage(const uint8_t* image,
m_context->texSubImage2D(GL_TEXTURE_2D,
0,
- dest_offset.width(),
- dest_offset.height(),
+ dest_offset.x(),
+ dest_offset.y(),
source_rect.width(),
source_rect.height(),
format,
@@ -240,10 +241,10 @@ void TextureUploader::uploadWithTexSubImage(const uint8_t* image,
pixel_source);
}
-void TextureUploader::uploadWithMapTexSubImage(const uint8_t* image,
- const IntRect& image_rect,
- const IntRect& source_rect,
- const IntSize& dest_offset,
+void TextureUploader::uploadWithMapTexSubImage(const uint8* image,
+ const gfx::Rect& image_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Vector2d& dest_offset,
GLenum format)
{
// Instrumentation to debug issue 156107
@@ -255,8 +256,8 @@ void TextureUploader::uploadWithMapTexSubImage(const uint8_t* image,
int image_rect_y = image_rect.y();
int image_rect_width = image_rect.width();
int image_rect_height = image_rect.height();
- int dest_offset_width = dest_offset.width();
- int dest_offset_height = dest_offset.height();
+ int dest_offset_x = dest_offset.x();
+ int dest_offset_y = dest_offset.y();
base::debug::Alias(&image);
base::debug::Alias(&source_rect_x);
base::debug::Alias(&source_rect_y);
@@ -266,21 +267,20 @@ void TextureUploader::uploadWithMapTexSubImage(const uint8_t* image,
base::debug::Alias(&image_rect_y);
base::debug::Alias(&image_rect_width);
base::debug::Alias(&image_rect_height);
- base::debug::Alias(&dest_offset_width);
- base::debug::Alias(&dest_offset_height);
+ base::debug::Alias(&dest_offset_x);
+ base::debug::Alias(&dest_offset_y);
TRACE_EVENT0("cc", "TextureUploader::uploadWithMapTexSubImage");
// Offset from image-rect to source-rect.
- IntPoint offset(source_rect.x() - image_rect.x(),
- source_rect.y() - image_rect.y());
+ gfx::Vector2d offset(source_rect.origin() - image_rect.origin());
// Upload tile data via a mapped transfer buffer
- uint8_t* pixel_dest = static_cast<uint8_t*>(
+ uint8* pixel_dest = static_cast<uint8*>(
m_context->mapTexSubImage2DCHROMIUM(GL_TEXTURE_2D,
0,
- dest_offset.width(),
- dest_offset.height(),
+ dest_offset.x(),
+ dest_offset.y(),
source_rect.width(),
source_rect.height(),
format,
diff --git a/cc/texture_uploader.h b/cc/texture_uploader.h
index c317f05..f2a964d 100644
--- a/cc/texture_uploader.h
+++ b/cc/texture_uploader.h
@@ -5,7 +5,6 @@
#ifndef CC_TEXTURE_UPLOADER_H_
#define CC_TEXTURE_UPLOADER_H_
-#include "IntRect.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "cc/scoped_ptr_deque.h"
@@ -16,6 +15,12 @@ namespace WebKit {
class WebGraphicsContext3D;
}
+namespace gfx {
+class Rect;
+class Size;
+class Vector2d;
+}
+
namespace cc {
class TextureUploader {
@@ -35,12 +40,12 @@ public:
// imageRect, expressed in the same coordinate system as imageRect. Let
// image be a buffer for imageRect. This function will copy the region
// corresponding to sourceRect to destOffset in this sub-image.
- void upload(const uint8_t* image,
- const IntRect& content_rect,
- const IntRect& source_rect,
- const IntSize& dest_offset,
+ void upload(const uint8* image,
+ const gfx::Rect& content_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Vector2d& dest_offset,
GLenum format,
- IntSize size);
+ const gfx::Size& size);
private:
class Query {
@@ -73,15 +78,15 @@ private:
void endQuery();
void processQueries();
- void uploadWithTexSubImage(const uint8_t* image,
- const IntRect& image_rect,
- const IntRect& source_rect,
- const IntSize& dest_offset,
+ void uploadWithTexSubImage(const uint8* image,
+ const gfx::Rect& image_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Vector2d& dest_offset,
GLenum format);
- void uploadWithMapTexSubImage(const uint8_t* image,
- const IntRect& image_rect,
- const IntRect& source_rect,
- const IntSize& dest_offset,
+ void uploadWithMapTexSubImage(const uint8* image,
+ const gfx::Rect& image_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Vector2d& dest_offset,
GLenum format);
WebKit::WebGraphicsContext3D* m_context;
@@ -92,7 +97,7 @@ private:
bool m_useMapTexSubImage;
size_t m_subImageSize;
- scoped_array<uint8_t> m_subImage;
+ scoped_array<uint8> m_subImage;
DISALLOW_COPY_AND_ASSIGN(TextureUploader);
};
diff --git a/cc/texture_uploader_unittest.cc b/cc/texture_uploader_unittest.cc
index 2da921e..783ea86 100644
--- a/cc/texture_uploader_unittest.cc
+++ b/cc/texture_uploader_unittest.cc
@@ -44,11 +44,11 @@ private:
void uploadTexture(TextureUploader* uploader)
{
- IntSize size(256, 256);
+ gfx::Size size(256, 256);
uploader->upload(NULL,
- IntRect(IntPoint(0, 0), size),
- IntRect(IntPoint(0, 0), size),
- IntSize(),
+ gfx::Rect(gfx::Point(0, 0), size),
+ gfx::Rect(gfx::Point(0, 0), size),
+ gfx::Vector2d(),
GL_RGBA,
size);
}
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc
index e9a15a5..b21d911 100644
--- a/cc/tiled_layer.cc
+++ b/cc/tiled_layer.cc
@@ -459,7 +459,7 @@ void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
// However, we can't free the memory backing the SkCanvas until the paint finishes,
// so we grab a local reference here to hold the updater alive until the paint completes.
scoped_refptr<LayerUpdater> protector(updater());
- IntRect paintedOpaqueRect;
+ gfx::Rect paintedOpaqueRect;
updater()->prepareToUpdate(paintRect, m_tiler->tileSize(), 1 / widthScale, 1 / heightScale, paintedOpaqueRect, stats);
for (int j = top; j <= bottom; ++j) {
@@ -480,7 +480,7 @@ void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
// Save what was painted opaque in the tile. Keep the old area if the paint didn't touch it, and didn't paint some
// other part of the tile opaque.
IntRect tilePaintedRect = intersection(tileRect, paintRect);
- IntRect tilePaintedOpaqueRect = intersection(tileRect, paintedOpaqueRect);
+ IntRect tilePaintedOpaqueRect = intersection(tileRect, cc::IntRect(paintedOpaqueRect));
if (!tilePaintedRect.isEmpty()) {
IntRect paintInsideTileOpaqueRect = intersection(tile->opaqueRect(), tilePaintedRect);
bool paintInsideTileOpaqueRectIsNonOpaque = !tilePaintedOpaqueRect.contains(paintInsideTileOpaqueRect);
@@ -505,14 +505,14 @@ void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
const IntPoint anchor = m_tiler->tileRect(tile).location();
// Calculate tile-space rectangle to upload into.
- IntSize destOffset(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y());
- if (destOffset.width() < 0)
+ gfx::Vector2d destOffset(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y());
+ if (destOffset.x() < 0)
CRASH();
- if (destOffset.height() < 0)
+ if (destOffset.y() < 0)
CRASH();
// Offset from paint rectangle to this tile's dirty rectangle.
- IntPoint paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y() - paintRect.y());
+ gfx::Vector2d paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y() - paintRect.y());
if (paintOffset.x() < 0)
CRASH();
if (paintOffset.y() < 0)
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index c499cc3..d219114 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -1529,18 +1529,18 @@ class TrackingLayerPainter : public LayerPainter {
public:
static scoped_ptr<TrackingLayerPainter> create() { return make_scoped_ptr(new TrackingLayerPainter()); }
- virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect&) OVERRIDE
+ virtual void paint(SkCanvas*, const gfx::Rect& contentRect, gfx::RectF&) OVERRIDE
{
m_paintedRect = contentRect;
}
- const IntRect& paintedRect() const { return m_paintedRect; }
- void resetPaintedRect() { m_paintedRect = IntRect(); }
+ const gfx::Rect& paintedRect() const { return m_paintedRect; }
+ void resetPaintedRect() { m_paintedRect = gfx::Rect(); }
private:
TrackingLayerPainter() { }
- IntRect m_paintedRect;
+ gfx::Rect m_paintedRect;
};
class UpdateTrackingTiledLayer : public FakeTiledLayer {
diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc
index 43e8864..3380402 100644
--- a/cc/video_layer_impl.cc
+++ b/cc/video_layer_impl.cc
@@ -374,8 +374,8 @@ bool VideoLayerImpl::copyPlaneData(ResourceProvider* resourceProvider)
for (size_t planeIndex = 0; planeIndex < planeCount; ++planeIndex) {
VideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex];
const uint8_t* softwarePlanePixels = m_frame->data(planeIndex);
- IntRect planeRect(IntPoint(), plane.size);
- resourceProvider->upload(plane.resourceId, softwarePlanePixels, planeRect, planeRect, IntSize());
+ gfx::Rect planeRect(gfx::Point(), plane.size);
+ resourceProvider->upload(plane.resourceId, softwarePlanePixels, planeRect, planeRect, gfx::Vector2d());
}
return true;
}
diff --git a/webkit/compositor_bindings/web_content_layer_impl.cc b/webkit/compositor_bindings/web_content_layer_impl.cc
index d389ba0..c7a26cc 100644
--- a/webkit/compositor_bindings/web_content_layer_impl.cc
+++ b/webkit/compositor_bindings/web_content_layer_impl.cc
@@ -73,18 +73,18 @@ void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable)
}
-void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque)
+void WebContentLayerImpl::paintContents(SkCanvas* canvas, const gfx::Rect& clip, gfx::RectF& opaque)
{
if (!m_client)
return;
WebFloatRect webOpaque;
m_client->paintContents(canvas,
- convert(clip),
+ clip,
#if WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT
m_layer->layer()->useLCDText(),
#endif // WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT
webOpaque);
- opaque = convert(webOpaque);
+ opaque = webOpaque;
}
} // namespace WebKit
diff --git a/webkit/compositor_bindings/web_content_layer_impl.h b/webkit/compositor_bindings/web_content_layer_impl.h
index f634d32..0007b91 100644
--- a/webkit/compositor_bindings/web_content_layer_impl.h
+++ b/webkit/compositor_bindings/web_content_layer_impl.h
@@ -41,7 +41,7 @@ protected:
virtual ~WebContentLayerImpl();
// ContentLayerClient implementation.
- virtual void paintContents(SkCanvas*, const cc::IntRect& clip, cc::FloatRect& opaque) OVERRIDE;
+ virtual void paintContents(SkCanvas*, const gfx::Rect& clip, gfx::RectF& opaque) OVERRIDE;
scoped_ptr<WebLayerImpl> m_layer;
WebContentLayerClient* m_client;