cc: Use gfx:: Geometry types for positions, bounds, and related things.
This covers layers, layer tree hosts, and related classes. *phew* I intentionally avoided anything to do with scrolling or page scale. Those should be changed to be Vectors and need a bit more thought. This change should be pretty mindless. It converts to gfx Rect, Size, Vector, and Point classes. No change is made for FloatPoint3D or FloatQuad yet. I've added cc/geometry.h as a place for free functions that don't exist on gfx types yet, and that we should port over in the future. No change in behaviour; covered by existing tests. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11264056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165434 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
cc
cc.gypcontents_scaling_layer.cccontents_scaling_layer.hcontents_scaling_layer_unittest.ccdamage_tracker.ccdamage_tracker.hdamage_tracker_unittest.ccdebug_rect_history.ccdebug_rect_history.hdelegated_renderer_layer_impl_unittest.ccdraw_quad_unittest.ccfont_atlas.ccfont_atlas.hgeometry.hgl_renderer.ccgl_renderer.hgl_renderer_unittest.ccheads_up_display_layer_impl.ccimage_layer.ccimage_layer.hio_surface_layer_impl.ccio_surface_layer_impl.hlayer.cclayer.hlayer_impl.cclayer_impl.hlayer_iterator_unittest.cclayer_quad.cclayer_quad.hlayer_sorter.cclayer_sorter.hlayer_tiling_data.cclayer_tiling_data.hlayer_tree_host.cclayer_tree_host.hlayer_tree_host_common.cclayer_tree_host_common.hlayer_tree_host_common_unittest.cclayer_tree_host_impl.cclayer_tree_host_impl.hlayer_tree_host_impl_unittest.cclayer_tree_host_unittest.cclayer_unittest.ccmath_util.ccmath_util.hmath_util_unittest.ccocclusion_tracker.ccocclusion_tracker_unittest.ccoverdraw_metrics.ccpriority_calculator.ccpriority_calculator.hproxy.hquad_culler_unittest.ccrender_pass.ccrender_surface.ccrender_surface.hrender_surface_impl.ccrender_surface_impl.hrenderer.hscoped_texture.ccscoped_texture.hscrollbar_animation_controller.ccscrollbar_animation_controller.hscrollbar_layer.ccscrollbar_layer.hscrollbar_layer_impl.ccsingle_thread_proxy.ccsingle_thread_proxy.hsoftware_renderer.ccsoftware_renderer.hsoftware_renderer_unittest.cc
stubs
test
texture_layer.cctexture_layer.htexture_layer_impl.cctexture_layer_impl.hthread_proxy.ccthread_proxy.htile_draw_quad.cctile_draw_quad.htiled_layer.cctiled_layer.htiled_layer_impl.cctiled_layer_impl.htiled_layer_impl_unittest.cctiled_layer_unittest.cctree_synchronizer_unittest.ccvideo_layer_impl.ccwebkit/compositor_bindings
@ -46,6 +46,7 @@
|
||||
'frame_rate_controller.h',
|
||||
'frame_rate_counter.cc',
|
||||
'frame_rate_counter.h',
|
||||
'geometry.h',
|
||||
'graphics_context.h',
|
||||
'heads_up_display_layer_impl.cc',
|
||||
'heads_up_display_layer_impl.h',
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "cc/contents_scaling_layer.h"
|
||||
#include "ui/gfx/size_conversions.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
@ -15,9 +16,8 @@ ContentsScalingLayer::ContentsScalingLayer()
|
||||
ContentsScalingLayer::~ContentsScalingLayer() {
|
||||
}
|
||||
|
||||
IntSize ContentsScalingLayer::contentBounds() const {
|
||||
return IntSize(ceil(bounds().width() * contentsScaleX()),
|
||||
ceil(bounds().height() * contentsScaleY()));
|
||||
gfx::Size ContentsScalingLayer::contentBounds() const {
|
||||
return gfx::ToCeiledSize(bounds().Scale(contentsScaleX(), contentsScaleY()));
|
||||
}
|
||||
|
||||
float ContentsScalingLayer::contentsScaleX() const {
|
||||
|
@ -13,7 +13,7 @@ namespace cc {
|
||||
// The content bounds are determined by bounds and scale of the contents.
|
||||
class ContentsScalingLayer : public Layer {
|
||||
public:
|
||||
virtual IntSize contentBounds() const OVERRIDE;
|
||||
virtual gfx::Size contentBounds() const OVERRIDE;
|
||||
virtual float contentsScaleX() const OVERRIDE;
|
||||
virtual float contentsScaleY() const OVERRIDE;
|
||||
virtual void setContentsScale(float contentsScale) OVERRIDE;
|
||||
|
@ -17,7 +17,7 @@ class MockContentsScalingLayer : public ContentsScalingLayer {
|
||||
: ContentsScalingLayer() {
|
||||
}
|
||||
|
||||
virtual void setNeedsDisplayRect(const FloatRect& dirtyRect) OVERRIDE {
|
||||
virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect) OVERRIDE {
|
||||
m_lastNeedsDisplayRect = dirtyRect;
|
||||
ContentsScalingLayer::setNeedsDisplayRect(dirtyRect);
|
||||
}
|
||||
@ -26,7 +26,7 @@ class MockContentsScalingLayer : public ContentsScalingLayer {
|
||||
m_needsDisplay = false;
|
||||
}
|
||||
|
||||
const FloatRect& lastNeedsDisplayRect() const {
|
||||
const gfx::RectF& lastNeedsDisplayRect() const {
|
||||
return m_lastNeedsDisplayRect;
|
||||
}
|
||||
|
||||
@ -34,14 +34,14 @@ class MockContentsScalingLayer : public ContentsScalingLayer {
|
||||
virtual ~MockContentsScalingLayer() {
|
||||
}
|
||||
|
||||
FloatRect m_lastNeedsDisplayRect;
|
||||
gfx::RectF m_lastNeedsDisplayRect;
|
||||
};
|
||||
|
||||
TEST(ContentsScalingLayerTest, checkContentsBounds) {
|
||||
scoped_refptr<MockContentsScalingLayer> testLayer =
|
||||
make_scoped_refptr(new MockContentsScalingLayer());
|
||||
|
||||
testLayer->setBounds(IntSize(320, 240));
|
||||
testLayer->setBounds(gfx::Size(320, 240));
|
||||
EXPECT_FLOAT_EQ(1.0, testLayer->contentsScaleX());
|
||||
EXPECT_FLOAT_EQ(1.0, testLayer->contentsScaleY());
|
||||
EXPECT_EQ(320, testLayer->contentBounds().width());
|
||||
@ -51,7 +51,7 @@ TEST(ContentsScalingLayerTest, checkContentsBounds) {
|
||||
EXPECT_EQ(640, testLayer->contentBounds().width());
|
||||
EXPECT_EQ(480, testLayer->contentBounds().height());
|
||||
|
||||
testLayer->setBounds(IntSize(10, 20));
|
||||
testLayer->setBounds(gfx::Size(10, 20));
|
||||
EXPECT_EQ(20, testLayer->contentBounds().width());
|
||||
EXPECT_EQ(40, testLayer->contentBounds().height());
|
||||
|
||||
@ -64,13 +64,13 @@ TEST(ContentsScalingLayerTest, checkContentsScaleChangeTriggersNeedsDisplay) {
|
||||
scoped_refptr<MockContentsScalingLayer> testLayer =
|
||||
make_scoped_refptr(new MockContentsScalingLayer());
|
||||
|
||||
testLayer->setBounds(IntSize(320, 240));
|
||||
testLayer->setBounds(gfx::Size(320, 240));
|
||||
|
||||
testLayer->resetNeedsDisplay();
|
||||
EXPECT_FALSE(testLayer->needsDisplay());
|
||||
|
||||
testLayer->setContentsScale(testLayer->contentsScaleX() + 1.f);
|
||||
EXPECT_TRUE(testLayer->needsDisplay());
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 320, 240),
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 320, 240),
|
||||
testLayer->lastNeedsDisplayRect());
|
||||
}
|
||||
|
@ -32,26 +32,25 @@ DamageTracker::~DamageTracker()
|
||||
{
|
||||
}
|
||||
|
||||
static inline void expandRectWithFilters(FloatRect& rect, const WebKit::WebFilterOperations& filters)
|
||||
static inline void expandRectWithFilters(gfx::RectF& rect, const WebKit::WebFilterOperations& filters)
|
||||
{
|
||||
int top, right, bottom, left;
|
||||
filters.getOutsets(top, right, bottom, left);
|
||||
rect.move(-left, -top);
|
||||
rect.expand(left + right, top + bottom);
|
||||
rect.Inset(-left, -top, -right, -bottom);
|
||||
}
|
||||
|
||||
static inline void expandDamageRectInsideRectWithFilters(FloatRect& damageRect, const FloatRect& preFilterRect, const WebKit::WebFilterOperations& filters)
|
||||
static inline void expandDamageRectInsideRectWithFilters(gfx::RectF& damageRect, const gfx::RectF& preFilterRect, const WebKit::WebFilterOperations& filters)
|
||||
{
|
||||
FloatRect expandedDamageRect = damageRect;
|
||||
gfx::RectF expandedDamageRect = damageRect;
|
||||
expandRectWithFilters(expandedDamageRect, filters);
|
||||
FloatRect filterRect = preFilterRect;
|
||||
gfx::RectF filterRect = preFilterRect;
|
||||
expandRectWithFilters(filterRect, filters);
|
||||
|
||||
expandedDamageRect.intersect(filterRect);
|
||||
damageRect.unite(expandedDamageRect);
|
||||
expandedDamageRect.Intersect(filterRect);
|
||||
damageRect.Union(expandedDamageRect);
|
||||
}
|
||||
|
||||
void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters, SkImageFilter* filter)
|
||||
void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters, SkImageFilter* filter)
|
||||
{
|
||||
//
|
||||
// This function computes the "damage rect" of a target surface, and updates the state
|
||||
@ -119,11 +118,11 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
|
||||
// These functions cannot be bypassed with early-exits, even if we know what the
|
||||
// damage will be for this frame, because we need to update the damage tracker state
|
||||
// to correctly track the next frame.
|
||||
FloatRect damageFromActiveLayers = trackDamageFromActiveLayers(layerList, targetSurfaceLayerID);
|
||||
FloatRect damageFromSurfaceMask = trackDamageFromSurfaceMask(targetSurfaceMaskLayer);
|
||||
FloatRect damageFromLeftoverRects = trackDamageFromLeftoverRects();
|
||||
gfx::RectF damageFromActiveLayers = trackDamageFromActiveLayers(layerList, targetSurfaceLayerID);
|
||||
gfx::RectF damageFromSurfaceMask = trackDamageFromSurfaceMask(targetSurfaceMaskLayer);
|
||||
gfx::RectF damageFromLeftoverRects = trackDamageFromLeftoverRects();
|
||||
|
||||
FloatRect damageRectForThisUpdate;
|
||||
gfx::RectF damageRectForThisUpdate;
|
||||
|
||||
if (m_forceFullDamageNextUpdate || targetSurfacePropertyChangedOnlyFromDescendant) {
|
||||
damageRectForThisUpdate = targetSurfaceContentRect;
|
||||
@ -131,8 +130,8 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
|
||||
} else {
|
||||
// FIXME: can we clamp this damage to the surface's content rect? (affects performance, but not correctness)
|
||||
damageRectForThisUpdate = damageFromActiveLayers;
|
||||
damageRectForThisUpdate.uniteIfNonZero(damageFromSurfaceMask);
|
||||
damageRectForThisUpdate.uniteIfNonZero(damageFromLeftoverRects);
|
||||
damageRectForThisUpdate.Union(damageFromSurfaceMask);
|
||||
damageRectForThisUpdate.Union(damageFromLeftoverRects);
|
||||
|
||||
if (filters.hasFilterThatMovesPixels()) {
|
||||
expandRectWithFilters(damageRectForThisUpdate, filters);
|
||||
@ -144,7 +143,7 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
|
||||
}
|
||||
|
||||
// Damage accumulates until we are notified that we actually did draw on that frame.
|
||||
m_currentDamageRect.uniteIfNonZero(damageRectForThisUpdate);
|
||||
m_currentDamageRect.Union(damageRectForThisUpdate);
|
||||
|
||||
// The next history map becomes the current map for the next frame. Note this must
|
||||
// happen every frame to correctly track changes, even if damage accumulates over
|
||||
@ -152,19 +151,19 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
|
||||
swap(m_currentRectHistory, m_nextRectHistory);
|
||||
}
|
||||
|
||||
FloatRect DamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIsNew)
|
||||
gfx::RectF DamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIsNew)
|
||||
{
|
||||
RectMap::iterator iter = m_currentRectHistory->find(layerID);
|
||||
layerIsNew = iter == m_currentRectHistory->end();
|
||||
if (layerIsNew)
|
||||
return FloatRect();
|
||||
return gfx::RectF();
|
||||
|
||||
FloatRect ret = iter->second;
|
||||
gfx::RectF ret = iter->second;
|
||||
m_currentRectHistory->erase(iter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect)
|
||||
void DamageTracker::saveRectForNextFrame(int layerID, const gfx::RectF& targetSpaceRect)
|
||||
{
|
||||
// This layer should not yet exist in next frame's history.
|
||||
DCHECK(layerID > 0);
|
||||
@ -172,9 +171,9 @@ void DamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetSpa
|
||||
(*m_nextRectHistory)[layerID] = targetSpaceRect;
|
||||
}
|
||||
|
||||
FloatRect DamageTracker::trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID)
|
||||
gfx::RectF DamageTracker::trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID)
|
||||
{
|
||||
FloatRect damageRect = FloatRect();
|
||||
gfx::RectF damageRect = gfx::RectF();
|
||||
|
||||
for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) {
|
||||
// Visit layers in back-to-front order.
|
||||
@ -189,9 +188,9 @@ FloatRect DamageTracker::trackDamageFromActiveLayers(const std::vector<LayerImpl
|
||||
return damageRect;
|
||||
}
|
||||
|
||||
FloatRect DamageTracker::trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer)
|
||||
gfx::RectF DamageTracker::trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer)
|
||||
{
|
||||
FloatRect damageRect = FloatRect();
|
||||
gfx::RectF damageRect = gfx::RectF();
|
||||
|
||||
if (!targetSurfaceMaskLayer)
|
||||
return damageRect;
|
||||
@ -199,22 +198,22 @@ FloatRect DamageTracker::trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMask
|
||||
// Currently, if there is any change to the mask, we choose to damage the entire
|
||||
// surface. This could potentially be optimized later, but it is not expected to be a
|
||||
// common case.
|
||||
if (targetSurfaceMaskLayer->layerPropertyChanged() || !targetSurfaceMaskLayer->updateRect().isEmpty())
|
||||
damageRect = FloatRect(FloatPoint::zero(), FloatSize(targetSurfaceMaskLayer->bounds()));
|
||||
if (targetSurfaceMaskLayer->layerPropertyChanged() || !targetSurfaceMaskLayer->updateRect().IsEmpty())
|
||||
damageRect = gfx::RectF(gfx::PointF(), targetSurfaceMaskLayer->bounds());
|
||||
|
||||
return damageRect;
|
||||
}
|
||||
|
||||
FloatRect DamageTracker::trackDamageFromLeftoverRects()
|
||||
gfx::RectF DamageTracker::trackDamageFromLeftoverRects()
|
||||
{
|
||||
// After computing damage for all active layers, any leftover items in the current
|
||||
// rect history correspond to layers/surfaces that no longer exist. So, these regions
|
||||
// are now exposed on the target surface.
|
||||
|
||||
FloatRect damageRect = FloatRect();
|
||||
gfx::RectF damageRect = gfx::RectF();
|
||||
|
||||
for (RectMap::iterator it = m_currentRectHistory->begin(); it != m_currentRectHistory->end(); ++it)
|
||||
damageRect.unite(it->second);
|
||||
damageRect.Union(it->second);
|
||||
|
||||
m_currentRectHistory->clear();
|
||||
|
||||
@ -233,7 +232,7 @@ static bool layerNeedsToRedrawOntoItsTargetSurface(LayerImpl* layer)
|
||||
return layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged();
|
||||
}
|
||||
|
||||
void DamageTracker::extendDamageForLayer(LayerImpl* layer, FloatRect& targetDamageRect)
|
||||
void DamageTracker::extendDamageForLayer(LayerImpl* layer, gfx::RectF& targetDamageRect)
|
||||
{
|
||||
// There are two ways that a layer can damage a region of the target surface:
|
||||
// 1. Property change (e.g. opacity, position, transforms):
|
||||
@ -252,28 +251,28 @@ void DamageTracker::extendDamageForLayer(LayerImpl* layer, FloatRect& targetDama
|
||||
// extendDamageForRenderSurface() must be called instead.
|
||||
|
||||
bool layerIsNew = false;
|
||||
FloatRect oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), layerIsNew);
|
||||
gfx::RectF oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), layerIsNew);
|
||||
|
||||
FloatRect rectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds()));
|
||||
gfx::RectF rectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), gfx::RectF(FloatPoint(), layer->contentBounds()));
|
||||
saveRectForNextFrame(layer->id(), rectInTargetSpace);
|
||||
|
||||
if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) {
|
||||
// If a layer is new or has changed, then its entire layer rect affects the target surface.
|
||||
targetDamageRect.uniteIfNonZero(rectInTargetSpace);
|
||||
targetDamageRect.Union(rectInTargetSpace);
|
||||
|
||||
// The layer's old region is now exposed on the target surface, too.
|
||||
// Note oldRectInTargetSpace is already in target space.
|
||||
targetDamageRect.uniteIfNonZero(oldRectInTargetSpace);
|
||||
} else if (!layer->updateRect().isEmpty()) {
|
||||
targetDamageRect.Union(oldRectInTargetSpace);
|
||||
} else if (!layer->updateRect().IsEmpty()) {
|
||||
// If the layer properties haven't changed, then the the target surface is only
|
||||
// affected by the layer's update area, which could be empty.
|
||||
FloatRect updateContentRect = layer->layerRectToContentRect(layer->updateRect());
|
||||
FloatRect updateRectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), updateContentRect);
|
||||
targetDamageRect.uniteIfNonZero(updateRectInTargetSpace);
|
||||
gfx::RectF updateContentRect = layer->layerRectToContentRect(layer->updateRect());
|
||||
gfx::RectF updateRectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), updateContentRect);
|
||||
targetDamageRect.Union(updateRectInTargetSpace);
|
||||
}
|
||||
}
|
||||
|
||||
void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& targetDamageRect)
|
||||
void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, gfx::RectF& targetDamageRect)
|
||||
{
|
||||
// There are two ways a "descendant surface" can damage regions of the "target surface":
|
||||
// 1. Property change:
|
||||
@ -290,32 +289,32 @@ void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta
|
||||
RenderSurfaceImpl* renderSurface = layer->renderSurface();
|
||||
|
||||
bool surfaceIsNew = false;
|
||||
FloatRect oldSurfaceRect = removeRectFromCurrentFrame(layer->id(), surfaceIsNew);
|
||||
gfx::RectF oldSurfaceRect = removeRectFromCurrentFrame(layer->id(), surfaceIsNew);
|
||||
|
||||
FloatRect surfaceRectInTargetSpace = renderSurface->drawableContentRect(); // already includes replica if it exists.
|
||||
gfx::RectF surfaceRectInTargetSpace = renderSurface->drawableContentRect(); // already includes replica if it exists.
|
||||
saveRectForNextFrame(layer->id(), surfaceRectInTargetSpace);
|
||||
|
||||
FloatRect damageRectInLocalSpace;
|
||||
gfx::RectF damageRectInLocalSpace;
|
||||
if (surfaceIsNew || renderSurface->surfacePropertyChanged() || layer->layerSurfacePropertyChanged()) {
|
||||
// The entire surface contributes damage.
|
||||
damageRectInLocalSpace = renderSurface->contentRect();
|
||||
|
||||
// The surface's old region is now exposed on the target surface, too.
|
||||
targetDamageRect.uniteIfNonZero(oldSurfaceRect);
|
||||
targetDamageRect.Union(oldSurfaceRect);
|
||||
} else {
|
||||
// Only the surface's damageRect will damage the target surface.
|
||||
damageRectInLocalSpace = renderSurface->damageTracker()->currentDamageRect();
|
||||
}
|
||||
|
||||
// If there was damage, transform it to target space, and possibly contribute its reflection if needed.
|
||||
if (!damageRectInLocalSpace.isEmpty()) {
|
||||
if (!damageRectInLocalSpace.IsEmpty()) {
|
||||
const WebTransformationMatrix& drawTransform = renderSurface->drawTransform();
|
||||
FloatRect damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransform, damageRectInLocalSpace);
|
||||
targetDamageRect.uniteIfNonZero(damageRectInTargetSpace);
|
||||
gfx::RectF damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransform, damageRectInLocalSpace);
|
||||
targetDamageRect.Union(damageRectInTargetSpace);
|
||||
|
||||
if (layer->replicaLayer()) {
|
||||
const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform();
|
||||
targetDamageRect.uniteIfNonZero(MathUtil::mapClippedRect(replicaDrawTransform, damageRectInLocalSpace));
|
||||
targetDamageRect.Union(MathUtil::mapClippedRect(replicaDrawTransform, damageRectInLocalSpace));
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,12 +326,12 @@ void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta
|
||||
removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew);
|
||||
|
||||
const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform();
|
||||
FloatRect replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTransform, FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height())));
|
||||
gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTransform, gfx::RectF(FloatPoint(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height())));
|
||||
saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect);
|
||||
|
||||
// In the current implementation, a change in the replica mask damages the entire replica region.
|
||||
if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replicaMaskLayer->updateRect().isEmpty())
|
||||
targetDamageRect.uniteIfNonZero(replicaMaskLayerRect);
|
||||
if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replicaMaskLayer->updateRect().IsEmpty())
|
||||
targetDamageRect.Union(replicaMaskLayerRect);
|
||||
}
|
||||
|
||||
// If the layer has a background filter, this may cause pixels in our surface to be expanded, so we will need to expand any damage
|
||||
|
@ -7,15 +7,19 @@
|
||||
|
||||
#include "base/hash_tables.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "FloatRect.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <vector>
|
||||
|
||||
class SkImageFilter;
|
||||
|
||||
namespace gfx {
|
||||
class Rect;
|
||||
}
|
||||
|
||||
namespace WebKit {
|
||||
class WebFilterOperations;
|
||||
}
|
||||
|
||||
class SkImageFilter;
|
||||
|
||||
namespace cc {
|
||||
|
||||
class LayerImpl;
|
||||
@ -28,34 +32,34 @@ public:
|
||||
static scoped_ptr<DamageTracker> create();
|
||||
~DamageTracker();
|
||||
|
||||
void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); }
|
||||
void didDrawDamagedArea() { m_currentDamageRect = gfx::RectF(); }
|
||||
void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
|
||||
void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&, SkImageFilter* filter);
|
||||
void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&, SkImageFilter* filter);
|
||||
|
||||
const FloatRect& currentDamageRect() { return m_currentDamageRect; }
|
||||
const gfx::RectF& currentDamageRect() { return m_currentDamageRect; }
|
||||
|
||||
private:
|
||||
DamageTracker();
|
||||
|
||||
FloatRect trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID);
|
||||
FloatRect trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer);
|
||||
FloatRect trackDamageFromLeftoverRects();
|
||||
gfx::RectF trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID);
|
||||
gfx::RectF trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer);
|
||||
gfx::RectF trackDamageFromLeftoverRects();
|
||||
|
||||
FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
|
||||
void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect);
|
||||
gfx::RectF removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
|
||||
void saveRectForNextFrame(int layerID, const gfx::RectF& targetSpaceRect);
|
||||
|
||||
// These helper functions are used only in trackDamageFromActiveLayers().
|
||||
void extendDamageForLayer(LayerImpl*, FloatRect& targetDamageRect);
|
||||
void extendDamageForRenderSurface(LayerImpl*, FloatRect& targetDamageRect);
|
||||
void extendDamageForLayer(LayerImpl*, gfx::RectF& targetDamageRect);
|
||||
void extendDamageForRenderSurface(LayerImpl*, gfx::RectF& targetDamageRect);
|
||||
|
||||
// To correctly track exposed regions, two hashtables of rects are maintained.
|
||||
// The "current" map is used to compute exposed regions of the current frame, while
|
||||
// the "next" map is used to collect layer rects that are used in the next frame.
|
||||
typedef base::hash_map<int, FloatRect> RectMap;
|
||||
typedef base::hash_map<int, gfx::RectF> RectMap;
|
||||
scoped_ptr<RectMap> m_currentRectHistory;
|
||||
scoped_ptr<RectMap> m_nextRectHistory;
|
||||
|
||||
FloatRect m_currentDamageRect;
|
||||
gfx::RectF m_currentDamageRect;
|
||||
bool m_forceFullDamageNextUpdate;
|
||||
};
|
||||
|
||||
|
@ -71,18 +71,18 @@ scoped_ptr<LayerImpl> createTestTreeWithOneSurface()
|
||||
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
||||
scoped_ptr<LayerImpl> child = LayerImpl::create(2);
|
||||
|
||||
root->setPosition(FloatPoint::zero());
|
||||
root->setAnchorPoint(FloatPoint::zero());
|
||||
root->setBounds(IntSize(500, 500));
|
||||
root->setContentBounds(IntSize(500, 500));
|
||||
root->setPosition(gfx::PointF());
|
||||
root->setAnchorPoint(gfx::PointF());
|
||||
root->setBounds(gfx::Size(500, 500));
|
||||
root->setContentBounds(gfx::Size(500, 500));
|
||||
root->setDrawsContent(true);
|
||||
root->createRenderSurface();
|
||||
root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500)));
|
||||
root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
|
||||
|
||||
child->setPosition(FloatPoint(100, 100));
|
||||
child->setAnchorPoint(FloatPoint::zero());
|
||||
child->setBounds(IntSize(30, 30));
|
||||
child->setContentBounds(IntSize(30, 30));
|
||||
child->setPosition(gfx::PointF(100, 100));
|
||||
child->setAnchorPoint(gfx::PointF());
|
||||
child->setBounds(gfx::Size(30, 30));
|
||||
child->setContentBounds(gfx::Size(30, 30));
|
||||
child->setDrawsContent(true);
|
||||
root->addChild(child.Pass());
|
||||
|
||||
@ -101,37 +101,37 @@ scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces()
|
||||
scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4);
|
||||
scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(5);
|
||||
|
||||
root->setPosition(FloatPoint::zero());
|
||||
root->setAnchorPoint(FloatPoint::zero());
|
||||
root->setBounds(IntSize(500, 500));
|
||||
root->setContentBounds(IntSize(500, 500));
|
||||
root->setPosition(gfx::PointF());
|
||||
root->setAnchorPoint(gfx::PointF());
|
||||
root->setBounds(gfx::Size(500, 500));
|
||||
root->setContentBounds(gfx::Size(500, 500));
|
||||
root->setDrawsContent(true);
|
||||
root->createRenderSurface();
|
||||
root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500)));
|
||||
root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
|
||||
|
||||
child1->setPosition(FloatPoint(100, 100));
|
||||
child1->setAnchorPoint(FloatPoint::zero());
|
||||
child1->setBounds(IntSize(30, 30));
|
||||
child1->setContentBounds(IntSize(30, 30));
|
||||
child1->setPosition(gfx::PointF(100, 100));
|
||||
child1->setAnchorPoint(gfx::PointF());
|
||||
child1->setBounds(gfx::Size(30, 30));
|
||||
child1->setContentBounds(gfx::Size(30, 30));
|
||||
child1->setOpacity(0.5); // with a child that drawsContent, this will cause the layer to create its own renderSurface.
|
||||
child1->setDrawsContent(false); // this layer does not draw, but is intended to create its own renderSurface.
|
||||
|
||||
child2->setPosition(FloatPoint(11, 11));
|
||||
child2->setAnchorPoint(FloatPoint::zero());
|
||||
child2->setBounds(IntSize(18, 18));
|
||||
child2->setContentBounds(IntSize(18, 18));
|
||||
child2->setPosition(gfx::PointF(11, 11));
|
||||
child2->setAnchorPoint(gfx::PointF());
|
||||
child2->setBounds(gfx::Size(18, 18));
|
||||
child2->setContentBounds(gfx::Size(18, 18));
|
||||
child2->setDrawsContent(true);
|
||||
|
||||
grandChild1->setPosition(FloatPoint(200, 200));
|
||||
grandChild1->setAnchorPoint(FloatPoint::zero());
|
||||
grandChild1->setBounds(IntSize(6, 8));
|
||||
grandChild1->setContentBounds(IntSize(6, 8));
|
||||
grandChild1->setPosition(gfx::PointF(200, 200));
|
||||
grandChild1->setAnchorPoint(gfx::PointF());
|
||||
grandChild1->setBounds(gfx::Size(6, 8));
|
||||
grandChild1->setContentBounds(gfx::Size(6, 8));
|
||||
grandChild1->setDrawsContent(true);
|
||||
|
||||
grandChild2->setPosition(FloatPoint(190, 190));
|
||||
grandChild2->setAnchorPoint(FloatPoint::zero());
|
||||
grandChild2->setBounds(IntSize(6, 8));
|
||||
grandChild2->setContentBounds(IntSize(6, 8));
|
||||
grandChild2->setPosition(gfx::PointF(190, 190));
|
||||
grandChild2->setAnchorPoint(gfx::PointF());
|
||||
grandChild2->setBounds(gfx::Size(6, 8));
|
||||
grandChild2->setContentBounds(gfx::Size(6, 8));
|
||||
grandChild2->setDrawsContent(true);
|
||||
|
||||
child1->addChild(grandChild1.Pass());
|
||||
@ -181,8 +181,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithOneSurface)
|
||||
EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id());
|
||||
EXPECT_EQ(2, root->renderSurface()->layerList()[1]->id());
|
||||
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
|
||||
@ -194,8 +194,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
|
||||
|
||||
LayerImpl* child1 = root->children()[0];
|
||||
LayerImpl* child2 = root->children()[1];
|
||||
FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
ASSERT_TRUE(child1->renderSurface());
|
||||
EXPECT_FALSE(child2->renderSurface());
|
||||
@ -203,8 +203,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
|
||||
EXPECT_EQ(2u, child1->renderSurface()->layerList().size());
|
||||
|
||||
// The render surface for child1 only has a contentRect that encloses grandChild1 and grandChild2, because child1 does not draw content.
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForUpdateRects)
|
||||
@ -215,30 +215,30 @@ TEST_F(DamageTrackerTest, verifyDamageForUpdateRects)
|
||||
// CASE 1: Setting the update rect should cause the corresponding damage to the surface.
|
||||
//
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
||||
child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100).
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 12, 13), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
|
||||
|
||||
// CASE 2: The same update rect twice in a row still produces the same damage.
|
||||
//
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
||||
child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 12, 13), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
|
||||
|
||||
// CASE 3: Setting a different update rect should cause damage on the new update region, but no additional exposed old region.
|
||||
//
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(20, 25, 1, 2));
|
||||
child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Damage position on the surface should be: position of updateRect (20, 25) relative to the child (100, 100).
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(120, 125, 1, 2), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(120, 125, 1, 2), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
||||
@ -249,7 +249,7 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
||||
// CASE 1: The layer's property changed flag takes priority over update rect.
|
||||
//
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
||||
child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
||||
child->setOpacity(0.5);
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
@ -258,8 +258,8 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
||||
ASSERT_EQ(2u, root->renderSurface()->layerList().size());
|
||||
|
||||
// Damage should be the entire child layer in targetSurface space.
|
||||
FloatRect expectedRect = FloatRect(100, 100, 30, 30);
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF expectedRect = gfx::RectF(100, 100, 30, 30);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
|
||||
|
||||
// CASE 2: If a layer moves due to property change, it damages both the new location
|
||||
@ -269,15 +269,15 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
||||
// Cycle one frame of no change, just to sanity check that the next rect is not because of the old damage state.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
emulateDrawingOneFrame(root.get());
|
||||
EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
|
||||
EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEmpty());
|
||||
|
||||
// Then, test the actual layer movement.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setPosition(FloatPoint(200, 230));
|
||||
child->setPosition(gfx::PointF(200, 230));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Expect damage to be the combination of the previous one and the new one.
|
||||
expectedRect.uniteIfNonZero(FloatRect(200, 230, 30, 30));
|
||||
expectedRect.Union(gfx::RectF(200, 230, 30, 30));
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
|
||||
}
|
||||
@ -294,13 +294,13 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
|
||||
rotation.rotate(45);
|
||||
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setAnchorPoint(FloatPoint(0.5, 0.5));
|
||||
child->setPosition(FloatPoint(85, 85));
|
||||
child->setAnchorPoint(gfx::PointF(0.5, 0.5));
|
||||
child->setPosition(gfx::PointF(85, 85));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Sanity check that the layer actually moved to (85, 85), damaging its old location and new location.
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(85, 85, 45, 45), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(85, 85, 45, 45), rootDamageRect);
|
||||
|
||||
// With the anchor on the layer's center, now we can test the rotation more
|
||||
// intuitively, since it applies about the layer's anchor.
|
||||
@ -313,7 +313,7 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
|
||||
// old exposed region should be fully contained in the new region.
|
||||
double expectedWidth = 30 * sqrt(2.0);
|
||||
double expectedPosition = 100 - 0.5 * expectedWidth;
|
||||
FloatRect expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth);
|
||||
gfx::RectF expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth);
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
|
||||
}
|
||||
@ -340,15 +340,15 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
|
||||
transform.translate3d(-50, -50, 0);
|
||||
|
||||
// Set up the child
|
||||
child->setPosition(FloatPoint(0, 0));
|
||||
child->setBounds(IntSize(100, 100));
|
||||
child->setContentBounds(IntSize(100, 100));
|
||||
child->setPosition(gfx::PointF(0, 0));
|
||||
child->setBounds(gfx::Size(100, 100));
|
||||
child->setContentBounds(gfx::Size(100, 100));
|
||||
child->setTransform(transform);
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Sanity check that the child layer's bounds would actually get clipped by w < 0,
|
||||
// otherwise this test is not actually testing the intended scenario.
|
||||
FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100)));
|
||||
FloatQuad testQuad(gfx::RectF(gfx::PointF(), gfx::SizeF(100, 100)));
|
||||
bool clipped = false;
|
||||
MathUtil::mapQuad(transform, testQuad, clipped);
|
||||
EXPECT_TRUE(clipped);
|
||||
@ -360,9 +360,9 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
|
||||
|
||||
// The expected damage should cover the entire root surface (500x500), but we don't
|
||||
// care whether the damage rect was clamped or is larger than the surface for this test.
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
FloatRect damageWeCareAbout = FloatRect(FloatPoint::zero(), FloatSize(500, 500));
|
||||
EXPECT_TRUE(rootDamageRect.contains(damageWeCareAbout));
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF damageWeCareAbout = gfx::RectF(gfx::PointF(), gfx::SizeF(500, 500));
|
||||
EXPECT_TRUE(rootDamageRect.Contains(damageWeCareAbout));
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface)
|
||||
@ -382,14 +382,13 @@ TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface)
|
||||
|
||||
// Setting the update rect should cause the corresponding damage to the surface, blurred based on the size of the blur filter.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
||||
child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100), but expanded by the blur outsets.
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
FloatRect expectedDamageRect = FloatRect(110, 111, 12, 13);
|
||||
expectedDamageRect.move(-outsetLeft, -outsetTop);
|
||||
expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF expectedDamageRect = gfx::RectF(110, 111, 12, 13);
|
||||
expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
|
||||
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
||||
}
|
||||
|
||||
@ -397,7 +396,7 @@ TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
|
||||
{
|
||||
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface();
|
||||
LayerImpl* child = root->children()[0];
|
||||
FloatRect rootDamageRect, childDamageRect;
|
||||
gfx::RectF rootDamageRect, childDamageRect;
|
||||
|
||||
// Allow us to set damage on child too.
|
||||
child->setDrawsContent(true);
|
||||
@ -410,18 +409,18 @@ TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
|
||||
emulateDrawingOneFrame(root.get());
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
||||
|
||||
// CASE 1: Setting the update rect should damage the whole surface (for now)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(0, 0, 1, 1));
|
||||
child->setUpdateRect(gfx::RectF(0, 0, 1, 1));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
|
||||
@ -447,15 +446,14 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
|
||||
// the surface, blurred based on the size of the child's background blur
|
||||
// filter.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
root->setUpdateRect(FloatRect(297, 297, 2, 2));
|
||||
root->setUpdateRect(gfx::RectF(297, 297, 2, 2));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
// Damage position on the surface should be a composition of the damage on the root and on child2.
|
||||
// Damage on the root should be: position of updateRect (297, 297), but expanded by the blur outsets.
|
||||
FloatRect expectedDamageRect = FloatRect(297, 297, 2, 2);
|
||||
expectedDamageRect.move(-outsetLeft, -outsetTop);
|
||||
expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
|
||||
gfx::RectF expectedDamageRect = gfx::RectF(297, 297, 2, 2);
|
||||
expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
|
||||
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
||||
|
||||
// CASE 2: Setting the update rect should cause the corresponding damage to
|
||||
@ -463,67 +461,64 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
|
||||
// filter. Since the damage extends to the right/bottom outside of the
|
||||
// blurred layer, only the left/top should end up expanded.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
root->setUpdateRect(FloatRect(297, 297, 30, 30));
|
||||
root->setUpdateRect(gfx::RectF(297, 297, 30, 30));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
// Damage position on the surface should be a composition of the damage on the root and on child2.
|
||||
// Damage on the root should be: position of updateRect (297, 297), but expanded on the left/top
|
||||
// by the blur outsets.
|
||||
expectedDamageRect = FloatRect(297, 297, 30, 30);
|
||||
expectedDamageRect.move(-outsetLeft, -outsetTop);
|
||||
expectedDamageRect.expand(outsetLeft, outsetTop);
|
||||
expectedDamageRect = gfx::RectF(297, 297, 30, 30);
|
||||
expectedDamageRect.Inset(-outsetLeft, -outsetTop, 0, 0);
|
||||
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
||||
|
||||
// CASE 3: Setting this update rect outside the blurred contentBounds of the blurred
|
||||
// child1 will not cause it to be expanded.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
root->setUpdateRect(FloatRect(30, 30, 2, 2));
|
||||
root->setUpdateRect(gfx::RectF(30, 30, 2, 2));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
// Damage on the root should be: position of updateRect (30, 30), not
|
||||
// expanded.
|
||||
expectedDamageRect = FloatRect(30, 30, 2, 2);
|
||||
expectedDamageRect = gfx::RectF(30, 30, 2, 2);
|
||||
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
||||
|
||||
// CASE 4: Setting this update rect inside the blurred contentBounds but outside the
|
||||
// original contentBounds of the blurred child1 will cause it to be expanded.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
root->setUpdateRect(FloatRect(99, 99, 1, 1));
|
||||
root->setUpdateRect(gfx::RectF(99, 99, 1, 1));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
// Damage on the root should be: position of updateRect (99, 99), expanded
|
||||
// by the blurring on child1, but since it is 1 pixel outside the layer, the
|
||||
// expanding should be reduced by 1.
|
||||
expectedDamageRect = FloatRect(99, 99, 1, 1);
|
||||
expectedDamageRect.move(-outsetLeft + 1, -outsetTop + 1);
|
||||
expectedDamageRect.expand(outsetLeft + outsetRight - 1, outsetTop + outsetBottom - 1);
|
||||
expectedDamageRect = gfx::RectF(99, 99, 1, 1);
|
||||
expectedDamageRect.Inset(-outsetLeft + 1, -outsetTop + 1, -outsetRight, -outsetBottom);
|
||||
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
||||
|
||||
// CASE 5: Setting the update rect on child2, which is above child1, will
|
||||
// not get blurred by child1, so it does not need to get expanded.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child2->setUpdateRect(FloatRect(0, 0, 1, 1));
|
||||
child2->setUpdateRect(gfx::RectF(0, 0, 1, 1));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
// Damage on child2 should be: position of updateRect offset by the child's position (11, 11), and not expanded by anything.
|
||||
expectedDamageRect = FloatRect(11, 11, 1, 1);
|
||||
expectedDamageRect = gfx::RectF(11, 11, 1, 1);
|
||||
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
||||
|
||||
// CASE 6: Setting the update rect on child1 will also blur the damage, so
|
||||
// that any pixels needed for the blur are redrawn in the current frame.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child1->setUpdateRect(FloatRect(0, 0, 1, 1));
|
||||
child1->setUpdateRect(gfx::RectF(0, 0, 1, 1));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
// Damage on child1 should be: position of updateRect offset by the child's position (100, 100), and expanded by the damage.
|
||||
expectedDamageRect = FloatRect(100, 100, 1, 1);
|
||||
expectedDamageRect.move(-outsetLeft, -outsetTop);
|
||||
expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
|
||||
expectedDamageRect = gfx::RectF(100, 100, 1, 1);
|
||||
expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
|
||||
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
||||
}
|
||||
|
||||
@ -537,10 +532,10 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
{
|
||||
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
|
||||
child2->setPosition(FloatPoint(400, 380));
|
||||
child2->setAnchorPoint(FloatPoint::zero());
|
||||
child2->setBounds(IntSize(6, 8));
|
||||
child2->setContentBounds(IntSize(6, 8));
|
||||
child2->setPosition(gfx::PointF(400, 380));
|
||||
child2->setAnchorPoint(gfx::PointF());
|
||||
child2->setBounds(gfx::Size(6, 8));
|
||||
child2->setContentBounds(gfx::Size(6, 8));
|
||||
child2->setDrawsContent(true);
|
||||
root->addChild(child2.Pass());
|
||||
}
|
||||
@ -549,8 +544,8 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
|
||||
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
|
||||
ASSERT_EQ(3u, root->renderSurface()->layerList().size());
|
||||
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
|
||||
|
||||
// CASE 2: If the layer is removed, its entire old layer becomes exposed, not just the
|
||||
// last update rect.
|
||||
@ -558,13 +553,13 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
|
||||
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
emulateDrawingOneFrame(root.get());
|
||||
EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
|
||||
EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEmpty());
|
||||
|
||||
// Then, test removing child1.
|
||||
child1->removeFromParent();
|
||||
emulateDrawingOneFrame(root.get());
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
|
||||
@ -577,16 +572,16 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
{
|
||||
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
|
||||
child2->setPosition(FloatPoint(400, 380));
|
||||
child2->setAnchorPoint(FloatPoint::zero());
|
||||
child2->setBounds(IntSize(6, 8));
|
||||
child2->setContentBounds(IntSize(6, 8));
|
||||
child2->setPosition(gfx::PointF(400, 380));
|
||||
child2->setAnchorPoint(gfx::PointF());
|
||||
child2->setBounds(gfx::Size(6, 8));
|
||||
child2->setContentBounds(gfx::Size(6, 8));
|
||||
child2->setDrawsContent(true);
|
||||
child2->resetAllChangeTrackingForSubtree();
|
||||
// Sanity check the initial conditions of the test, if these asserts trigger, it
|
||||
// means the test no longer actually covers the intended scenario.
|
||||
ASSERT_FALSE(child2->layerPropertyChanged());
|
||||
ASSERT_TRUE(child2->updateRect().isEmpty());
|
||||
ASSERT_TRUE(child2->updateRect().IsEmpty());
|
||||
root->addChild(child2.Pass());
|
||||
}
|
||||
emulateDrawingOneFrame(root.get());
|
||||
@ -594,8 +589,8 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
|
||||
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
|
||||
ASSERT_EQ(3u, root->renderSurface()->layerList().size());
|
||||
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
|
||||
@ -607,10 +602,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
{
|
||||
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
|
||||
child2->setPosition(FloatPoint(400, 380));
|
||||
child2->setAnchorPoint(FloatPoint::zero());
|
||||
child2->setBounds(IntSize(6, 8));
|
||||
child2->setContentBounds(IntSize(6, 8));
|
||||
child2->setPosition(gfx::PointF(400, 380));
|
||||
child2->setAnchorPoint(gfx::PointF());
|
||||
child2->setBounds(gfx::Size(6, 8));
|
||||
child2->setContentBounds(gfx::Size(6, 8));
|
||||
child2->setDrawsContent(true);
|
||||
root->addChild(child2.Pass());
|
||||
}
|
||||
@ -618,14 +613,14 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Damaging two layers simultaneously should cause combined damage.
|
||||
// - child1 update rect in surface space: FloatRect(100, 100, 1, 2);
|
||||
// - child2 update rect in surface space: FloatRect(400, 380, 3, 4);
|
||||
// - child1 update rect in surface space: gfx::RectF(100, 100, 1, 2);
|
||||
// - child2 update rect in surface space: gfx::RectF(400, 380, 3, 4);
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child1->setUpdateRect(FloatRect(0, 0, 1, 2));
|
||||
child2->setUpdateRect(FloatRect(0, 0, 3, 4));
|
||||
child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
|
||||
child2->setUpdateRect(gfx::RectF(0, 0, 3, 4));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 303, 284), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 303, 284), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
|
||||
@ -634,8 +629,8 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
|
||||
LayerImpl* child1 = root->children()[0];
|
||||
LayerImpl* child2 = root->children()[1];
|
||||
LayerImpl* grandChild1 = root->children()[0]->children()[0];
|
||||
FloatRect childDamageRect;
|
||||
FloatRect rootDamageRect;
|
||||
gfx::RectF childDamageRect;
|
||||
gfx::RectF rootDamageRect;
|
||||
|
||||
// CASE 1: Damage to a descendant surface should propagate properly to ancestor surface.
|
||||
//
|
||||
@ -644,20 +639,20 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(200, 200, 6, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(300, 300, 6, 8), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(300, 300, 6, 8), rootDamageRect);
|
||||
|
||||
// CASE 2: Same as previous case, but with additional damage elsewhere that should be properly unioned.
|
||||
// - child1 surface damage in root surface space: FloatRect(300, 300, 6, 8);
|
||||
// - child2 damage in root surface space: FloatRect(11, 11, 18, 18);
|
||||
// - child1 surface damage in root surface space: gfx::RectF(300, 300, 6, 8);
|
||||
// - child2 damage in root surface space: gfx::RectF(11, 11, 18, 18);
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
grandChild1->setOpacity(0.7f);
|
||||
child2->setOpacity(0.7f);
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(200, 200, 6, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(11, 11, 295, 297), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(11, 11, 295, 297), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
|
||||
@ -672,21 +667,21 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
|
||||
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
||||
LayerImpl* child1 = root->children()[0];
|
||||
LayerImpl* grandChild1 = root->children()[0]->children()[0];
|
||||
FloatRect childDamageRect;
|
||||
FloatRect rootDamageRect;
|
||||
gfx::RectF childDamageRect;
|
||||
gfx::RectF rootDamageRect;
|
||||
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
grandChild1->setPosition(FloatPoint(195, 205));
|
||||
grandChild1->setPosition(gfx::PointF(195, 205));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
// The new surface bounds should be damaged entirely, even though only one of the layers changed.
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 11, 23), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 11, 23), childDamageRect);
|
||||
|
||||
// Damage to the root surface should be the union of child1's *entire* render surface
|
||||
// (in target space), and its old exposed area (also in target space).
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 23), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 23), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
|
||||
@ -704,30 +699,30 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
|
||||
|
||||
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
||||
LayerImpl* child1 = root->children()[0];
|
||||
FloatRect childDamageRect;
|
||||
FloatRect rootDamageRect;
|
||||
gfx::RectF childDamageRect;
|
||||
gfx::RectF rootDamageRect;
|
||||
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child1->setPosition(FloatPoint(50, 50));
|
||||
child1->setPosition(gfx::PointF(50, 50));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
// The new surface bounds should be damaged entirely.
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
|
||||
|
||||
// The entire child1 surface and the old exposed child1 surface should damage the root surface.
|
||||
// - old child1 surface in target space: FloatRect(290, 290, 16, 18)
|
||||
// - new child1 surface in target space: FloatRect(240, 240, 16, 18)
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(240, 240, 66, 68), rootDamageRect);
|
||||
// - old child1 surface in target space: gfx::RectF(290, 290, 16, 18)
|
||||
// - new child1 surface in target space: gfx::RectF(240, 240, 16, 18)
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(240, 240, 66, 68), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
||||
{
|
||||
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
||||
LayerImpl* child1 = root->children()[0];
|
||||
FloatRect childDamageRect;
|
||||
FloatRect rootDamageRect;
|
||||
gfx::RectF childDamageRect;
|
||||
gfx::RectF rootDamageRect;
|
||||
|
||||
// CASE 1: If a descendant surface disappears, its entire old area becomes exposed.
|
||||
//
|
||||
@ -740,7 +735,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
||||
ASSERT_EQ(4u, root->renderSurface()->layerList().size());
|
||||
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
|
||||
|
||||
// CASE 2: If a descendant surface appears, its entire old area becomes exposed.
|
||||
|
||||
@ -748,7 +743,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
emulateDrawingOneFrame(root.get());
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(rootDamageRect.isEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.IsEmpty());
|
||||
|
||||
// Then change the tree so that the render surface is added back.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
@ -762,16 +757,16 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
||||
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
|
||||
{
|
||||
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
||||
LayerImpl* child1 = root->children()[0];
|
||||
FloatRect childDamageRect;
|
||||
FloatRect rootDamageRect;
|
||||
gfx::RectF childDamageRect;
|
||||
gfx::RectF rootDamageRect;
|
||||
|
||||
// CASE 1: If nothing changes, the damage rect should be empty.
|
||||
//
|
||||
@ -779,8 +774,8 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(childDamageRect.isEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.isEmpty());
|
||||
EXPECT_TRUE(childDamageRect.IsEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.IsEmpty());
|
||||
|
||||
// CASE 2: If nothing changes twice in a row, the damage rect should still be empty.
|
||||
//
|
||||
@ -788,26 +783,26 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(childDamageRect.isEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.isEmpty());
|
||||
EXPECT_TRUE(childDamageRect.IsEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent)
|
||||
{
|
||||
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
||||
LayerImpl* child1 = root->children()[0];
|
||||
FloatRect childDamageRect;
|
||||
FloatRect rootDamageRect;
|
||||
gfx::RectF childDamageRect;
|
||||
gfx::RectF rootDamageRect;
|
||||
|
||||
// In our specific tree, the update rect of child1 should not cause any damage to any
|
||||
// surface because it does not actually draw content.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child1->setUpdateRect(FloatRect(0, 0, 1, 2));
|
||||
child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(childDamageRect.isEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.isEmpty());
|
||||
EXPECT_TRUE(childDamageRect.IsEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
||||
@ -823,13 +818,13 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
||||
// For this test case, we modify grandChild2, and add grandChild3 to extend the bounds
|
||||
// of child1's surface. This way, we can test reflection changes without changing
|
||||
// contentBounds of the surface.
|
||||
grandChild2->setPosition(FloatPoint(180, 180));
|
||||
grandChild2->setPosition(gfx::PointF(180, 180));
|
||||
{
|
||||
scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(6);
|
||||
grandChild3->setPosition(FloatPoint(240, 240));
|
||||
grandChild3->setAnchorPoint(FloatPoint::zero());
|
||||
grandChild3->setBounds(IntSize(10, 10));
|
||||
grandChild3->setContentBounds(IntSize(10, 10));
|
||||
grandChild3->setPosition(gfx::PointF(240, 240));
|
||||
grandChild3->setAnchorPoint(gfx::PointF());
|
||||
grandChild3->setBounds(gfx::Size(10, 10));
|
||||
grandChild3->setContentBounds(gfx::Size(10, 10));
|
||||
grandChild3->setDrawsContent(true);
|
||||
child1->addChild(grandChild3.Pass());
|
||||
}
|
||||
@ -841,8 +836,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
{
|
||||
scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(7);
|
||||
grandChild1Replica->setPosition(FloatPoint::zero());
|
||||
grandChild1Replica->setAnchorPoint(FloatPoint::zero());
|
||||
grandChild1Replica->setPosition(gfx::PointF());
|
||||
grandChild1Replica->setAnchorPoint(gfx::PointF());
|
||||
WebTransformationMatrix reflection;
|
||||
reflection.scale3d(-1, 1, 1);
|
||||
grandChild1Replica->setTransform(reflection);
|
||||
@ -850,21 +845,21 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
||||
}
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
// The grandChild surface damage should not include its own replica. The child
|
||||
// surface damage should include the normal and replica surfaces.
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 6, 8), grandChildDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 12, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(294, 300, 12, 8), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 6, 8), grandChildDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 12, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(294, 300, 12, 8), rootDamageRect);
|
||||
|
||||
// CASE 2: moving the descendant surface should cause both the original and reflected
|
||||
// areas to be damaged on the target.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
IntRect oldContentRect = child1->renderSurface()->contentRect();
|
||||
grandChild1->setPosition(FloatPoint(195, 205));
|
||||
gfx::Rect oldContentRect = child1->renderSurface()->contentRect();
|
||||
grandChild1->setPosition(gfx::PointF(195, 205));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width());
|
||||
ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height());
|
||||
@ -874,11 +869,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
// The child surface damage should include normal and replica surfaces for both old and new locations.
|
||||
// - old location in target space: FloatRect(194, 200, 12, 8)
|
||||
// - new location in target space: FloatRect(189, 205, 12, 8)
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 6, 8), grandChildDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(189, 200, 17, 13), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(289, 300, 17, 13), rootDamageRect);
|
||||
// - old location in target space: gfx::RectF(194, 200, 12, 8)
|
||||
// - new location in target space: gfx::RectF(189, 205, 12, 8)
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 6, 8), grandChildDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(189, 200, 17, 13), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(289, 300, 17, 13), rootDamageRect);
|
||||
|
||||
// CASE 3: removing the reflection should cause the entire region including reflection
|
||||
// to damage the target surface.
|
||||
@ -892,8 +887,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(189, 205, 12, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(289, 305, 12, 8), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(189, 205, 12, 8), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(289, 305, 12, 8), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
@ -910,7 +905,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
{
|
||||
scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(3);
|
||||
maskLayer->setPosition(child->position());
|
||||
maskLayer->setAnchorPoint(FloatPoint::zero());
|
||||
maskLayer->setAnchorPoint(gfx::PointF());
|
||||
maskLayer->setBounds(child->bounds());
|
||||
maskLayer->setContentBounds(child->bounds());
|
||||
child->setMaskLayer(maskLayer.Pass());
|
||||
@ -921,10 +916,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
child->setOpacity(0.5);
|
||||
{
|
||||
scoped_ptr<LayerImpl> grandChild = LayerImpl::create(4);
|
||||
grandChild->setPosition(FloatPoint(2, 2));
|
||||
grandChild->setAnchorPoint(FloatPoint::zero());
|
||||
grandChild->setBounds(IntSize(2, 2));
|
||||
grandChild->setContentBounds(IntSize(2, 2));
|
||||
grandChild->setPosition(gfx::PointF(2, 2));
|
||||
grandChild->setAnchorPoint(gfx::PointF());
|
||||
grandChild->setBounds(gfx::Size(2, 2));
|
||||
grandChild->setContentBounds(gfx::Size(2, 2));
|
||||
grandChild->setDrawsContent(true);
|
||||
child->addChild(grandChild.Pass());
|
||||
}
|
||||
@ -936,10 +931,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
// CASE 1: the updateRect on a mask layer should damage the entire target surface.
|
||||
//
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
maskLayer->setUpdateRect(FloatRect(1, 2, 3, 4));
|
||||
maskLayer->setUpdateRect(gfx::RectF(1, 2, 3, 4));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
FloatRect childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
||||
gfx::RectF childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
||||
|
||||
// CASE 2: a property change on the mask layer should damage the entire target surface.
|
||||
//
|
||||
@ -948,7 +943,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(childDamageRect.isEmpty());
|
||||
EXPECT_TRUE(childDamageRect.IsEmpty());
|
||||
|
||||
// Then test the property change.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
@ -956,7 +951,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
||||
|
||||
// CASE 3: removing the mask also damages the entire target surface.
|
||||
//
|
||||
@ -965,7 +960,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
emulateDrawingOneFrame(root.get());
|
||||
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(childDamageRect.isEmpty());
|
||||
EXPECT_TRUE(childDamageRect.IsEmpty());
|
||||
|
||||
// Then test mask removal.
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
@ -977,7 +972,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
||||
ASSERT_TRUE(child->renderSurface());
|
||||
|
||||
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
||||
@ -994,8 +989,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
||||
// Create a reflection about the left edge of grandChild1.
|
||||
{
|
||||
scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6);
|
||||
grandChild1Replica->setPosition(FloatPoint::zero());
|
||||
grandChild1Replica->setAnchorPoint(FloatPoint::zero());
|
||||
grandChild1Replica->setPosition(gfx::PointF());
|
||||
grandChild1Replica->setAnchorPoint(gfx::PointF());
|
||||
WebTransformationMatrix reflection;
|
||||
reflection.scale3d(-1, 1, 1);
|
||||
grandChild1Replica->setTransform(reflection);
|
||||
@ -1006,8 +1001,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
||||
// Set up the mask layer on the replica layer
|
||||
{
|
||||
scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7);
|
||||
replicaMaskLayer->setPosition(FloatPoint::zero());
|
||||
replicaMaskLayer->setAnchorPoint(FloatPoint::zero());
|
||||
replicaMaskLayer->setPosition(gfx::PointF());
|
||||
replicaMaskLayer->setAnchorPoint(gfx::PointF());
|
||||
replicaMaskLayer->setBounds(grandChild1->bounds());
|
||||
replicaMaskLayer->setContentBounds(grandChild1->bounds());
|
||||
grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
|
||||
@ -1024,11 +1019,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
||||
replicaMaskLayer->setStackingOrderChanged(true);
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
EXPECT_TRUE(grandChildDamageRect.isEmpty());
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
|
||||
EXPECT_TRUE(grandChildDamageRect.IsEmpty());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
|
||||
|
||||
// CASE 2: removing the replica mask damages only the reflected region on the target surface.
|
||||
//
|
||||
@ -1039,8 +1034,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
||||
grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
|
||||
EXPECT_TRUE(grandChildDamageRect.isEmpty());
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
|
||||
EXPECT_TRUE(grandChildDamageRect.IsEmpty());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
||||
@ -1052,12 +1047,12 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
||||
// Verify that the correct replicaOriginTransform is used for the replicaMask;
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
|
||||
grandChild1->setAnchorPoint(FloatPoint(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
|
||||
grandChild1->setAnchorPoint(gfx::PointF(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
|
||||
|
||||
{
|
||||
scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6);
|
||||
grandChild1Replica->setPosition(FloatPoint::zero());
|
||||
grandChild1Replica->setAnchorPoint(FloatPoint(1, 0)); // This is the anchor being tested.
|
||||
grandChild1Replica->setPosition(gfx::PointF());
|
||||
grandChild1Replica->setAnchorPoint(gfx::PointF(1, 0)); // This is the anchor being tested.
|
||||
WebTransformationMatrix reflection;
|
||||
reflection.scale3d(-1, 1, 1);
|
||||
grandChild1Replica->setTransform(reflection);
|
||||
@ -1068,8 +1063,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
||||
// Set up the mask layer on the replica layer
|
||||
{
|
||||
scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7);
|
||||
replicaMaskLayer->setPosition(FloatPoint::zero());
|
||||
replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested.
|
||||
replicaMaskLayer->setPosition(gfx::PointF());
|
||||
replicaMaskLayer->setAnchorPoint(gfx::PointF()); // note, this is not the anchor being tested.
|
||||
replicaMaskLayer->setBounds(grandChild1->bounds());
|
||||
replicaMaskLayer->setContentBounds(grandChild1->bounds());
|
||||
grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
|
||||
@ -1087,8 +1082,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
||||
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(206, 200, 6, 8), childDamageRect);
|
||||
gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(206, 200, 6, 8), childDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
|
||||
@ -1100,11 +1095,11 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
|
||||
// it takes priority over any other partial damage.
|
||||
//
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
||||
child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
||||
root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
|
||||
emulateDrawingOneFrame(root.get());
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
||||
|
||||
// Case 2: An additional sanity check that forcing full damage works even when nothing
|
||||
// on the layer tree changed.
|
||||
@ -1113,7 +1108,7 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
|
||||
root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
|
||||
emulateDrawingOneFrame(root.get());
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
|
||||
@ -1127,10 +1122,10 @@ TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
|
||||
ASSERT_TRUE(root == root->renderTarget());
|
||||
RenderSurfaceImpl* targetSurface = root->renderSurface();
|
||||
targetSurface->clearLayerLists();
|
||||
targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0, WebFilterOperations(), 0);
|
||||
targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, gfx::Rect(), 0, WebFilterOperations(), 0);
|
||||
|
||||
FloatRect damageRect = targetSurface->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(damageRect.isEmpty());
|
||||
gfx::RectF damageRect = targetSurface->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(damageRect.IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset)
|
||||
@ -1141,28 +1136,28 @@ TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset)
|
||||
LayerImpl* child = root->children()[0];
|
||||
|
||||
clearDamageForAllSurfaces(root.get());
|
||||
child->setUpdateRect(FloatRect(10, 11, 1, 2));
|
||||
child->setUpdateRect(gfx::RectF(10, 11, 1, 2));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
|
||||
// Sanity check damage after the first frame; this isnt the actual test yet.
|
||||
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 1, 2), rootDamageRect);
|
||||
gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 1, 2), rootDamageRect);
|
||||
|
||||
// New damage, without having cleared the previous damage, should be unioned to the previous one.
|
||||
child->setUpdateRect(FloatRect(20, 25, 1, 2));
|
||||
child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
|
||||
emulateDrawingOneFrame(root.get());
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 11, 16), rootDamageRect);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 11, 16), rootDamageRect);
|
||||
|
||||
// If we notify the damage tracker that we drew the damaged area, then damage should be emptied.
|
||||
root->renderSurface()->damageTracker()->didDrawDamagedArea();
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(rootDamageRect.isEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.IsEmpty());
|
||||
|
||||
// Damage should remain empty even after one frame, since there's yet no new damage
|
||||
emulateDrawingOneFrame(root.get());
|
||||
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
||||
EXPECT_TRUE(rootDamageRect.isEmpty());
|
||||
EXPECT_TRUE(rootDamageRect.IsEmpty());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -55,9 +55,10 @@ void DebugRectHistory::savePaintRects(LayerImpl* layer)
|
||||
// regardless of whether this layer is skipped for actual drawing or not. Therefore
|
||||
// we traverse recursively over all layers, not just the render surface list.
|
||||
|
||||
if (!layer->updateRect().isEmpty() && layer->drawsContent()) {
|
||||
FloatRect updateContentRect = layer->updateRect();
|
||||
updateContentRect.scale(layer->contentBounds().width() / static_cast<float>(layer->bounds().width()), layer->contentBounds().height() / static_cast<float>(layer->bounds().height()));
|
||||
if (!layer->updateRect().IsEmpty() && layer->drawsContent()) {
|
||||
float widthScale = layer->contentBounds().width() / static_cast<float>(layer->bounds().width());
|
||||
float heightScale = layer->contentBounds().height() / static_cast<float>(layer->bounds().height());
|
||||
gfx::RectF updateContentRect = gfx::ScaleRect(layer->updateRect(), widthScale, heightScale);
|
||||
m_debugRects.push_back(DebugRect(PaintRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), updateContentRect)));
|
||||
}
|
||||
|
||||
@ -83,7 +84,7 @@ void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& r
|
||||
continue;
|
||||
|
||||
if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged())
|
||||
m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds()))));
|
||||
m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), gfx::RectF(gfx::PointF(), layer->contentBounds()))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,7 +117,7 @@ void DebugRectHistory::saveScreenSpaceRects(const std::vector<LayerImpl* >& rend
|
||||
void DebugRectHistory::saveOccludingRects(const std::vector<gfx::Rect>& occludingRects)
|
||||
{
|
||||
for (size_t i = 0; i < occludingRects.size(); ++i)
|
||||
m_debugRects.push_back(DebugRect(OccludingRectType, cc::IntRect(occludingRects[i])));
|
||||
m_debugRects.push_back(DebugRect(OccludingRectType, cc::FloatRect(occludingRects[i])));
|
||||
}
|
||||
|
||||
} // namespace cc
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "FloatRect.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <vector>
|
||||
|
||||
namespace cc {
|
||||
@ -38,12 +38,12 @@ struct LayerTreeSettings;
|
||||
enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType };
|
||||
|
||||
struct DebugRect {
|
||||
DebugRect(DebugRectType newType, FloatRect newRect)
|
||||
DebugRect(DebugRectType newType, gfx::RectF newRect)
|
||||
: type(newType)
|
||||
, rect(newRect) { }
|
||||
|
||||
DebugRectType type;
|
||||
FloatRect rect;
|
||||
gfx::RectF rect;
|
||||
};
|
||||
|
||||
// This class maintains a history of rects of various types that can be used
|
||||
|
@ -36,11 +36,11 @@ public:
|
||||
DelegatedRendererLayerImplTest()
|
||||
{
|
||||
LayerTreeSettings settings;
|
||||
settings.minimumOcclusionTrackingSize = IntSize();
|
||||
settings.minimumOcclusionTrackingSize = gfx::Size();
|
||||
|
||||
m_hostImpl = LayerTreeHostImpl::create(settings, this);
|
||||
m_hostImpl->initializeRenderer(createContext());
|
||||
m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
|
||||
m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
}
|
||||
|
||||
// LayerTreeHostImplClient implementation.
|
||||
@ -66,7 +66,7 @@ protected:
|
||||
scoped_ptr<LayerTreeHostImpl> m_hostImpl;
|
||||
};
|
||||
|
||||
static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, RenderPass::Id id, IntRect outputRect, WebTransformationMatrix rootTransform)
|
||||
static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, RenderPass::Id id, gfx::Rect outputRect, WebTransformationMatrix rootTransform)
|
||||
{
|
||||
scoped_ptr<TestRenderPass> pass(TestRenderPass::create(id, outputRect, rootTransform));
|
||||
TestRenderPass* saved = pass.get();
|
||||
@ -74,7 +74,7 @@ static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend
|
||||
return saved;
|
||||
}
|
||||
|
||||
static SolidColorDrawQuad* addQuad(TestRenderPass* pass, IntRect rect, SkColor color)
|
||||
static SolidColorDrawQuad* addQuad(TestRenderPass* pass, gfx::Rect rect, SkColor color)
|
||||
{
|
||||
MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList());
|
||||
AppendQuadsData data(pass->id());
|
||||
@ -105,36 +105,36 @@ public:
|
||||
scoped_ptr<LayerImpl> layerAfter = SolidColorLayerImpl::create(3).PassAs<LayerImpl>();
|
||||
scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(4);
|
||||
|
||||
m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
|
||||
rootLayer->setBounds(IntSize(100, 100));
|
||||
m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
|
||||
rootLayer->setBounds(gfx::Size(100, 100));
|
||||
|
||||
layerBefore->setPosition(IntPoint(20, 20));
|
||||
layerBefore->setBounds(IntSize(14, 14));
|
||||
layerBefore->setContentBounds(IntSize(14, 14));
|
||||
layerBefore->setPosition(gfx::Point(20, 20));
|
||||
layerBefore->setBounds(gfx::Size(14, 14));
|
||||
layerBefore->setContentBounds(gfx::Size(14, 14));
|
||||
layerBefore->setDrawsContent(true);
|
||||
layerBefore->setForceRenderSurface(true);
|
||||
|
||||
layerAfter->setPosition(IntPoint(5, 5));
|
||||
layerAfter->setBounds(IntSize(15, 15));
|
||||
layerAfter->setContentBounds(IntSize(15, 15));
|
||||
layerAfter->setPosition(gfx::Point(5, 5));
|
||||
layerAfter->setBounds(gfx::Size(15, 15));
|
||||
layerAfter->setContentBounds(gfx::Size(15, 15));
|
||||
layerAfter->setDrawsContent(true);
|
||||
layerAfter->setForceRenderSurface(true);
|
||||
|
||||
delegatedRendererLayer->setPosition(IntPoint(3, 3));
|
||||
delegatedRendererLayer->setBounds(IntSize(10, 10));
|
||||
delegatedRendererLayer->setContentBounds(IntSize(10, 10));
|
||||
delegatedRendererLayer->setPosition(gfx::Point(3, 3));
|
||||
delegatedRendererLayer->setBounds(gfx::Size(10, 10));
|
||||
delegatedRendererLayer->setContentBounds(gfx::Size(10, 10));
|
||||
delegatedRendererLayer->setDrawsContent(true);
|
||||
WebTransformationMatrix transform;
|
||||
transform.translate(1, 1);
|
||||
delegatedRendererLayer->setTransform(transform);
|
||||
|
||||
ScopedPtrVector<RenderPass> delegatedRenderPasses;
|
||||
TestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), IntRect(6, 6, 6, 6), WebTransformationMatrix());
|
||||
addQuad(pass1, IntRect(0, 0, 6, 6), 33u);
|
||||
TestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 7), IntRect(7, 7, 7, 7), WebTransformationMatrix());
|
||||
addQuad(pass2, IntRect(0, 0, 7, 7), 22u);
|
||||
TestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), gfx::Rect(6, 6, 6, 6), WebTransformationMatrix());
|
||||
addQuad(pass1, gfx::Rect(0, 0, 6, 6), 33u);
|
||||
TestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 7), gfx::Rect(7, 7, 7, 7), WebTransformationMatrix());
|
||||
addQuad(pass2, gfx::Rect(0, 0, 7, 7), 22u);
|
||||
addRenderPassQuad(pass2, pass1);
|
||||
TestRenderPass* pass3 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 8), IntRect(8, 8, 8, 8), WebTransformationMatrix());
|
||||
TestRenderPass* pass3 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 8), gfx::Rect(8, 8, 8, 8), WebTransformationMatrix());
|
||||
addRenderPassQuad(pass3, pass2);
|
||||
delegatedRendererLayer->setRenderPasses(delegatedRenderPasses);
|
||||
|
||||
@ -187,8 +187,8 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses)
|
||||
EXPECT_EQ(0, frame.renderPasses[4]->id().index);
|
||||
|
||||
// The DelegatedRendererLayer should have added its RenderPasses to the frame in order.
|
||||
EXPECT_RECT_EQ(IntRect(6, 6, 6, 6), frame.renderPasses[1]->outputRect());
|
||||
EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[2]->outputRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[1]->outputRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[2]->outputRect());
|
||||
}
|
||||
|
||||
TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPasses)
|
||||
@ -209,14 +209,14 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPasses
|
||||
|
||||
// The DelegatedRendererLayer should have added copies of its quads to contributing RenderPasses.
|
||||
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
|
||||
// Verify it added the right quads.
|
||||
ASSERT_EQ(2u, frame.renderPasses[2]->quadList().size());
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(IntRect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
|
||||
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
}
|
||||
|
||||
TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass)
|
||||
@ -237,10 +237,10 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass)
|
||||
ASSERT_EQ(2u, frame.renderPasses[3]->quadList().size());
|
||||
|
||||
// Verify it added the right quads.
|
||||
EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
|
||||
|
||||
// Its target layer should have a quad as well.
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 15, 15), frame.renderPasses[3]->quadList()[1]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 15, 15), frame.renderPasses[3]->quadList()[1]->quadRect());
|
||||
}
|
||||
|
||||
TEST_F(DelegatedRendererLayerImplTestSimple, QuadsFromRootRenderPassAreModifiedForTheTarget)
|
||||
@ -325,14 +325,14 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToContributingRenderPa
|
||||
|
||||
// The DelegatedRendererLayer should have added copies of its quads to contributing RenderPasses.
|
||||
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
|
||||
// Verify it added the right quads.
|
||||
ASSERT_EQ(2u, frame.renderPasses[2]->quadList().size());
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(IntRect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
|
||||
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
|
||||
}
|
||||
|
||||
TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass)
|
||||
@ -353,7 +353,7 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass)
|
||||
ASSERT_EQ(1u, frame.renderPasses[3]->quadList().size());
|
||||
|
||||
// Verify it added the right quads.
|
||||
EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
|
||||
}
|
||||
|
||||
TEST_F(DelegatedRendererLayerImplTestOwnSurface, QuadsFromRootRenderPassAreNotModifiedForTheTarget)
|
||||
@ -386,27 +386,27 @@ public:
|
||||
scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1);
|
||||
scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(2);
|
||||
|
||||
m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
|
||||
rootLayer->setBounds(IntSize(100, 100));
|
||||
m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
|
||||
rootLayer->setBounds(gfx::Size(100, 100));
|
||||
|
||||
delegatedRendererLayer->setPosition(IntPoint(20, 20));
|
||||
delegatedRendererLayer->setBounds(IntSize(20, 20));
|
||||
delegatedRendererLayer->setContentBounds(IntSize(20, 20));
|
||||
delegatedRendererLayer->setPosition(gfx::Point(20, 20));
|
||||
delegatedRendererLayer->setBounds(gfx::Size(20, 20));
|
||||
delegatedRendererLayer->setContentBounds(gfx::Size(20, 20));
|
||||
delegatedRendererLayer->setDrawsContent(true);
|
||||
WebTransformationMatrix transform;
|
||||
transform.translate(10, 10);
|
||||
delegatedRendererLayer->setTransform(transform);
|
||||
|
||||
ScopedPtrVector<RenderPass> delegatedRenderPasses;
|
||||
IntRect passRect(0, 0, 50, 50);
|
||||
gfx::Rect passRect(0, 0, 50, 50);
|
||||
TestRenderPass* pass = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), passRect, WebTransformationMatrix());
|
||||
MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList());
|
||||
AppendQuadsData data(pass->id());
|
||||
SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), passRect, passRect, 1, false));
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(0, 0, 10, 10), 1u).PassAs<DrawQuad>(), data);
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(0, 10, 10, 10), 2u).PassAs<DrawQuad>(), data);
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(10, 0, 10, 10), 3u).PassAs<DrawQuad>(), data);
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(10, 10, 10, 10), 4u).PassAs<DrawQuad>(), data);
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(0, 0, 10, 10), 1u).PassAs<DrawQuad>(), data);
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(0, 10, 10, 10), 2u).PassAs<DrawQuad>(), data);
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(10, 0, 10, 10), 3u).PassAs<DrawQuad>(), data);
|
||||
quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(10, 10, 10, 10), 4u).PassAs<DrawQuad>(), data);
|
||||
delegatedRendererLayer->setRenderPasses(delegatedRenderPasses);
|
||||
|
||||
// The RenderPasses should be taken by the layer.
|
||||
@ -446,7 +446,7 @@ TEST_F(DelegatedRendererLayerImplTestSharedData, SharedData)
|
||||
EXPECT_EQ(sharedState, quadList[3]->sharedQuadState());
|
||||
|
||||
// The state should be transformed only once.
|
||||
EXPECT_RECT_EQ(IntRect(30, 30, 50, 50), sharedState->clippedRectInTarget);
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 50, 50), sharedState->clippedRectInTarget);
|
||||
WebTransformationMatrix expected;
|
||||
expected.translate(30, 30);
|
||||
EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform);
|
||||
|
@ -253,7 +253,7 @@ TEST(DrawQuadTest, copyTileDrawQuad)
|
||||
{
|
||||
gfx::Rect opaqueRect(33, 44, 22, 33);
|
||||
unsigned resourceId = 104;
|
||||
gfx::Point textureOffset(-31, 47);
|
||||
gfx::Vector2d textureOffset(-31, 47);
|
||||
gfx::Size textureSize(85, 32);
|
||||
GLint textureFilter = 82;
|
||||
bool swizzleContents = true;
|
||||
|
@ -11,12 +11,10 @@
|
||||
#include "base/string_split.h"
|
||||
#include "cc/proxy.h"
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "ui/gfx/point.h"
|
||||
#include "ui/gfx/size.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
FontAtlas::FontAtlas(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight)
|
||||
FontAtlas::FontAtlas(SkBitmap bitmap, gfx::Rect asciiToRectTable[128], int fontHeight)
|
||||
: m_atlas(bitmap)
|
||||
, m_fontHeight(fontHeight)
|
||||
{
|
||||
@ -52,7 +50,7 @@ void FontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& paint
|
||||
for (unsigned i = 0; i < textLine.length(); ++i) {
|
||||
// If the ASCII code is out of bounds, then index 0 is used, which is just a plain rectangle glyph.
|
||||
int asciiIndex = (textLine[i] < 128) ? textLine[i] : 0;
|
||||
IntRect glyphBounds = m_asciiToRectTable[asciiIndex];
|
||||
gfx::Rect glyphBounds = m_asciiToRectTable[asciiIndex];
|
||||
SkIRect source = SkIRect::MakeXYWH(glyphBounds.x(), glyphBounds.y(), glyphBounds.width(), glyphBounds.height());
|
||||
canvas->drawBitmapRect(m_atlas, &source, SkRect::MakeXYWH(position.x(), position.y(), glyphBounds.width(), glyphBounds.height()), &paint);
|
||||
position.set_x(position.x() + glyphBounds.width());
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "IntRect.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
|
||||
class SkCanvas;
|
||||
|
||||
@ -24,7 +24,7 @@ namespace cc {
|
||||
// This class provides basic ability to draw text onto the heads-up display.
|
||||
class FontAtlas {
|
||||
public:
|
||||
static scoped_ptr<FontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight)
|
||||
static scoped_ptr<FontAtlas> create(SkBitmap bitmap, gfx::Rect asciiToRectTable[128], int fontHeight)
|
||||
{
|
||||
return make_scoped_ptr(new FontAtlas(bitmap, asciiToRectTable, fontHeight));
|
||||
}
|
||||
@ -42,15 +42,15 @@ public:
|
||||
void drawDebugAtlas(SkCanvas*, const gfx::Point& destPosition) const;
|
||||
|
||||
private:
|
||||
FontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
|
||||
FontAtlas(SkBitmap, gfx::Rect asciiToRectTable[128], int fontHeight);
|
||||
|
||||
void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&, const gfx::Point& destPosition) const;
|
||||
|
||||
// The actual texture atlas containing all the pre-rendered glyphs.
|
||||
SkBitmap m_atlas;
|
||||
|
||||
// The look-up tables mapping ascii characters to their IntRect locations on the atlas.
|
||||
IntRect m_asciiToRectTable[128];
|
||||
// The look-up tables mapping ascii characters to their gfx::Rect locations on the atlas.
|
||||
gfx::Rect m_asciiToRectTable[128];
|
||||
|
||||
int m_fontHeight;
|
||||
|
||||
|
21
cc/geometry.h
Normal file
21
cc/geometry.h
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2010 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CC_GEOMETRY_H_
|
||||
#define CC_GEOMETRY_H_
|
||||
|
||||
#include "ui/gfx/size.h"
|
||||
#include "ui/gfx/vector2d_f.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace cc {
|
||||
|
||||
inline gfx::Size ClampSizeFromAbove(gfx::Size s, gfx::Size other) {
|
||||
return gfx::Size(s.width() < other.width() ? s.width() : other.width(),
|
||||
s.height() < other.height() ? s.height() : other.height());
|
||||
}
|
||||
|
||||
} // namespace cc
|
||||
|
||||
#endif // CC_GEOMETRY_H_
|
@ -466,7 +466,7 @@ scoped_ptr<ScopedTexture> GLRenderer::drawBackgroundFilters(DrawingFrame& frame,
|
||||
deviceRect.Intersect(frame.currentRenderPass->outputRect());
|
||||
|
||||
scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_resourceProvider);
|
||||
if (!getFramebufferTexture(deviceBackgroundTexture.get(), cc::IntRect(deviceRect)))
|
||||
if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect))
|
||||
return scoped_ptr<ScopedTexture>();
|
||||
|
||||
SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get());
|
||||
@ -699,7 +699,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
|
||||
float clampY = min(0.5, clampRect.height() / 2.0 - epsilon);
|
||||
clampRect.Inset(clampX, clampY, clampX, clampY);
|
||||
|
||||
gfx::PointF textureOffset = quad->textureOffset() + clampRect.OffsetFromOrigin() - quad->quadRect().OffsetFromOrigin();
|
||||
gfx::Vector2dF textureOffset = quad->textureOffset() + clampRect.OffsetFromOrigin() - quad->quadRect().OffsetFromOrigin();
|
||||
|
||||
// Map clamping rectangle to unit square.
|
||||
float vertexTexTranslateX = -clampRect.x() / clampRect.width();
|
||||
@ -770,10 +770,10 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
|
||||
GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
|
||||
GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocation, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexScaleY));
|
||||
|
||||
FloatPoint bottomRight(tileRect.right(), tileRect.bottom());
|
||||
FloatPoint bottomLeft(tileRect.x(), tileRect.bottom());
|
||||
FloatPoint topLeft(tileRect.x(), tileRect.y());
|
||||
FloatPoint topRight(tileRect.right(), tileRect.y());
|
||||
gfx::PointF bottomRight(tileRect.right(), tileRect.bottom());
|
||||
gfx::PointF bottomLeft(tileRect.x(), tileRect.bottom());
|
||||
gfx::PointF topLeft(tileRect.x(), tileRect.y());
|
||||
gfx::PointF topRight(tileRect.right(), tileRect.y());
|
||||
|
||||
// Map points to device space.
|
||||
bottomRight = MathUtil::mapPoint(deviceTransform, bottomRight, clipped);
|
||||
@ -1237,10 +1237,10 @@ void GLRenderer::onContextLost()
|
||||
}
|
||||
|
||||
|
||||
void GLRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
|
||||
void GLRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect)
|
||||
{
|
||||
DCHECK(rect.maxX() <= viewportWidth());
|
||||
DCHECK(rect.maxY() <= viewportHeight());
|
||||
DCHECK(rect.right() <= viewportWidth());
|
||||
DCHECK(rect.bottom() <= viewportHeight());
|
||||
|
||||
if (!pixels)
|
||||
return;
|
||||
@ -1275,8 +1275,8 @@ void GLRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
|
||||
}
|
||||
|
||||
scoped_array<uint8_t> srcPixels(new uint8_t[rect.width() * rect.height() * 4]);
|
||||
GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rect.maxY(), rect.width(), rect.height(),
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, srcPixels.get()));
|
||||
GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rect.bottom(), rect.width(), rect.height(),
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, srcPixels.get()));
|
||||
|
||||
uint8_t* destPixels = static_cast<uint8_t*>(pixels);
|
||||
size_t rowBytes = rect.width() * 4;
|
||||
@ -1305,11 +1305,11 @@ void GLRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
|
||||
enforceMemoryPolicy();
|
||||
}
|
||||
|
||||
bool GLRenderer::getFramebufferTexture(ScopedTexture* texture, const IntRect& deviceRect)
|
||||
bool GLRenderer::getFramebufferTexture(ScopedTexture* texture, const gfx::Rect& deviceRect)
|
||||
{
|
||||
DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GL_RGB));
|
||||
|
||||
if (!texture->id() && !texture->allocate(Renderer::ImplPool, cc::IntSize(deviceRect.size()), GL_RGB, ResourceProvider::TextureUsageAny))
|
||||
if (!texture->id() && !texture->allocate(Renderer::ImplPool, deviceRect.size(), GL_RGB, ResourceProvider::TextureUsageAny))
|
||||
return false;
|
||||
|
||||
ResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id());
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
// puts backbuffer onscreen
|
||||
virtual bool swapBuffers() OVERRIDE;
|
||||
|
||||
virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
|
||||
virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE;
|
||||
|
||||
virtual bool isContextLost() OVERRIDE;
|
||||
|
||||
@ -69,7 +69,7 @@ protected:
|
||||
const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
|
||||
const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
|
||||
|
||||
bool getFramebufferTexture(ScopedTexture*, const IntRect& deviceRect);
|
||||
bool getFramebufferTexture(ScopedTexture*, const gfx::Rect& deviceRect);
|
||||
void releaseRenderPassTextures();
|
||||
|
||||
virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
|
||||
|
@ -63,13 +63,13 @@ public:
|
||||
{
|
||||
m_rootLayer->createRenderSurface();
|
||||
RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId();
|
||||
scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId, IntRect(), WebTransformationMatrix());
|
||||
scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId, gfx::Rect(), WebTransformationMatrix());
|
||||
m_renderPassesInDrawOrder.push_back(rootRenderPass.get());
|
||||
m_renderPasses.set(renderPassId, rootRenderPass.Pass());
|
||||
}
|
||||
|
||||
// RendererClient methods.
|
||||
virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize(1, 1); return fakeSize; }
|
||||
virtual const gfx::Size& deviceViewportSize() const OVERRIDE { static gfx::Size fakeSize(1, 1); return fakeSize; }
|
||||
virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTreeSettings fakeSettings; return fakeSettings; }
|
||||
virtual void didLoseContext() OVERRIDE { }
|
||||
virtual void onSwapBuffersComplete() OVERRIDE { }
|
||||
|
@ -78,9 +78,9 @@ void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
|
||||
|
||||
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
|
||||
|
||||
IntRect quadRect(IntPoint(), bounds());
|
||||
gfx::Rect quadRect(gfx::Point(), bounds());
|
||||
bool premultipliedAlpha = true;
|
||||
FloatRect uvRect(0, 0, 1, 1);
|
||||
gfx::RectF uvRect(0, 0, 1, 1);
|
||||
bool flipped = false;
|
||||
quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
|
||||
}
|
||||
@ -276,7 +276,7 @@ void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory*
|
||||
break;
|
||||
}
|
||||
|
||||
const FloatRect& rect = debugRects[i].rect;
|
||||
const gfx::RectF& rect = debugRects[i].rect;
|
||||
SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height());
|
||||
SkPaint paint = createPaint();
|
||||
paint.setColor(fillColor);
|
||||
|
@ -119,7 +119,7 @@ void ImageLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
|
||||
if (m_needsDisplay) {
|
||||
m_updater->setBitmap(m_bitmap);
|
||||
updateTileSizeAndTilingOption();
|
||||
invalidateContentRect(IntRect(IntPoint(), contentBounds()));
|
||||
invalidateContentRect(gfx::Rect(gfx::Point(), contentBounds()));
|
||||
m_needsDisplay = false;
|
||||
}
|
||||
TiledLayer::update(queue, occlusion, stats);
|
||||
@ -140,9 +140,9 @@ LayerUpdater* ImageLayer::updater() const
|
||||
return m_updater.get();
|
||||
}
|
||||
|
||||
IntSize ImageLayer::contentBounds() const
|
||||
gfx::Size ImageLayer::contentBounds() const
|
||||
{
|
||||
return IntSize(m_bitmap.width(), m_bitmap.height());
|
||||
return gfx::Size(m_bitmap.width(), m_bitmap.height());
|
||||
}
|
||||
|
||||
bool ImageLayer::drawsContent() const
|
||||
@ -152,14 +152,14 @@ bool ImageLayer::drawsContent() const
|
||||
|
||||
float ImageLayer::contentsScaleX() const
|
||||
{
|
||||
if (bounds().isEmpty() || contentBounds().isEmpty())
|
||||
if (bounds().IsEmpty() || contentBounds().IsEmpty())
|
||||
return 1;
|
||||
return static_cast<float>(m_bitmap.width()) / bounds().width();
|
||||
}
|
||||
|
||||
float ImageLayer::contentsScaleY() const
|
||||
{
|
||||
if (bounds().isEmpty() || contentBounds().isEmpty())
|
||||
if (bounds().IsEmpty() || contentBounds().IsEmpty())
|
||||
return 1;
|
||||
return static_cast<float>(m_bitmap.height()) / bounds().height();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ private:
|
||||
|
||||
virtual LayerUpdater* updater() const OVERRIDE;
|
||||
virtual void createUpdaterIfNeeded() OVERRIDE;
|
||||
virtual IntSize contentBounds() const OVERRIDE;
|
||||
virtual gfx::Size contentBounds() const OVERRIDE;
|
||||
|
||||
SkBitmap m_bitmap;
|
||||
|
||||
|
@ -79,7 +79,7 @@ void IOSurfaceLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
|
||||
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
|
||||
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
|
||||
|
||||
IntRect quadRect(IntPoint(), contentBounds());
|
||||
gfx::Rect quadRect(gfx::Point(), contentBounds());
|
||||
quadSink.append(IOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>(), appendQuadsData);
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ void IOSurfaceLayerImpl::didLoseContext()
|
||||
m_ioSurfaceChanged = true;
|
||||
}
|
||||
|
||||
void IOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize& size)
|
||||
void IOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const gfx::Size& size)
|
||||
{
|
||||
if (m_ioSurfaceId != ioSurfaceId)
|
||||
m_ioSurfaceChanged = true;
|
||||
|
@ -5,8 +5,8 @@
|
||||
#ifndef CCIOSurfaceLayerImpl_h
|
||||
#define CCIOSurfaceLayerImpl_h
|
||||
|
||||
#include "IntSize.h"
|
||||
#include "cc/layer_impl.h"
|
||||
#include "ui/gfx/size.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
@ -18,7 +18,7 @@ public:
|
||||
}
|
||||
virtual ~IOSurfaceLayerImpl();
|
||||
|
||||
void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&);
|
||||
void setIOSurfaceProperties(unsigned ioSurfaceId, const gfx::Size&);
|
||||
|
||||
virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
|
||||
|
||||
@ -33,7 +33,7 @@ private:
|
||||
virtual const char* layerTypeAsString() const OVERRIDE;
|
||||
|
||||
unsigned m_ioSurfaceId;
|
||||
IntSize m_ioSurfaceSize;
|
||||
gfx::Size m_ioSurfaceSize;
|
||||
bool m_ioSurfaceChanged;
|
||||
unsigned m_ioSurfaceTextureId;
|
||||
};
|
||||
|
33
cc/layer.cc
33
cc/layer.cc
@ -13,6 +13,7 @@
|
||||
#include "cc/layer_tree_host.h"
|
||||
#include "cc/settings.h"
|
||||
#include "third_party/skia/include/core/SkImageFilter.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
#include <public/WebAnimationDelegate.h>
|
||||
#include <public/WebLayerScrollClient.h>
|
||||
#include <public/WebSize.h>
|
||||
@ -119,15 +120,13 @@ void Layer::setNeedsCommit()
|
||||
m_layerTreeHost->setNeedsCommit();
|
||||
}
|
||||
|
||||
IntRect Layer::layerRectToContentRect(const FloatRect& layerRect) const
|
||||
gfx::Rect Layer::layerRectToContentRect(const gfx::RectF& layerRect) const
|
||||
{
|
||||
FloatRect contentRect(layerRect);
|
||||
contentRect.scale(contentsScaleX(), contentsScaleY());
|
||||
IntRect intContentRect = enclosingIntRect(contentRect);
|
||||
gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), contentsScaleY());
|
||||
// Intersect with content rect to avoid the extra pixel because for some
|
||||
// values x and y, ceil((x / y) * y) may be x + 1.
|
||||
intContentRect.intersect(IntRect(IntPoint(), contentBounds()));
|
||||
return intContentRect;
|
||||
contentRect.Intersect(gfx::Rect(gfx::Point(), contentBounds()));
|
||||
return gfx::ToEnclosingRect(contentRect);
|
||||
}
|
||||
|
||||
void Layer::setParent(Layer* layer)
|
||||
@ -216,12 +215,12 @@ int Layer::indexOfChild(const Layer* reference)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Layer::setBounds(const IntSize& size)
|
||||
void Layer::setBounds(const gfx::Size& size)
|
||||
{
|
||||
if (bounds() == size)
|
||||
return;
|
||||
|
||||
bool firstResize = bounds().isEmpty() && !size.isEmpty();
|
||||
bool firstResize = bounds().IsEmpty() && !size.IsEmpty();
|
||||
|
||||
m_bounds = size;
|
||||
|
||||
@ -259,7 +258,7 @@ void Layer::setChildren(const LayerList& children)
|
||||
addChild(children[i]);
|
||||
}
|
||||
|
||||
void Layer::setAnchorPoint(const FloatPoint& anchorPoint)
|
||||
void Layer::setAnchorPoint(const gfx::PointF& anchorPoint)
|
||||
{
|
||||
if (m_anchorPoint == anchorPoint)
|
||||
return;
|
||||
@ -283,7 +282,7 @@ void Layer::setBackgroundColor(SkColor backgroundColor)
|
||||
setNeedsCommit();
|
||||
}
|
||||
|
||||
IntSize Layer::contentBounds() const
|
||||
gfx::Size Layer::contentBounds() const
|
||||
{
|
||||
return bounds();
|
||||
}
|
||||
@ -380,7 +379,7 @@ void Layer::setContentsOpaque(bool opaque)
|
||||
setNeedsDisplay();
|
||||
}
|
||||
|
||||
void Layer::setPosition(const FloatPoint& position)
|
||||
void Layer::setPosition(const gfx::PointF& position)
|
||||
{
|
||||
if (m_position == position)
|
||||
return;
|
||||
@ -506,14 +505,14 @@ Layer* Layer::parent() const
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
void Layer::setNeedsDisplayRect(const FloatRect& dirtyRect)
|
||||
void Layer::setNeedsDisplayRect(const gfx::RectF& dirtyRect)
|
||||
{
|
||||
m_updateRect.unite(dirtyRect);
|
||||
m_updateRect.Union(dirtyRect);
|
||||
|
||||
// Simply mark the contents as dirty. For non-root layers, the call to
|
||||
// setNeedsCommit will schedule a fresh compositing pass.
|
||||
// For the root layer, setNeedsCommit has no effect.
|
||||
if (!dirtyRect.isEmpty())
|
||||
if (!dirtyRect.IsEmpty())
|
||||
m_needsDisplay = true;
|
||||
|
||||
if (drawsContent())
|
||||
@ -597,7 +596,7 @@ void Layer::pushPropertiesTo(LayerImpl* layer)
|
||||
// If the main thread commits multiple times before the impl thread actually draws, then damage tracking
|
||||
// will become incorrect if we simply clobber the updateRect here. The LayerImpl's updateRect needs to
|
||||
// accumulate (i.e. union) any update changes that have occurred on the main thread.
|
||||
m_updateRect.uniteIfNonZero(layer->updateRect());
|
||||
m_updateRect.Union(layer->updateRect());
|
||||
layer->setUpdateRect(m_updateRect);
|
||||
|
||||
layer->setScrollDelta(layer->scrollDelta() - layer->sentScrollDelta());
|
||||
@ -614,7 +613,7 @@ void Layer::pushPropertiesTo(LayerImpl* layer)
|
||||
|
||||
// Reset any state that should be cleared for the next update.
|
||||
m_stackingOrderChanged = false;
|
||||
m_updateRect = FloatRect();
|
||||
m_updateRect = gfx::RectF();
|
||||
}
|
||||
|
||||
scoped_ptr<LayerImpl> Layer::createLayerImpl()
|
||||
@ -831,7 +830,7 @@ void Layer::notifyAnimationFinished(double wallClockTime)
|
||||
Region Layer::visibleContentOpaqueRegion() const
|
||||
{
|
||||
if (contentsOpaque())
|
||||
return visibleContentRect();
|
||||
return cc::IntRect(visibleContentRect());
|
||||
return Region();
|
||||
}
|
||||
|
||||
|
43
cc/layer.h
43
cc/layer.h
@ -5,13 +5,14 @@
|
||||
#ifndef LayerChromium_h
|
||||
#define LayerChromium_h
|
||||
|
||||
#include "FloatPoint.h"
|
||||
#include "Region.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "cc/layer_animation_controller.h"
|
||||
#include "cc/occlusion_tracker.h"
|
||||
#include "cc/render_surface.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <public/WebFilterOperations.h>
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
#include <string>
|
||||
@ -66,8 +67,8 @@ public:
|
||||
|
||||
const LayerList& children() const { return m_children; }
|
||||
|
||||
void setAnchorPoint(const FloatPoint&);
|
||||
FloatPoint anchorPoint() const { return m_anchorPoint; }
|
||||
void setAnchorPoint(const gfx::PointF&);
|
||||
gfx::PointF anchorPoint() const { return m_anchorPoint; }
|
||||
|
||||
void setAnchorPointZ(float);
|
||||
float anchorPointZ() const { return m_anchorPointZ; }
|
||||
@ -77,9 +78,9 @@ public:
|
||||
|
||||
// A layer's bounds are in logical, non-page-scaled pixels (however, the
|
||||
// root layer's bounds are in physical pixels).
|
||||
void setBounds(const IntSize&);
|
||||
const IntSize& bounds() const { return m_bounds; }
|
||||
virtual IntSize contentBounds() const;
|
||||
void setBounds(const gfx::Size&);
|
||||
const gfx::Size& bounds() const { return m_bounds; }
|
||||
virtual gfx::Size contentBounds() const;
|
||||
|
||||
void setMasksToBounds(bool);
|
||||
bool masksToBounds() const { return m_masksToBounds; }
|
||||
@ -87,8 +88,8 @@ public:
|
||||
void setMaskLayer(Layer*);
|
||||
Layer* maskLayer() const { return m_maskLayer.get(); }
|
||||
|
||||
virtual void setNeedsDisplayRect(const FloatRect& dirtyRect);
|
||||
void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds())); }
|
||||
virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect);
|
||||
void setNeedsDisplay() { setNeedsDisplayRect(gfx::RectF(gfx::PointF(), bounds())); }
|
||||
virtual bool needsDisplay() const;
|
||||
|
||||
void setOpacity(float);
|
||||
@ -108,8 +109,8 @@ public:
|
||||
virtual void setContentsOpaque(bool);
|
||||
bool contentsOpaque() const { return m_contentsOpaque; }
|
||||
|
||||
void setPosition(const FloatPoint&);
|
||||
FloatPoint position() const { return m_position; }
|
||||
void setPosition(const gfx::PointF&);
|
||||
gfx::PointF position() const { return m_position; }
|
||||
|
||||
void setIsContainerForFixedPositionLayers(bool);
|
||||
bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
|
||||
@ -123,8 +124,8 @@ public:
|
||||
void setTransform(const WebKit::WebTransformationMatrix&);
|
||||
bool transformIsAnimating() const;
|
||||
|
||||
const IntRect& visibleContentRect() const { return m_visibleContentRect; }
|
||||
void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
|
||||
const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; }
|
||||
void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
|
||||
|
||||
void setScrollPosition(const IntPoint&);
|
||||
const IntPoint& scrollPosition() const { return m_scrollPosition; }
|
||||
@ -223,8 +224,8 @@ public:
|
||||
// It converts logical, non-page-scaled pixels to physical pixels.
|
||||
const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
|
||||
void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
|
||||
const IntRect& drawableContentRect() const { return m_drawableContentRect; }
|
||||
void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
|
||||
const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; }
|
||||
void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; }
|
||||
|
||||
// The contentsScale converts from logical, non-page-scaled pixels to target pixels.
|
||||
// The contentsScale is 1 for the root layer as it is already in physical pixels.
|
||||
@ -281,7 +282,7 @@ public:
|
||||
|
||||
virtual ScrollbarLayer* toScrollbarLayer();
|
||||
|
||||
IntRect layerRectToContentRect(const FloatRect& layerRect) const;
|
||||
gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const;
|
||||
|
||||
protected:
|
||||
friend class LayerImpl;
|
||||
@ -302,7 +303,7 @@ protected:
|
||||
// For layers that may do updating outside the compositor's control (i.e. plugin layers), this information
|
||||
// is not available and the update rect will remain empty.
|
||||
// Note this rect is in layer space (not content space).
|
||||
FloatRect m_updateRect;
|
||||
gfx::RectF m_updateRect;
|
||||
|
||||
scoped_refptr<Layer> m_maskLayer;
|
||||
|
||||
@ -336,10 +337,10 @@ private:
|
||||
scoped_ptr<LayerAnimationController> m_layerAnimationController;
|
||||
|
||||
// Layer properties.
|
||||
IntSize m_bounds;
|
||||
gfx::Size m_bounds;
|
||||
|
||||
// Uses layer's content space.
|
||||
IntRect m_visibleContentRect;
|
||||
gfx::Rect m_visibleContentRect;
|
||||
|
||||
IntPoint m_scrollPosition;
|
||||
IntSize m_maxScrollPosition;
|
||||
@ -348,8 +349,8 @@ private:
|
||||
bool m_haveWheelEventHandlers;
|
||||
Region m_nonFastScrollableRegion;
|
||||
bool m_nonFastScrollableRegionChanged;
|
||||
FloatPoint m_position;
|
||||
FloatPoint m_anchorPoint;
|
||||
gfx::PointF m_position;
|
||||
gfx::PointF m_anchorPoint;
|
||||
SkColor m_backgroundColor;
|
||||
SkColor m_debugBorderColor;
|
||||
float m_debugBorderWidth;
|
||||
@ -390,7 +391,7 @@ private:
|
||||
bool m_screenSpaceTransformIsAnimating;
|
||||
|
||||
// Uses target surface space.
|
||||
IntRect m_drawableContentRect;
|
||||
gfx::Rect m_drawableContentRect;
|
||||
float m_rasterScale;
|
||||
bool m_automaticallyComputeRasterScale;
|
||||
bool m_boundsContainPageScale;
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "cc/scrollbar_animation_controller.h"
|
||||
#include "cc/settings.h"
|
||||
#include "third_party/skia/include/core/SkImageFilter.h"
|
||||
#include "ui/gfx/point_conversions.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
|
||||
using WebKit::WebTransformationMatrix;
|
||||
|
||||
@ -152,7 +154,7 @@ void LayerImpl::appendDebugBorderQuad(QuadSink& quadList, const SharedQuadState*
|
||||
if (!hasDebugBorders())
|
||||
return;
|
||||
|
||||
IntRect contentRect(IntPoint(), contentBounds());
|
||||
gfx::Rect contentRect(gfx::Point(), contentBounds());
|
||||
quadList.append(DebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth()).PassAs<DrawQuad>(), appendQuadsData);
|
||||
}
|
||||
|
||||
@ -210,8 +212,8 @@ InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const IntPoint& screenSpac
|
||||
|
||||
if (!nonFastScrollableRegion().isEmpty()) {
|
||||
bool clipped = false;
|
||||
FloatPoint hitTestPointInLocalSpace = MathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(screenSpacePoint), clipped);
|
||||
if (!clipped && nonFastScrollableRegion().contains(flooredIntPoint(hitTestPointInLocalSpace))) {
|
||||
gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(screenSpacePoint), clipped);
|
||||
if (!clipped && nonFastScrollableRegion().contains(cc::IntPoint(gfx::ToFlooredPoint(hitTestPointInLocalSpace)))) {
|
||||
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed nonFastScrollableRegion");
|
||||
return InputHandlerClient::ScrollOnMainThread;
|
||||
}
|
||||
@ -235,15 +237,13 @@ bool LayerImpl::drawCheckerboardForMissingTiles() const
|
||||
return m_drawCheckerboardForMissingTiles && !Settings::backgroundColorInsteadOfCheckerboard();
|
||||
}
|
||||
|
||||
IntRect LayerImpl::layerRectToContentRect(const FloatRect& layerRect) const
|
||||
gfx::Rect LayerImpl::layerRectToContentRect(const gfx::RectF& layerRect) const
|
||||
{
|
||||
FloatRect contentRect(layerRect);
|
||||
contentRect.scale(contentsScaleX(), contentsScaleY());
|
||||
IntRect intContentRect = enclosingIntRect(contentRect);
|
||||
gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), contentsScaleY());
|
||||
// Intersect with content rect to avoid the extra pixel because for some
|
||||
// values x and y, ceil((x / y) * y) may be x + 1.
|
||||
intContentRect.intersect(IntRect(IntPoint(), contentBounds()));
|
||||
return intContentRect;
|
||||
contentRect.Intersect(gfx::Rect(gfx::Point(), contentBounds()));
|
||||
return gfx::ToEnclosingRect(contentRect);
|
||||
}
|
||||
|
||||
std::string LayerImpl::indentString(int indent)
|
||||
@ -360,7 +360,7 @@ void LayerImpl::resetAllChangeTrackingForSubtree()
|
||||
m_layerPropertyChanged = false;
|
||||
m_layerSurfacePropertyChanged = false;
|
||||
|
||||
m_updateRect = FloatRect();
|
||||
m_updateRect = gfx::RectF();
|
||||
|
||||
if (m_renderSurface)
|
||||
m_renderSurface->resetPropertyChangedFlag();
|
||||
@ -405,7 +405,7 @@ void LayerImpl::setTransformFromAnimation(const WebTransformationMatrix& transfo
|
||||
setTransform(transform);
|
||||
}
|
||||
|
||||
void LayerImpl::setBounds(const IntSize& bounds)
|
||||
void LayerImpl::setBounds(const gfx::Size& bounds)
|
||||
{
|
||||
if (m_bounds == bounds)
|
||||
return;
|
||||
@ -451,7 +451,7 @@ void LayerImpl::setDrawsContent(bool drawsContent)
|
||||
m_layerPropertyChanged = true;
|
||||
}
|
||||
|
||||
void LayerImpl::setAnchorPoint(const FloatPoint& anchorPoint)
|
||||
void LayerImpl::setAnchorPoint(const gfx::PointF& anchorPoint)
|
||||
{
|
||||
if (m_anchorPoint == anchorPoint)
|
||||
return;
|
||||
@ -539,7 +539,7 @@ bool LayerImpl::opacityIsAnimating() const
|
||||
return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opacity);
|
||||
}
|
||||
|
||||
void LayerImpl::setPosition(const FloatPoint& position)
|
||||
void LayerImpl::setPosition(const gfx::PointF& position)
|
||||
{
|
||||
if (m_position == position)
|
||||
return;
|
||||
@ -604,7 +604,7 @@ bool LayerImpl::hasDebugBorders() const
|
||||
return SkColorGetA(m_debugBorderColor) && debugBorderWidth() > 0;
|
||||
}
|
||||
|
||||
void LayerImpl::setContentBounds(const IntSize& contentBounds)
|
||||
void LayerImpl::setContentBounds(const gfx::Size& contentBounds)
|
||||
{
|
||||
if (m_contentBounds == contentBounds)
|
||||
return;
|
||||
@ -662,7 +662,7 @@ void LayerImpl::setDoubleSided(bool doubleSided)
|
||||
Region LayerImpl::visibleContentOpaqueRegion() const
|
||||
{
|
||||
if (contentsOpaque())
|
||||
return visibleContentRect();
|
||||
return cc::IntRect(visibleContentRect());
|
||||
return Region();
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
#ifndef CCLayerImpl_h
|
||||
#define CCLayerImpl_h
|
||||
|
||||
#include "FloatRect.h"
|
||||
#include "IntRect.h"
|
||||
#include "Region.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
@ -18,6 +16,8 @@
|
||||
#include "cc/scoped_ptr_vector.h"
|
||||
#include "cc/shared_quad_state.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <public/WebFilterOperations.h>
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
#include <string>
|
||||
@ -95,8 +95,8 @@ public:
|
||||
// Returns true if any of the layer's descendants has content to draw.
|
||||
virtual bool descendantDrawsContent();
|
||||
|
||||
void setAnchorPoint(const FloatPoint&);
|
||||
const FloatPoint& anchorPoint() const { return m_anchorPoint; }
|
||||
void setAnchorPoint(const gfx::PointF&);
|
||||
const gfx::PointF& anchorPoint() const { return m_anchorPoint; }
|
||||
|
||||
void setAnchorPointZ(float);
|
||||
float anchorPointZ() const { return m_anchorPointZ; }
|
||||
@ -122,8 +122,8 @@ public:
|
||||
void setOpacity(float);
|
||||
bool opacityIsAnimating() const;
|
||||
|
||||
void setPosition(const FloatPoint&);
|
||||
const FloatPoint& position() const { return m_position; }
|
||||
void setPosition(const gfx::PointF&);
|
||||
const gfx::PointF& position() const { return m_position; }
|
||||
|
||||
void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; }
|
||||
bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
|
||||
@ -171,13 +171,13 @@ public:
|
||||
// contentsScale to appropriate values. LayerImpl doesn't calculate any of
|
||||
// them from the other values.
|
||||
|
||||
void setBounds(const IntSize&);
|
||||
const IntSize& bounds() const { return m_bounds; }
|
||||
void setBounds(const gfx::Size&);
|
||||
const gfx::Size& bounds() const { return m_bounds; }
|
||||
|
||||
// ContentBounds may be [0, 1) pixels larger than bounds * contentsScale.
|
||||
// Don't calculate scale from it. Use contentsScale instead for accuracy.
|
||||
void setContentBounds(const IntSize&);
|
||||
IntSize contentBounds() const { return m_contentBounds; }
|
||||
void setContentBounds(const gfx::Size&);
|
||||
gfx::Size contentBounds() const { return m_contentBounds; }
|
||||
|
||||
float contentsScaleX() const { return m_contentsScaleX; }
|
||||
float contentsScaleY() const { return m_contentsScaleY; }
|
||||
@ -218,8 +218,8 @@ public:
|
||||
|
||||
InputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, InputHandlerClient::ScrollInputType) const;
|
||||
|
||||
const IntRect& visibleContentRect() const { return m_visibleContentRect; }
|
||||
void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
|
||||
const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; }
|
||||
void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
|
||||
|
||||
bool doubleSided() const { return m_doubleSided; }
|
||||
void setDoubleSided(bool);
|
||||
@ -237,10 +237,10 @@ public:
|
||||
bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
|
||||
void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
|
||||
|
||||
const IntRect& drawableContentRect() const { return m_drawableContentRect; }
|
||||
void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
|
||||
const FloatRect& updateRect() const { return m_updateRect; }
|
||||
void setUpdateRect(const FloatRect& updateRect) { m_updateRect = updateRect; }
|
||||
const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; }
|
||||
void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; }
|
||||
const gfx::RectF& updateRect() const { return m_updateRect; }
|
||||
void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect; }
|
||||
|
||||
std::string layerTreeAsText() const;
|
||||
|
||||
@ -270,7 +270,7 @@ public:
|
||||
ScrollbarLayerImpl* verticalScrollbarLayer() const;
|
||||
void setVerticalScrollbarLayer(ScrollbarLayerImpl*);
|
||||
|
||||
IntRect layerRectToContentRect(const FloatRect& layerRect) const;
|
||||
gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const;
|
||||
|
||||
protected:
|
||||
explicit LayerImpl(int);
|
||||
@ -306,10 +306,10 @@ private:
|
||||
LayerTreeHostImpl* m_layerTreeHostImpl;
|
||||
|
||||
// Properties synchronized from the associated Layer.
|
||||
FloatPoint m_anchorPoint;
|
||||
gfx::PointF m_anchorPoint;
|
||||
float m_anchorPointZ;
|
||||
IntSize m_bounds;
|
||||
IntSize m_contentBounds;
|
||||
gfx::Size m_bounds;
|
||||
gfx::Size m_contentBounds;
|
||||
float m_contentsScaleX;
|
||||
float m_contentsScaleY;
|
||||
IntPoint m_scrollPosition;
|
||||
@ -332,11 +332,11 @@ private:
|
||||
bool m_layerSurfacePropertyChanged;
|
||||
|
||||
// Uses layer's content space.
|
||||
IntRect m_visibleContentRect;
|
||||
gfx::Rect m_visibleContentRect;
|
||||
bool m_masksToBounds;
|
||||
bool m_contentsOpaque;
|
||||
float m_opacity;
|
||||
FloatPoint m_position;
|
||||
gfx::PointF m_position;
|
||||
bool m_preserves3D;
|
||||
bool m_useParentBackfaceVisibility;
|
||||
bool m_drawCheckerboardForMissingTiles;
|
||||
@ -394,12 +394,12 @@ private:
|
||||
|
||||
// Hierarchical bounding rect containing the layer and its descendants.
|
||||
// Uses target surface's space.
|
||||
IntRect m_drawableContentRect;
|
||||
gfx::Rect m_drawableContentRect;
|
||||
|
||||
// Rect indicating what was repainted/updated during update.
|
||||
// Note that plugin layers bypass this and leave it empty.
|
||||
// Uses layer's content space.
|
||||
FloatRect m_updateRect;
|
||||
gfx::RectF m_updateRect;
|
||||
|
||||
// Manages animations for this layer.
|
||||
scoped_ptr<LayerAnimationController> m_layerAnimationController;
|
||||
|
@ -37,9 +37,9 @@ private:
|
||||
: Layer()
|
||||
, m_drawsContent(true)
|
||||
{
|
||||
setBounds(IntSize(100, 100));
|
||||
setPosition(IntPoint());
|
||||
setAnchorPoint(IntPoint());
|
||||
setBounds(gfx::Size(100, 100));
|
||||
setPosition(gfx::Point());
|
||||
setAnchorPoint(gfx::Point());
|
||||
}
|
||||
virtual ~TestLayer()
|
||||
{
|
||||
@ -211,7 +211,7 @@ TEST(LayerIteratorTest, complexTreeMultiSurface)
|
||||
scoped_refptr<TestLayer> root231 = TestLayer::create();
|
||||
|
||||
rootLayer->createRenderSurface();
|
||||
rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds()));
|
||||
rootLayer->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), rootLayer->bounds()));
|
||||
|
||||
rootLayer->addChild(root1);
|
||||
rootLayer->addChild(root2);
|
||||
|
@ -10,15 +10,15 @@
|
||||
|
||||
namespace cc {
|
||||
|
||||
LayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q)
|
||||
LayerQuad::Edge::Edge(const gfx::PointF& p, const gfx::PointF& q)
|
||||
{
|
||||
DCHECK(p != q);
|
||||
|
||||
FloatPoint tangent(p.y() - q.y(), q.x() - p.x());
|
||||
gfx::Vector2dF tangent(p.y() - q.y(), q.x() - p.x());
|
||||
float cross2 = p.x() * q.y() - q.x() * p.y();
|
||||
|
||||
set(tangent.x(), tangent.y(), cross2);
|
||||
scale(1.0f / tangent.length());
|
||||
scale(1.0f / tangent.Length());
|
||||
}
|
||||
|
||||
LayerQuad::LayerQuad(const FloatQuad& quad)
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
, m_z(0)
|
||||
{
|
||||
}
|
||||
Edge(const FloatPoint&, const FloatPoint&);
|
||||
Edge(const gfx::PointF&, const gfx::PointF&);
|
||||
|
||||
float x() const { return m_x; }
|
||||
float y() const { return m_y; }
|
||||
@ -60,9 +60,9 @@ public:
|
||||
}
|
||||
void scale(float s) { scale(s, s, s); }
|
||||
|
||||
FloatPoint intersect(const Edge& e) const
|
||||
gfx::PointF intersect(const Edge& e) const
|
||||
{
|
||||
return FloatPoint(
|
||||
return gfx::PointF(
|
||||
(y() * e.z() - e.y() * z()) / (x() * e.y() - e.x() * y()),
|
||||
(x() * e.z() - e.x() * z()) / (e.x() * y() - x() * e.y()));
|
||||
}
|
||||
|
@ -20,18 +20,18 @@ using WebKit::WebTransformationMatrix;
|
||||
|
||||
namespace cc {
|
||||
|
||||
inline static float perpProduct(const FloatSize& u, const FloatSize& v)
|
||||
inline static float perpProduct(const gfx::Vector2dF& u, const gfx::Vector2dF& v)
|
||||
{
|
||||
return u.width() * v.height() - u.height() * v.width();
|
||||
return u.x() * v.y() - u.y() * v.x();
|
||||
}
|
||||
|
||||
// Tests if two edges defined by their endpoints (a,b) and (c,d) intersect. Returns true and the
|
||||
// point of intersection if they do and false otherwise.
|
||||
static bool edgeEdgeTest(const FloatPoint& a, const FloatPoint& b, const FloatPoint& c, const FloatPoint& d, FloatPoint& r)
|
||||
static bool edgeEdgeTest(const gfx::PointF& a, const gfx::PointF& b, const gfx::PointF& c, const gfx::PointF& d, gfx::PointF& r)
|
||||
{
|
||||
FloatSize u = b - a;
|
||||
FloatSize v = d - c;
|
||||
FloatSize w = a - c;
|
||||
gfx::Vector2dF u = b - a;
|
||||
gfx::Vector2dF v = d - c;
|
||||
gfx::Vector2dF w = a - c;
|
||||
|
||||
float denom = perpProduct(u, v);
|
||||
|
||||
@ -49,7 +49,7 @@ static bool edgeEdgeTest(const FloatPoint& a, const FloatPoint& b, const FloatPo
|
||||
if (t < 0 || t > 1)
|
||||
return false;
|
||||
|
||||
u.scale(s);
|
||||
u.Scale(s);
|
||||
r = a + u;
|
||||
return true;
|
||||
}
|
||||
@ -81,14 +81,14 @@ LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape
|
||||
weight = 0;
|
||||
|
||||
// Early out if the projected bounds don't overlap.
|
||||
if (!a->projectedBounds.intersects(b->projectedBounds))
|
||||
if (!a->projectedBounds.Intersects(b->projectedBounds))
|
||||
return None;
|
||||
|
||||
FloatPoint aPoints[4] = {a->projectedQuad.p1(), a->projectedQuad.p2(), a->projectedQuad.p3(), a->projectedQuad.p4() };
|
||||
FloatPoint bPoints[4] = {b->projectedQuad.p1(), b->projectedQuad.p2(), b->projectedQuad.p3(), b->projectedQuad.p4() };
|
||||
gfx::PointF aPoints[4] = {a->projectedQuad.p1(), a->projectedQuad.p2(), a->projectedQuad.p3(), a->projectedQuad.p4() };
|
||||
gfx::PointF bPoints[4] = {b->projectedQuad.p1(), b->projectedQuad.p2(), b->projectedQuad.p3(), b->projectedQuad.p4() };
|
||||
|
||||
// Make a list of points that inside both layer quad projections.
|
||||
std::vector<FloatPoint> overlapPoints;
|
||||
std::vector<gfx::PointF> overlapPoints;
|
||||
|
||||
// Check all four corners of one layer against the other layer's quad.
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@ -99,7 +99,7 @@ LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape
|
||||
}
|
||||
|
||||
// Check all the edges of one layer for intersection with the other layer's edges.
|
||||
FloatPoint r;
|
||||
gfx::PointF r;
|
||||
for (int ea = 0; ea < 4; ++ea)
|
||||
for (int eb = 0; eb < 4; ++eb)
|
||||
if (edgeEdgeTest(aPoints[ea], aPoints[(ea + 1) % 4],
|
||||
@ -153,7 +153,7 @@ LayerShape::LayerShape(float width, float height, const WebTransformationMatrix&
|
||||
|
||||
// Compute the projection of the layer quad onto the z = 0 plane.
|
||||
|
||||
FloatPoint clippedQuad[8];
|
||||
gfx::PointF clippedQuad[8];
|
||||
int numVerticesInClippedQuad;
|
||||
MathUtil::mapClippedQuad(drawTransform, layerQuad, clippedQuad, numVerticesInClippedQuad);
|
||||
|
||||
@ -190,14 +190,18 @@ LayerShape::LayerShape(float width, float height, const WebTransformationMatrix&
|
||||
transformOrigin = c1;
|
||||
}
|
||||
|
||||
LayerShape::~LayerShape()
|
||||
{
|
||||
}
|
||||
|
||||
// Returns the Z coordinate of a point on the layer that projects
|
||||
// to point p which lies on the z = 0 plane. It does it by computing the
|
||||
// intersection of a line starting from p along the Z axis and the plane
|
||||
// of the layer.
|
||||
float LayerShape::layerZFromProjectedPoint(const FloatPoint& p) const
|
||||
float LayerShape::layerZFromProjectedPoint(const gfx::PointF& p) const
|
||||
{
|
||||
const FloatPoint3D zAxis(0, 0, 1);
|
||||
FloatPoint3D w = FloatPoint3D(p) - transformOrigin;
|
||||
FloatPoint3D w = FloatPoint3D(cc::FloatPoint(p)) - transformOrigin;
|
||||
|
||||
float d = layerNormal.dot(zAxis);
|
||||
float n = -layerNormal.dot(w);
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include "FloatPoint3D.h"
|
||||
#include "FloatQuad.h"
|
||||
#include "FloatRect.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "base/hash_tables.h"
|
||||
#include "cc/layer_impl.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
|
||||
#if defined(COMPILER_GCC)
|
||||
namespace cc
|
||||
@ -40,13 +40,14 @@ struct GraphEdge;
|
||||
struct LayerShape {
|
||||
LayerShape();
|
||||
LayerShape(float width, float height, const WebKit::WebTransformationMatrix& drawTransform);
|
||||
~LayerShape();
|
||||
|
||||
float layerZFromProjectedPoint(const FloatPoint&) const;
|
||||
float layerZFromProjectedPoint(const gfx::PointF&) const;
|
||||
|
||||
FloatPoint3D layerNormal;
|
||||
FloatPoint3D transformOrigin;
|
||||
FloatQuad projectedQuad;
|
||||
FloatRect projectedBounds;
|
||||
gfx::RectF projectedBounds;
|
||||
};
|
||||
|
||||
struct GraphNode {
|
||||
|
@ -13,13 +13,13 @@ using namespace std;
|
||||
|
||||
namespace cc {
|
||||
|
||||
scoped_ptr<LayerTilingData> LayerTilingData::create(const IntSize& tileSize, BorderTexelOption border)
|
||||
scoped_ptr<LayerTilingData> LayerTilingData::create(const gfx::Size& tileSize, BorderTexelOption border)
|
||||
{
|
||||
return make_scoped_ptr(new LayerTilingData(tileSize, border));
|
||||
}
|
||||
|
||||
LayerTilingData::LayerTilingData(const IntSize& tileSize, BorderTexelOption border)
|
||||
: m_tilingData(tileSize, IntSize(), border == HasBorderTexels)
|
||||
LayerTilingData::LayerTilingData(const gfx::Size& tileSize, BorderTexelOption border)
|
||||
: m_tilingData(cc::IntSize(tileSize), cc::IntSize(), border == HasBorderTexels)
|
||||
{
|
||||
setTileSize(tileSize);
|
||||
}
|
||||
@ -28,19 +28,19 @@ LayerTilingData::~LayerTilingData()
|
||||
{
|
||||
}
|
||||
|
||||
void LayerTilingData::setTileSize(const IntSize& size)
|
||||
void LayerTilingData::setTileSize(const gfx::Size& size)
|
||||
{
|
||||
if (tileSize() == size)
|
||||
return;
|
||||
|
||||
reset();
|
||||
|
||||
m_tilingData.setMaxTextureSize(size);
|
||||
m_tilingData.setMaxTextureSize(cc::IntSize(size));
|
||||
}
|
||||
|
||||
IntSize LayerTilingData::tileSize() const
|
||||
gfx::Size LayerTilingData::tileSize() const
|
||||
{
|
||||
return m_tilingData.maxTextureSize();
|
||||
return cc::IntSize(m_tilingData.maxTextureSize());
|
||||
}
|
||||
|
||||
void LayerTilingData::setBorderTexelOption(BorderTexelOption borderTexelOption)
|
||||
@ -82,29 +82,29 @@ void LayerTilingData::reset()
|
||||
m_tiles.clear();
|
||||
}
|
||||
|
||||
void LayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const
|
||||
void LayerTilingData::contentRectToTileIndices(const gfx::Rect& contentRect, int& left, int& top, int& right, int& bottom) const
|
||||
{
|
||||
// An empty rect doesn't result in an empty set of tiles, so don't pass an empty rect.
|
||||
// FIXME: Possibly we should fill a vector of tiles instead,
|
||||
// since the normal use of this function is to enumerate some tiles.
|
||||
DCHECK(!contentRect.isEmpty());
|
||||
DCHECK(!contentRect.IsEmpty());
|
||||
|
||||
left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x());
|
||||
top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y());
|
||||
right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1);
|
||||
bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1);
|
||||
right = m_tilingData.tileXIndexFromSrcCoord(contentRect.right() - 1);
|
||||
bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.bottom() - 1);
|
||||
}
|
||||
|
||||
IntRect LayerTilingData::tileRect(const Tile* tile) const
|
||||
gfx::Rect LayerTilingData::tileRect(const Tile* tile) const
|
||||
{
|
||||
IntRect tileRect = m_tilingData.tileBoundsWithBorder(tile->i(), tile->j());
|
||||
tileRect.setSize(tileSize());
|
||||
gfx::Rect tileRect = cc::IntRect(m_tilingData.tileBoundsWithBorder(tile->i(), tile->j()));
|
||||
tileRect.set_size(tileSize());
|
||||
return tileRect;
|
||||
}
|
||||
|
||||
Region LayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const
|
||||
Region LayerTilingData::opaqueRegionInContentRect(const gfx::Rect& contentRect) const
|
||||
{
|
||||
if (contentRect.isEmpty())
|
||||
if (contentRect.IsEmpty())
|
||||
return Region();
|
||||
|
||||
Region opaqueRegion;
|
||||
@ -116,24 +116,24 @@ Region LayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) co
|
||||
if (!tile)
|
||||
continue;
|
||||
|
||||
IntRect tileOpaqueRect = intersection(contentRect, tile->opaqueRect());
|
||||
opaqueRegion.unite(tileOpaqueRect);
|
||||
gfx::Rect tileOpaqueRect = gfx::IntersectRects(contentRect, tile->opaqueRect());
|
||||
opaqueRegion.unite(cc::IntRect(tileOpaqueRect));
|
||||
}
|
||||
}
|
||||
return opaqueRegion;
|
||||
}
|
||||
|
||||
void LayerTilingData::setBounds(const IntSize& size)
|
||||
void LayerTilingData::setBounds(const gfx::Size& size)
|
||||
{
|
||||
m_tilingData.setTotalSize(size);
|
||||
if (size.isEmpty()) {
|
||||
m_tilingData.setTotalSize(cc::IntSize(size));
|
||||
if (size.IsEmpty()) {
|
||||
m_tiles.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
// Any tiles completely outside our new bounds are invalid and should be dropped.
|
||||
int left, top, right, bottom;
|
||||
contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom);
|
||||
contentRectToTileIndices(gfx::Rect(gfx::Point(), size), left, top, right, bottom);
|
||||
std::vector<TileMapKey> invalidTileKeys;
|
||||
for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) {
|
||||
if (it->first.first > right || it->first.second > bottom)
|
||||
@ -143,9 +143,9 @@ void LayerTilingData::setBounds(const IntSize& size)
|
||||
m_tiles.erase(invalidTileKeys[i]);
|
||||
}
|
||||
|
||||
IntSize LayerTilingData::bounds() const
|
||||
gfx::Size LayerTilingData::bounds() const
|
||||
{
|
||||
return m_tilingData.totalSize();
|
||||
return cc::IntSize(m_tilingData.totalSize());
|
||||
}
|
||||
|
||||
} // namespace cc
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "cc/hash_pair.h"
|
||||
#include "cc/scoped_ptr_hash_map.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "IntRect.h"
|
||||
#include "Region.h"
|
||||
#include "TilingData.h"
|
||||
@ -22,17 +23,20 @@ public:
|
||||
|
||||
~LayerTilingData();
|
||||
|
||||
static scoped_ptr<LayerTilingData> create(const IntSize& tileSize, BorderTexelOption);
|
||||
static scoped_ptr<LayerTilingData> create(const gfx::Size& tileSize, BorderTexelOption);
|
||||
|
||||
bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); }
|
||||
int numTilesX() const { return m_tilingData.numTilesX(); }
|
||||
int numTilesY() const { return m_tilingData.numTilesY(); }
|
||||
IntRect tileBounds(int i, int j) const { return m_tilingData.tileBounds(i, j); }
|
||||
IntPoint textureOffset(int xIndex, int yIndex) const { return m_tilingData.textureOffset(xIndex, yIndex); }
|
||||
gfx::Rect tileBounds(int i, int j) const { return cc::IntRect(m_tilingData.tileBounds(i, j)); }
|
||||
gfx::Vector2d textureOffset(int xIndex, int yIndex) const {
|
||||
cc::IntPoint p(m_tilingData.textureOffset(xIndex, yIndex));
|
||||
return gfx::Vector2d(p.x(), p.y());
|
||||
}
|
||||
|
||||
// Change the tile size. This may invalidate all the existing tiles.
|
||||
void setTileSize(const IntSize&);
|
||||
IntSize tileSize() const;
|
||||
void setTileSize(const gfx::Size&);
|
||||
gfx::Size tileSize() const;
|
||||
// Change the border texel setting. This may invalidate all existing tiles.
|
||||
void setBorderTexelOption(BorderTexelOption);
|
||||
bool hasBorderTexels() const { return m_tilingData.borderTexels(); }
|
||||
@ -50,12 +54,12 @@ public:
|
||||
int j() const { return m_j; }
|
||||
void moveTo(int i, int j) { m_i = i; m_j = j; }
|
||||
|
||||
const IntRect& opaqueRect() const { return m_opaqueRect; }
|
||||
void setOpaqueRect(const IntRect& opaqueRect) { m_opaqueRect = opaqueRect; }
|
||||
const gfx::Rect& opaqueRect() const { return m_opaqueRect; }
|
||||
void setOpaqueRect(const gfx::Rect& opaqueRect) { m_opaqueRect = opaqueRect; }
|
||||
private:
|
||||
int m_i;
|
||||
int m_j;
|
||||
IntRect m_opaqueRect;
|
||||
gfx::Rect m_opaqueRect;
|
||||
DISALLOW_COPY_AND_ASSIGN(Tile);
|
||||
};
|
||||
typedef std::pair<int, int> TileMapKey;
|
||||
@ -66,18 +70,18 @@ public:
|
||||
Tile* tileAt(int, int) const;
|
||||
const TileMap& tiles() const { return m_tiles; }
|
||||
|
||||
void setBounds(const IntSize&);
|
||||
IntSize bounds() const;
|
||||
void setBounds(const gfx::Size&);
|
||||
gfx::Size bounds() const;
|
||||
|
||||
void contentRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const;
|
||||
IntRect tileRect(const Tile*) const;
|
||||
void contentRectToTileIndices(const gfx::Rect&, int &left, int &top, int &right, int &bottom) const;
|
||||
gfx::Rect tileRect(const Tile*) const;
|
||||
|
||||
Region opaqueRegionInContentRect(const IntRect&) const;
|
||||
Region opaqueRegionInContentRect(const gfx::Rect&) const;
|
||||
|
||||
void reset();
|
||||
|
||||
protected:
|
||||
LayerTilingData(const IntSize& tileSize, BorderTexelOption);
|
||||
LayerTilingData(const gfx::Size& tileSize, BorderTexelOption);
|
||||
|
||||
TileMap m_tiles;
|
||||
TilingData m_tilingData;
|
||||
|
@ -50,9 +50,9 @@ LayerTreeSettings::LayerTreeSettings()
|
||||
, renderVSyncEnabled(true)
|
||||
, refreshRate(0)
|
||||
, maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
|
||||
, defaultTileSize(IntSize(256, 256))
|
||||
, maxUntiledLayerSize(IntSize(512, 512))
|
||||
, minimumOcclusionTrackingSize(IntSize(160, 160))
|
||||
, defaultTileSize(gfx::Size(256, 256))
|
||||
, maxUntiledLayerSize(gfx::Size(512, 512))
|
||||
, minimumOcclusionTrackingSize(gfx::Size(160, 160))
|
||||
{
|
||||
}
|
||||
|
||||
@ -165,14 +165,14 @@ void LayerTreeHost::initializeRenderer()
|
||||
m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates());
|
||||
|
||||
m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, Renderer::ContentPool);
|
||||
m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GL_RGBA);
|
||||
m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(gfx::Size(), GL_RGBA);
|
||||
|
||||
m_rendererInitialized = true;
|
||||
|
||||
m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
|
||||
min(m_settings.defaultTileSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
|
||||
m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
|
||||
min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
|
||||
m_settings.defaultTileSize = gfx::Size(min(m_settings.defaultTileSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
|
||||
min(m_settings.defaultTileSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
|
||||
m_settings.maxUntiledLayerSize = gfx::Size(min(m_settings.maxUntiledLayerSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
|
||||
min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
|
||||
}
|
||||
|
||||
LayerTreeHost::RecreateResult LayerTreeHost::recreateContext()
|
||||
@ -421,7 +421,7 @@ void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer)
|
||||
setNeedsCommit();
|
||||
}
|
||||
|
||||
void LayerTreeHost::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize)
|
||||
void LayerTreeHost::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
|
||||
{
|
||||
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
|
||||
return;
|
||||
@ -502,7 +502,7 @@ void LayerTreeHost::updateLayers(ResourceUpdateQueue& queue, size_t memoryAlloca
|
||||
if (!rootLayer())
|
||||
return;
|
||||
|
||||
if (layoutViewportSize().isEmpty())
|
||||
if (layoutViewportSize().IsEmpty())
|
||||
return;
|
||||
|
||||
m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes);
|
||||
@ -675,7 +675,7 @@ bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList,
|
||||
DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating());
|
||||
needMoreUpdates |= paintMasksForRenderSurface(*it, queue);
|
||||
} else if (it.representsItself()) {
|
||||
DCHECK(!it->bounds().isEmpty());
|
||||
DCHECK(!it->bounds().IsEmpty());
|
||||
it->update(queue, &occlusionTracker, m_renderingStats);
|
||||
needMoreUpdates |= it->needMoreUpdates();
|
||||
}
|
||||
@ -709,7 +709,7 @@ void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info)
|
||||
m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta);
|
||||
}
|
||||
|
||||
FloatPoint LayerTreeHost::adjustEventPointForPinchZoom(const FloatPoint& point)
|
||||
gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& point)
|
||||
const
|
||||
{
|
||||
WebKit::WebTransformationMatrix inverseImplTransform = m_implTransform;
|
||||
@ -724,7 +724,7 @@ FloatPoint LayerTreeHost::adjustEventPointForPinchZoom(const FloatPoint& point)
|
||||
/ inverseImplTransform.m22());
|
||||
inverseImplTransform = inverseImplTransform.inverse();
|
||||
bool wasClipped = false;
|
||||
FloatPoint adjustedPoint = MathUtil::projectPoint(inverseImplTransform, point, wasClipped);
|
||||
gfx::PointF adjustedPoint = MathUtil::projectPoint(inverseImplTransform, point, wasClipped);
|
||||
DCHECK(!wasClipped);
|
||||
|
||||
return adjustedPoint;
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "IntRect.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "base/cancelable_callback.h"
|
||||
#include "base/hash_tables.h"
|
||||
@ -25,6 +24,7 @@
|
||||
#include "cc/rendering_stats.h"
|
||||
#include "cc/scoped_ptr_vector.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
|
||||
#if defined(COMPILER_GCC)
|
||||
namespace BASE_HASH_NAMESPACE {
|
||||
@ -40,6 +40,7 @@ struct hash<WebKit::WebGraphicsContext3D*> {
|
||||
namespace cc {
|
||||
|
||||
class FontAtlas;
|
||||
class IntRect;
|
||||
class Layer;
|
||||
class LayerTreeHostImpl;
|
||||
class LayerTreeHostImplClient;
|
||||
@ -65,9 +66,9 @@ struct LayerTreeSettings {
|
||||
bool renderVSyncEnabled;
|
||||
double refreshRate;
|
||||
size_t maxPartialTextureUpdates;
|
||||
IntSize defaultTileSize;
|
||||
IntSize maxUntiledLayerSize;
|
||||
IntSize minimumOcclusionTrackingSize;
|
||||
gfx::Size defaultTileSize;
|
||||
gfx::Size maxUntiledLayerSize;
|
||||
gfx::Size minimumOcclusionTrackingSize;
|
||||
|
||||
bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter || showDebugRects(); }
|
||||
bool showDebugRects() const { return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects; }
|
||||
@ -173,10 +174,10 @@ public:
|
||||
|
||||
const LayerTreeSettings& settings() const { return m_settings; }
|
||||
|
||||
void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
|
||||
void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
|
||||
|
||||
const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
|
||||
const IntSize& deviceViewportSize() const { return m_deviceViewportSize; }
|
||||
const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
|
||||
const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; }
|
||||
|
||||
void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
|
||||
|
||||
@ -192,7 +193,7 @@ public:
|
||||
void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration);
|
||||
|
||||
void applyScrollAndScale(const ScrollAndScaleSet&);
|
||||
FloatPoint adjustEventPointForPinchZoom(const FloatPoint&) const;
|
||||
gfx::PointF adjustEventPointForPinchZoom(const gfx::PointF&) const;
|
||||
void setImplTransform(const WebKit::WebTransformationMatrix&);
|
||||
|
||||
void startRateLimiter(WebKit::WebGraphicsContext3D*);
|
||||
@ -261,8 +262,8 @@ private:
|
||||
|
||||
LayerTreeSettings m_settings;
|
||||
|
||||
IntSize m_layoutViewportSize;
|
||||
IntSize m_deviceViewportSize;
|
||||
gfx::Size m_layoutViewportSize;
|
||||
gfx::Size m_deviceViewportSize;
|
||||
float m_deviceScaleFactor;
|
||||
|
||||
bool m_visible;
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include "cc/layer_tree_host_common.h"
|
||||
|
||||
#include "FloatQuad.h"
|
||||
#include "IntRect.h"
|
||||
#include "cc/layer.h"
|
||||
#include "cc/layer_impl.h"
|
||||
#include "cc/layer_iterator.h"
|
||||
@ -15,6 +13,7 @@
|
||||
#include "cc/math_util.h"
|
||||
#include "cc/render_surface.h"
|
||||
#include "cc/render_surface_impl.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
#include <algorithm>
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
|
||||
@ -30,26 +29,26 @@ ScrollAndScaleSet::~ScrollAndScaleSet()
|
||||
{
|
||||
}
|
||||
|
||||
IntRect LayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebTransformationMatrix& transform)
|
||||
gfx::Rect LayerTreeHostCommon::calculateVisibleRect(const gfx::Rect& targetSurfaceRect, const gfx::Rect& layerBoundRect, const WebTransformationMatrix& transform)
|
||||
{
|
||||
// Is this layer fully contained within the target surface?
|
||||
IntRect layerInSurfaceSpace = MathUtil::mapClippedRect(transform, layerBoundRect);
|
||||
if (targetSurfaceRect.contains(layerInSurfaceSpace))
|
||||
gfx::Rect layerInSurfaceSpace = MathUtil::mapClippedRect(transform, layerBoundRect);
|
||||
if (targetSurfaceRect.Contains(layerInSurfaceSpace))
|
||||
return layerBoundRect;
|
||||
|
||||
// If the layer doesn't fill up the entire surface, then find the part of
|
||||
// the surface rect where the layer could be visible. This avoids trying to
|
||||
// project surface rect points that are behind the projection point.
|
||||
IntRect minimalSurfaceRect = targetSurfaceRect;
|
||||
minimalSurfaceRect.intersect(layerInSurfaceSpace);
|
||||
gfx::Rect minimalSurfaceRect = targetSurfaceRect;
|
||||
minimalSurfaceRect.Intersect(layerInSurfaceSpace);
|
||||
|
||||
// Project the corners of the target surface rect into the layer space.
|
||||
// This bounding rectangle may be larger than it needs to be (being
|
||||
// axis-aligned), but is a reasonable filter on the space to consider.
|
||||
// Non-invertible transforms will create an empty rect here.
|
||||
const WebTransformationMatrix surfaceToLayer = transform.inverse();
|
||||
IntRect layerRect = enclosingIntRect(MathUtil::projectClippedRect(surfaceToLayer, FloatRect(minimalSurfaceRect)));
|
||||
layerRect.intersect(layerBoundRect);
|
||||
gfx::Rect layerRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(surfaceToLayer, gfx::RectF(minimalSurfaceRect)));
|
||||
layerRect.Intersect(layerBoundRect);
|
||||
return layerRect;
|
||||
}
|
||||
|
||||
@ -116,31 +115,31 @@ static inline bool layerClipsSubtree(LayerType* layer)
|
||||
}
|
||||
|
||||
template<typename LayerType>
|
||||
static IntRect calculateVisibleContentRect(LayerType* layer)
|
||||
static gfx::Rect calculateVisibleContentRect(LayerType* layer)
|
||||
{
|
||||
DCHECK(layer->renderTarget());
|
||||
|
||||
// Nothing is visible if the layer bounds are empty.
|
||||
if (!layer->drawsContent() || layer->contentBounds().isEmpty() || layer->drawableContentRect().isEmpty())
|
||||
return IntRect();
|
||||
if (!layer->drawsContent() || layer->contentBounds().IsEmpty() || layer->drawableContentRect().IsEmpty())
|
||||
return gfx::Rect();
|
||||
|
||||
IntRect targetSurfaceClipRect;
|
||||
gfx::Rect targetSurfaceClipRect;
|
||||
|
||||
// First, compute visible bounds in target surface space.
|
||||
if (layer->renderTarget()->renderSurface()->clipRect().isEmpty())
|
||||
if (layer->renderTarget()->renderSurface()->clipRect().IsEmpty())
|
||||
targetSurfaceClipRect = layer->drawableContentRect();
|
||||
else {
|
||||
// In this case the target surface does clip layers that contribute to it. So, we
|
||||
// have convert the current surface's clipRect from its ancestor surface space to
|
||||
// the current surface space.
|
||||
targetSurfaceClipRect = enclosingIntRect(MathUtil::projectClippedRect(layer->renderTarget()->renderSurface()->drawTransform().inverse(), layer->renderTarget()->renderSurface()->clipRect()));
|
||||
targetSurfaceClipRect.intersect(layer->drawableContentRect());
|
||||
targetSurfaceClipRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(layer->renderTarget()->renderSurface()->drawTransform().inverse(), layer->renderTarget()->renderSurface()->clipRect()));
|
||||
targetSurfaceClipRect.Intersect(layer->drawableContentRect());
|
||||
}
|
||||
|
||||
if (targetSurfaceClipRect.isEmpty())
|
||||
return IntRect();
|
||||
if (targetSurfaceClipRect.IsEmpty())
|
||||
return gfx::Rect();
|
||||
|
||||
return LayerTreeHostCommon::calculateVisibleRect(targetSurfaceClipRect, IntRect(IntPoint(), layer->contentBounds()), layer->drawTransform());
|
||||
return LayerTreeHostCommon::calculateVisibleRect(targetSurfaceClipRect, gfx::Rect(gfx::Point(), layer->contentBounds()), layer->drawTransform());
|
||||
}
|
||||
|
||||
static bool isScaleOrTranslation(const WebTransformationMatrix& m)
|
||||
@ -188,7 +187,7 @@ static bool layerShouldBeSkipped(LayerType* layer)
|
||||
// we would have skipped the entire subtree and never made it into this function,
|
||||
// so it is safe to omit this check here.
|
||||
|
||||
if (!layer->drawsContent() || layer->bounds().isEmpty())
|
||||
if (!layer->drawsContent() || layer->bounds().IsEmpty())
|
||||
return true;
|
||||
|
||||
LayerType* backfaceTestLayer = layer;
|
||||
@ -359,7 +358,7 @@ static inline void updateLayerContentsScale(Layer* layer, const WebTransformatio
|
||||
rasterScale = 1;
|
||||
|
||||
if (layer->automaticallyComputeRasterScale()) {
|
||||
FloatPoint transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
|
||||
gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
|
||||
float combinedScale = std::max(transformScale.x(), transformScale.y());
|
||||
rasterScale = combinedScale / deviceScaleFactor;
|
||||
if (!layer->boundsContainPageScale())
|
||||
@ -387,9 +386,9 @@ static inline void updateLayerContentsScale(Layer* layer, const WebTransformatio
|
||||
template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter>
|
||||
static void calculateDrawTransformsInternal(LayerType* layer, const WebTransformationMatrix& parentMatrix,
|
||||
const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix,
|
||||
const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree,
|
||||
const gfx::Rect& clipRectFromAncestor, bool ancestorClipsSubtree,
|
||||
RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList,
|
||||
LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, IntRect& drawableContentRectOfSubtree)
|
||||
LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, gfx::Rect& drawableContentRectOfSubtree)
|
||||
{
|
||||
// This function computes the new matrix transformations recursively for this
|
||||
// layer and all its descendants. It also computes the appropriate render surfaces.
|
||||
@ -402,7 +401,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
// positive Y-axis points downwards. This interpretation is valid because the orthographic
|
||||
// projection applied at draw time flips the Y axis appropriately.
|
||||
//
|
||||
// 2. The anchor point, when given as a FloatPoint object, is specified in "unit layer space",
|
||||
// 2. The anchor point, when given as a PointF object, is specified in "unit layer space",
|
||||
// where the bounds of the layer map to [0, 1]. However, as a WebTransformationMatrix object,
|
||||
// the transform to the anchor point is specified in "layer space", where the bounds
|
||||
// of the layer map to [bounds.width(), bounds.height()].
|
||||
@ -474,13 +473,13 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
//
|
||||
|
||||
// If we early-exit anywhere in this function, the drawableContentRect of this subtree should be considered empty.
|
||||
drawableContentRectOfSubtree = IntRect();
|
||||
drawableContentRectOfSubtree = gfx::Rect();
|
||||
|
||||
// The root layer cannot skip calcDrawTransforms.
|
||||
if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer))
|
||||
return;
|
||||
|
||||
IntRect clipRectForSubtree;
|
||||
gfx::Rect clipRectForSubtree;
|
||||
bool subtreeShouldBeClipped = false;
|
||||
|
||||
float drawOpacity = layer->opacity();
|
||||
@ -490,9 +489,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating();
|
||||
}
|
||||
|
||||
IntSize bounds = layer->bounds();
|
||||
FloatPoint anchorPoint = layer->anchorPoint();
|
||||
FloatPoint position = layer->position() - layer->scrollDelta();
|
||||
gfx::Size bounds = layer->bounds();
|
||||
gfx::PointF anchorPoint = layer->anchorPoint();
|
||||
gfx::PointF position = layer->position() - gfx::Vector2d(layer->scrollDelta().width(), layer->scrollDelta().height());
|
||||
|
||||
WebTransformationMatrix layerLocalTransform;
|
||||
// LT = Tr[origin] * Tr[origin2anchor]
|
||||
@ -523,7 +522,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
// The drawTransform that gets computed below is effectively the layer's drawTransform, unless
|
||||
// the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms.
|
||||
WebTransformationMatrix drawTransform = combinedTransform;
|
||||
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
|
||||
if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty()) {
|
||||
// M[draw] = M[parent] * LT * S[layer2content]
|
||||
drawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(),
|
||||
1.0 / layer->contentsScaleY());
|
||||
@ -543,14 +542,14 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating();
|
||||
}
|
||||
|
||||
FloatRect contentRect(FloatPoint(), layer->contentBounds());
|
||||
gfx::RectF contentRect(gfx::PointF(), layer->contentBounds());
|
||||
|
||||
// fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space.
|
||||
// nextHierarchyMatrix will only change if this layer uses a new RenderSurfaceImpl, otherwise remains the same.
|
||||
WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix;
|
||||
WebTransformationMatrix sublayerMatrix;
|
||||
|
||||
FloatPoint renderSurfaceSublayerScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
|
||||
gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
|
||||
|
||||
if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combinedTransform))) {
|
||||
// Check back-face visibility before continuing with this surface and its subtree
|
||||
@ -565,20 +564,16 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
|
||||
// The owning layer's draw transform has a scale from content to layer space which we need to undo and
|
||||
// replace with a scale from the surface's subtree into layer space.
|
||||
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
|
||||
drawTransform.scaleNonUniform(layer->contentsScaleX(),
|
||||
layer->contentsScaleY());
|
||||
}
|
||||
if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty())
|
||||
drawTransform.scaleNonUniform(layer->contentsScaleX(), layer->contentsScaleY());
|
||||
drawTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
|
||||
renderSurface->setDrawTransform(drawTransform);
|
||||
|
||||
// The origin of the new surface is the upper left corner of the layer.
|
||||
WebTransformationMatrix layerDrawTransform;
|
||||
layerDrawTransform.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
|
||||
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
|
||||
layerDrawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(),
|
||||
1.0 / layer->contentsScaleY());
|
||||
}
|
||||
if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty())
|
||||
layerDrawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(), 1.0 / layer->contentsScaleY());
|
||||
layer->setDrawTransform(layerDrawTransform);
|
||||
|
||||
// Inside the surface's subtree, we scale everything to the owning layer's scale.
|
||||
@ -611,12 +606,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
|
||||
if (layer->maskLayer()) {
|
||||
layer->maskLayer()->setRenderTarget(layer);
|
||||
layer->maskLayer()->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->maskLayer()->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
}
|
||||
|
||||
if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) {
|
||||
layer->replicaLayer()->maskLayer()->setRenderTarget(layer);
|
||||
layer->replicaLayer()->maskLayer()->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->replicaLayer()->maskLayer()->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
}
|
||||
|
||||
// FIXME: make this smarter for the SkImageFilter case (check for
|
||||
@ -628,7 +623,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
if (ancestorClipsSubtree)
|
||||
renderSurface->setClipRect(clipRectFromAncestor);
|
||||
else
|
||||
renderSurface->setClipRect(IntRect());
|
||||
renderSurface->setClipRect(gfx::Rect());
|
||||
|
||||
renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMovesPixels);
|
||||
|
||||
@ -655,13 +650,13 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
layer->setRenderTarget(layer->parent()->renderTarget());
|
||||
}
|
||||
|
||||
IntRect rectInTargetSpace = enclosingIntRect(MathUtil::mapClippedRect(layer->drawTransform(), contentRect));
|
||||
gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer->drawTransform(), contentRect));
|
||||
|
||||
if (layerClipsSubtree(layer)) {
|
||||
subtreeShouldBeClipped = true;
|
||||
if (ancestorClipsSubtree && !layer->renderSurface()) {
|
||||
clipRectForSubtree = clipRectFromAncestor;
|
||||
clipRectForSubtree.intersect(rectInTargetSpace);
|
||||
clipRectForSubtree.Intersect(rectInTargetSpace);
|
||||
} else
|
||||
clipRectForSubtree = rectInTargetSpace;
|
||||
}
|
||||
@ -685,35 +680,35 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
|
||||
WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensationMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);;
|
||||
|
||||
IntRect accumulatedDrawableContentRectOfChildren;
|
||||
gfx::Rect accumulatedDrawableContentRectOfChildren;
|
||||
for (size_t i = 0; i < layer->children().size(); ++i) {
|
||||
LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children(), i);
|
||||
IntRect drawableContentRectOfChildSubtree;
|
||||
gfx::Rect drawableContentRectOfChildSubtree;
|
||||
calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix,
|
||||
clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels,
|
||||
renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor, drawableContentRectOfChildSubtree);
|
||||
if (!drawableContentRectOfChildSubtree.isEmpty()) {
|
||||
accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOfChildSubtree);
|
||||
if (!drawableContentRectOfChildSubtree.IsEmpty()) {
|
||||
accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOfChildSubtree);
|
||||
if (child->renderSurface())
|
||||
descendants.push_back(child);
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the total drawableContentRect for this subtree (the rect is in targetSurface space)
|
||||
IntRect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOfChildren;
|
||||
gfx::Rect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOfChildren;
|
||||
if (layer->drawsContent())
|
||||
localDrawableContentRectOfSubtree.unite(rectInTargetSpace);
|
||||
localDrawableContentRectOfSubtree.Union(rectInTargetSpace);
|
||||
if (subtreeShouldBeClipped)
|
||||
localDrawableContentRectOfSubtree.intersect(clipRectForSubtree);
|
||||
localDrawableContentRectOfSubtree.Intersect(clipRectForSubtree);
|
||||
|
||||
// Compute the layer's drawable content rect (the rect is in targetSurface space)
|
||||
IntRect drawableContentRectOfLayer = rectInTargetSpace;
|
||||
gfx::Rect drawableContentRectOfLayer = rectInTargetSpace;
|
||||
if (subtreeShouldBeClipped)
|
||||
drawableContentRectOfLayer.intersect(clipRectForSubtree);
|
||||
drawableContentRectOfLayer.Intersect(clipRectForSubtree);
|
||||
layer->setDrawableContentRect(drawableContentRectOfLayer);
|
||||
|
||||
// Compute the layer's visible content rect (the rect is in content space)
|
||||
IntRect visibleContentRectOfLayer = calculateVisibleContentRect(layer);
|
||||
gfx::Rect visibleContentRectOfLayer = calculateVisibleContentRect(layer);
|
||||
layer->setVisibleContentRect(visibleContentRectOfLayer);
|
||||
|
||||
// Compute the remaining properties for the render surface, if the layer has one.
|
||||
@ -723,7 +718,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
layer->renderSurface()->setContentRect(clipRectFromAncestor);
|
||||
} else if (layer->renderSurface() && !isRootLayer(layer)) {
|
||||
RenderSurfaceType* renderSurface = layer->renderSurface();
|
||||
IntRect clippedContentRect = localDrawableContentRectOfSubtree;
|
||||
gfx::Rect clippedContentRect = localDrawableContentRectOfSubtree;
|
||||
|
||||
// Don't clip if the layer is reflected as the reflection shouldn't be
|
||||
// clipped. If the layer is animating, then the surface's transform to
|
||||
@ -731,18 +726,18 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
// to clip.
|
||||
if (!layer->replicaLayer() && transformToParentIsKnown(layer)) {
|
||||
// Note, it is correct to use ancestorClipsSubtree here, because we are looking at this layer's renderSurface, not the layer itself.
|
||||
if (ancestorClipsSubtree && !clippedContentRect.isEmpty()) {
|
||||
IntRect surfaceClipRect = LayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->drawTransform());
|
||||
clippedContentRect.intersect(surfaceClipRect);
|
||||
if (ancestorClipsSubtree && !clippedContentRect.IsEmpty()) {
|
||||
gfx::Rect surfaceClipRect = LayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->drawTransform());
|
||||
clippedContentRect.Intersect(surfaceClipRect);
|
||||
}
|
||||
}
|
||||
|
||||
// The RenderSurfaceImpl backing texture cannot exceed the maximum supported
|
||||
// texture size.
|
||||
clippedContentRect.setWidth(std::min(clippedContentRect.width(), maxTextureSize));
|
||||
clippedContentRect.setHeight(std::min(clippedContentRect.height(), maxTextureSize));
|
||||
clippedContentRect.set_width(std::min(clippedContentRect.width(), maxTextureSize));
|
||||
clippedContentRect.set_height(std::min(clippedContentRect.height(), maxTextureSize));
|
||||
|
||||
if (clippedContentRect.isEmpty())
|
||||
if (clippedContentRect.IsEmpty())
|
||||
renderSurface->clearLayerLists();
|
||||
|
||||
renderSurface->setContentRect(clippedContentRect);
|
||||
@ -750,10 +745,8 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
// The owning layer's screenSpaceTransform has a scale from content to layer space which we need to undo and
|
||||
// replace with a scale from the surface's subtree into layer space.
|
||||
WebTransformationMatrix screenSpaceTransform = layer->screenSpaceTransform();
|
||||
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
|
||||
screenSpaceTransform.scaleNonUniform(layer->contentsScaleX(),
|
||||
layer->contentsScaleY());
|
||||
}
|
||||
if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty())
|
||||
screenSpaceTransform.scaleNonUniform(layer->contentsScaleX(), layer->contentsScaleY());
|
||||
screenSpaceTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
|
||||
renderSurface->setScreenSpaceTransform(screenSpaceTransform);
|
||||
|
||||
@ -804,7 +797,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
sortLayers(descendants.begin() + sortingStartIndex, descendants.end(), layerSorter);
|
||||
|
||||
if (layer->renderSurface())
|
||||
drawableContentRectOfSubtree = enclosingIntRect(layer->renderSurface()->drawableContentRect());
|
||||
drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface()->drawableContentRect());
|
||||
else
|
||||
drawableContentRectOfSubtree = localDrawableContentRectOfSubtree;
|
||||
|
||||
@ -812,9 +805,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
|
||||
layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPassLayer(layer);
|
||||
}
|
||||
|
||||
void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList)
|
||||
void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList)
|
||||
{
|
||||
IntRect totalDrawableContentRect;
|
||||
gfx::Rect totalDrawableContentRect;
|
||||
WebTransformationMatrix identityMatrix;
|
||||
WebTransformationMatrix deviceScaleTransform;
|
||||
deviceScaleTransform.scale(deviceScaleFactor);
|
||||
@ -822,7 +815,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSiz
|
||||
|
||||
// The root layer's renderSurface should receive the deviceViewport as the initial clipRect.
|
||||
bool subtreeShouldBeClipped = true;
|
||||
IntRect deviceViewportRect(IntPoint::zero(), deviceViewportSize);
|
||||
gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
|
||||
|
||||
// This function should have received a root layer.
|
||||
DCHECK(isRootLayer(rootLayer));
|
||||
@ -839,9 +832,9 @@ void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSiz
|
||||
DCHECK(rootLayer->renderSurface());
|
||||
}
|
||||
|
||||
void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter* layerSorter, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList)
|
||||
void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter* layerSorter, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList)
|
||||
{
|
||||
IntRect totalDrawableContentRect;
|
||||
gfx::Rect totalDrawableContentRect;
|
||||
WebTransformationMatrix identityMatrix;
|
||||
WebTransformationMatrix deviceScaleTransform;
|
||||
deviceScaleTransform.scale(deviceScaleFactor);
|
||||
@ -849,7 +842,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const In
|
||||
|
||||
// The root layer's renderSurface should receive the deviceViewport as the initial clipRect.
|
||||
bool subtreeShouldBeClipped = true;
|
||||
IntRect deviceViewportRect(IntPoint::zero(), deviceViewportSize);
|
||||
gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
|
||||
|
||||
// This function should have received a root layer.
|
||||
DCHECK(isRootLayer(rootLayer));
|
||||
@ -866,7 +859,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const In
|
||||
DCHECK(rootLayer->renderSurface());
|
||||
}
|
||||
|
||||
static bool pointHitsRect(const IntPoint& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, FloatRect localSpaceRect)
|
||||
static bool pointHitsRect(const gfx::Point& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect)
|
||||
{
|
||||
// If the transform is not invertible, then assume that this point doesn't hit this rect.
|
||||
if (!localSpaceToScreenSpaceTransform.isInvertible())
|
||||
@ -874,16 +867,16 @@ static bool pointHitsRect(const IntPoint& screenSpacePoint, const WebTransformat
|
||||
|
||||
// Transform the hit test point from screen space to the local space of the given rect.
|
||||
bool clipped = false;
|
||||
FloatPoint hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), FloatPoint(screenSpacePoint), clipped);
|
||||
gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), gfx::PointF(screenSpacePoint), clipped);
|
||||
|
||||
// If projectPoint could not project to a valid value, then we assume that this point doesn't hit this rect.
|
||||
if (clipped)
|
||||
return false;
|
||||
|
||||
return localSpaceRect.contains(hitTestPointInLocalSpace);
|
||||
return localSpaceRect.Contains(hitTestPointInLocalSpace);
|
||||
}
|
||||
|
||||
static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint, LayerImpl* layer)
|
||||
static bool pointIsClippedBySurfaceOrClipRect(const gfx::Point& screenSpacePoint, LayerImpl* layer)
|
||||
{
|
||||
LayerImpl* currentLayer = layer;
|
||||
|
||||
@ -905,7 +898,7 @@ static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint,
|
||||
return false;
|
||||
}
|
||||
|
||||
LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList)
|
||||
LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::Point& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList)
|
||||
{
|
||||
LayerImpl* foundLayer = 0;
|
||||
|
||||
@ -919,7 +912,7 @@ LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& screen
|
||||
|
||||
LayerImpl* currentLayer = (*it);
|
||||
|
||||
FloatRect contentRect(FloatPoint::zero(), currentLayer->contentBounds());
|
||||
gfx::RectF contentRect(gfx::PointF(), currentLayer->contentBounds());
|
||||
if (!pointHitsRect(screenSpacePoint, currentLayer->screenSpaceTransform(), contentRect))
|
||||
continue;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "cc/scoped_ptr_vector.h"
|
||||
#include "IntRect.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "IntSize.h"
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
|
||||
@ -19,13 +19,13 @@ class Layer;
|
||||
|
||||
class LayerTreeHostCommon {
|
||||
public:
|
||||
static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&);
|
||||
static gfx::Rect calculateVisibleRect(const gfx::Rect& targetSurfaceRect, const gfx::Rect& layerBoundRect, const WebKit::WebTransformationMatrix&);
|
||||
|
||||
static void calculateDrawTransforms(Layer* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList);
|
||||
static void calculateDrawTransforms(LayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter*, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList);
|
||||
static void calculateDrawTransforms(Layer* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList);
|
||||
static void calculateDrawTransforms(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter*, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList);
|
||||
|
||||
// Performs hit testing for a given renderSurfaceLayerList.
|
||||
static LayerImpl* findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList);
|
||||
static LayerImpl* findLayerThatIsHitByPoint(const gfx::Point& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList);
|
||||
|
||||
template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -94,13 +94,13 @@ bool PinchZoomViewport::setPageScaleFactorAndLimits(float pageScaleFactor, float
|
||||
return true;
|
||||
}
|
||||
|
||||
FloatRect PinchZoomViewport::bounds() const
|
||||
gfx::RectF PinchZoomViewport::bounds() const
|
||||
{
|
||||
FloatSize scaledViewportSize = m_layoutViewportSize;
|
||||
scaledViewportSize.scale(1 / totalPageScaleFactor());
|
||||
gfx::SizeF scaledViewportSize = m_layoutViewportSize;
|
||||
scaledViewportSize = scaledViewportSize.Scale(1 / totalPageScaleFactor());
|
||||
|
||||
FloatRect bounds(FloatPoint(0, 0), scaledViewportSize);
|
||||
bounds.setLocation(m_pinchViewportScrollDelta);
|
||||
gfx::RectF bounds(gfx::PointF(), scaledViewportSize);
|
||||
bounds.set_origin(m_pinchViewportScrollDelta);
|
||||
|
||||
return bounds;
|
||||
}
|
||||
@ -108,7 +108,7 @@ FloatRect PinchZoomViewport::bounds() const
|
||||
FloatSize PinchZoomViewport::applyScroll(FloatSize& delta)
|
||||
{
|
||||
FloatSize overflow;
|
||||
FloatRect pinchedBounds = bounds();
|
||||
FloatRect pinchedBounds = cc::FloatRect(bounds());
|
||||
|
||||
pinchedBounds.move(delta);
|
||||
if (pinchedBounds.x() < 0) {
|
||||
@ -266,7 +266,7 @@ bool LayerTreeHostImpl::canDraw()
|
||||
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no root layer");
|
||||
return false;
|
||||
}
|
||||
if (deviceViewportSize().isEmpty()) {
|
||||
if (deviceViewportSize().IsEmpty()) {
|
||||
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport");
|
||||
return false;
|
||||
}
|
||||
@ -301,11 +301,11 @@ void LayerTreeHostImpl::startPageScaleAnimation(const IntSize& targetPosition, b
|
||||
IntSize scrollTotal = flooredIntSize(m_rootScrollLayerImpl->scrollPosition() + m_rootScrollLayerImpl->scrollDelta());
|
||||
scrollTotal.scale(m_pinchZoomViewport.pageScaleDelta());
|
||||
float scaleTotal = m_pinchZoomViewport.totalPageScaleFactor();
|
||||
IntSize scaledContentSize = contentSize();
|
||||
IntSize scaledContentSize = cc::IntSize(contentSize());
|
||||
scaledContentSize.scale(m_pinchZoomViewport.pageScaleDelta());
|
||||
|
||||
double startTimeSeconds = (startTime - base::TimeTicks()).InSecondsF();
|
||||
m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, scaleTotal, m_deviceViewportSize, scaledContentSize, startTimeSeconds);
|
||||
m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, scaleTotal, cc::IntSize(m_deviceViewportSize), scaledContentSize, startTimeSeconds);
|
||||
|
||||
if (anchorPoint) {
|
||||
IntSize windowAnchor(targetPosition);
|
||||
@ -411,7 +411,7 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
|
||||
RenderPass::Id contributingRenderPassId = it->renderSurface()->renderPassId();
|
||||
RenderPass* contributingRenderPass = frame.renderPassesById.get(contributingRenderPassId);
|
||||
targetRenderPass->appendQuadsForRenderSurfaceLayer(*it, contributingRenderPass, &occlusionTracker, appendQuadsData);
|
||||
} else if (it.representsItself() && !it->visibleContentRect().isEmpty()) {
|
||||
} else if (it.representsItself() && !it->visibleContentRect().IsEmpty()) {
|
||||
bool hasOcclusionFromOutsideTargetSurface;
|
||||
bool implDrawTransformIsUnknown = false;
|
||||
if (occlusionTracker.occluded(it->renderTarget(), it->visibleContentRect(), it->drawTransform(), implDrawTransformIsUnknown, it->drawableContentRect(), &hasOcclusionFromOutsideTargetSurface))
|
||||
@ -509,12 +509,12 @@ void LayerTreeHostImpl::setBackgroundTickingEnabled(bool enabled)
|
||||
m_timeSourceClientAdapter->setActive(enabled);
|
||||
}
|
||||
|
||||
IntSize LayerTreeHostImpl::contentSize() const
|
||||
gfx::Size LayerTreeHostImpl::contentSize() const
|
||||
{
|
||||
// TODO(aelias): Hardcoding the first child here is weird. Think of
|
||||
// a cleaner way to get the contentBounds on the Impl side.
|
||||
if (!m_rootScrollLayerImpl || m_rootScrollLayerImpl->children().isEmpty())
|
||||
return IntSize();
|
||||
return gfx::Size();
|
||||
return m_rootScrollLayerImpl->children()[0]->contentBounds();
|
||||
}
|
||||
|
||||
@ -733,7 +733,7 @@ bool LayerTreeHostImpl::swapBuffers()
|
||||
return m_renderer->swapBuffers();
|
||||
}
|
||||
|
||||
const IntSize& LayerTreeHostImpl::deviceViewportSize() const
|
||||
const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const
|
||||
{
|
||||
return m_deviceViewportSize;
|
||||
}
|
||||
@ -753,7 +753,7 @@ void LayerTreeHostImpl::onSwapBuffersComplete()
|
||||
m_client->onSwapBuffersCompleteOnImplThread();
|
||||
}
|
||||
|
||||
void LayerTreeHostImpl::readback(void* pixels, const IntRect& rect)
|
||||
void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect)
|
||||
{
|
||||
DCHECK(m_renderer);
|
||||
m_renderer->getFramebufferPixels(pixels, rect);
|
||||
@ -886,7 +886,7 @@ void LayerTreeHostImpl::resetContentsTexturesPurged()
|
||||
m_client->onCanDrawStateChanged(canDraw());
|
||||
}
|
||||
|
||||
void LayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize)
|
||||
void LayerTreeHostImpl::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
|
||||
{
|
||||
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
|
||||
return;
|
||||
@ -964,28 +964,28 @@ void LayerTreeHostImpl::updateMaxScrollPosition()
|
||||
if (!m_rootScrollLayerImpl || !m_rootScrollLayerImpl->children().size())
|
||||
return;
|
||||
|
||||
FloatSize viewBounds = m_deviceViewportSize;
|
||||
gfx::SizeF viewBounds = m_deviceViewportSize;
|
||||
if (LayerImpl* clipLayer = m_rootScrollLayerImpl->parent()) {
|
||||
// Compensate for non-overlay scrollbars.
|
||||
if (clipLayer->masksToBounds()) {
|
||||
viewBounds = clipLayer->bounds();
|
||||
viewBounds.scale(m_deviceScaleFactor);
|
||||
viewBounds = viewBounds.Scale(m_deviceScaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
IntSize contentBounds = contentSize();
|
||||
gfx::Size contentBounds = contentSize();
|
||||
if (Settings::pageScalePinchZoomEnabled()) {
|
||||
// Pinch with pageScale scrolls entirely in layout space. contentSize
|
||||
// returns the bounds including the page scale factor, so calculate the
|
||||
// pre page-scale layout size here.
|
||||
float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor();
|
||||
contentBounds.setWidth(contentBounds.width() / pageScaleFactor);
|
||||
contentBounds.setHeight(contentBounds.height() / pageScaleFactor);
|
||||
contentBounds.set_width(contentBounds.width() / pageScaleFactor);
|
||||
contentBounds.set_height(contentBounds.height() / pageScaleFactor);
|
||||
} else {
|
||||
viewBounds.scale(1 / m_pinchZoomViewport.pageScaleDelta());
|
||||
viewBounds = viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta());
|
||||
}
|
||||
|
||||
IntSize maxScroll = contentBounds - expandedIntSize(viewBounds);
|
||||
IntSize maxScroll = cc::IntSize(contentBounds) - expandedIntSize(cc::FloatSize(viewBounds));
|
||||
maxScroll.scale(1 / m_deviceScaleFactor);
|
||||
|
||||
// The viewport may be larger than the contents in some cases, such as
|
||||
@ -1092,8 +1092,8 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport,
|
||||
// in layer coordinates.
|
||||
bool startClipped, endClipped;
|
||||
FloatPoint screenSpaceEndPoint = screenSpacePoint + screenSpaceDelta;
|
||||
FloatPoint localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped);
|
||||
FloatPoint localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped);
|
||||
FloatPoint localStartPoint = cc::FloatPoint(MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped));
|
||||
FloatPoint localEndPoint = cc::FloatPoint(MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped));
|
||||
|
||||
// In general scroll point coordinates should not get clipped.
|
||||
DCHECK(!startClipped);
|
||||
@ -1102,8 +1102,8 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport,
|
||||
return FloatSize();
|
||||
|
||||
// localStartPoint and localEndPoint are in content space but we want to move them to layer space for scrolling.
|
||||
float widthScale = 1.0 / layerImpl.contentsScaleX();
|
||||
float heightScale = 1.0 / layerImpl.contentsScaleY();
|
||||
float widthScale = 1 / layerImpl.contentsScaleX();
|
||||
float heightScale = 1 / layerImpl.contentsScaleY();
|
||||
localStartPoint.scale(widthScale, heightScale);
|
||||
localEndPoint.scale(widthScale, heightScale);
|
||||
|
||||
@ -1116,11 +1116,11 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport,
|
||||
|
||||
// Get the end point in the layer's content space so we can apply its screenSpaceTransform.
|
||||
FloatPoint actualLocalEndPoint = localStartPoint + layerImpl.scrollDelta() - previousDelta;
|
||||
FloatPoint actualLocalContentEndPoint = actualLocalEndPoint;
|
||||
actualLocalContentEndPoint.scale(1 / widthScale, 1 / heightScale);
|
||||
gfx::PointF actualLocalContentEndPoint = actualLocalEndPoint;
|
||||
actualLocalContentEndPoint = actualLocalContentEndPoint.Scale(1 / widthScale, 1 / heightScale);
|
||||
|
||||
// Calculate the applied scroll delta in viewport space coordinates.
|
||||
FloatPoint actualScreenSpaceEndPoint = MathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped);
|
||||
FloatPoint actualScreenSpaceEndPoint = cc::FloatPoint(MathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped));
|
||||
DCHECK(!endClipped);
|
||||
if (endClipped)
|
||||
return FloatSize();
|
||||
@ -1205,7 +1205,7 @@ void LayerTreeHostImpl::pinchGestureBegin()
|
||||
}
|
||||
|
||||
void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta,
|
||||
const IntPoint& anchor)
|
||||
const IntPoint& anchor)
|
||||
{
|
||||
TRACE_EVENT0("cc", "LayerTreeHostImpl::pinchGestureUpdate");
|
||||
|
||||
@ -1278,14 +1278,13 @@ void LayerTreeHostImpl::computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo)
|
||||
scrollBegin.scale(m_pinchZoomViewport.pageScaleDelta());
|
||||
float scaleBegin = m_pinchZoomViewport.totalPageScaleFactor();
|
||||
float pageScaleDeltaToSend = m_pinchZoomViewport.minPageScaleFactor() / m_pinchZoomViewport.pageScaleFactor();
|
||||
FloatSize scaledContentsSize = contentSize();
|
||||
scaledContentsSize.scale(pageScaleDeltaToSend);
|
||||
gfx::SizeF scaledContentsSize = contentSize().Scale(pageScaleDeltaToSend);
|
||||
|
||||
FloatSize anchor = toSize(m_previousPinchAnchor);
|
||||
FloatSize scrollEnd = scrollBegin + anchor;
|
||||
scrollEnd.scale(m_pinchZoomViewport.minPageScaleFactor() / scaleBegin);
|
||||
scrollEnd -= anchor;
|
||||
scrollEnd = scrollEnd.shrunkTo(roundedIntSize(scaledContentsSize - m_deviceViewportSize)).expandedTo(FloatSize(0, 0));
|
||||
scrollEnd = scrollEnd.shrunkTo(roundedIntSize(cc::FloatSize(scaledContentsSize) - cc::IntSize(m_deviceViewportSize))).expandedTo(FloatSize(0, 0));
|
||||
scrollEnd.scale(1 / pageScaleDeltaToSend);
|
||||
scrollEnd.scale(m_deviceScaleFactor);
|
||||
|
||||
|
@ -75,10 +75,10 @@ public:
|
||||
float maxPageScaleFactor);
|
||||
|
||||
// Returns the bounds and offset of the scaled and translated viewport to use for pinch-zoom.
|
||||
FloatRect bounds() const;
|
||||
gfx::RectF bounds() const;
|
||||
const FloatPoint& scrollDelta() const { return m_pinchViewportScrollDelta; }
|
||||
|
||||
void setLayoutViewportSize(const FloatSize& size) { m_layoutViewportSize = size; }
|
||||
void setLayoutViewportSize(const gfx::SizeF& size) { m_layoutViewportSize = size; }
|
||||
|
||||
// Apply the scroll offset in layout space to the offset of the pinch-zoom viewport. The viewport cannot be
|
||||
// scrolled outside of the layout viewport bounds. Returns the component of the scroll that is un-applied due to
|
||||
@ -95,7 +95,7 @@ private:
|
||||
float m_minPageScaleFactor;
|
||||
|
||||
FloatPoint m_pinchViewportScrollDelta;
|
||||
FloatSize m_layoutViewportSize;
|
||||
gfx::SizeF m_layoutViewportSize;
|
||||
};
|
||||
|
||||
// LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering state
|
||||
@ -147,7 +147,7 @@ public:
|
||||
void didDrawAllLayers(const FrameData&);
|
||||
|
||||
// RendererClient implementation
|
||||
virtual const IntSize& deviceViewportSize() const OVERRIDE;
|
||||
virtual const gfx::Size& deviceViewportSize() const OVERRIDE;
|
||||
virtual const LayerTreeSettings& settings() const OVERRIDE;
|
||||
virtual void didLoseContext() OVERRIDE;
|
||||
virtual void onSwapBuffersComplete() OVERRIDE;
|
||||
@ -174,7 +174,7 @@ public:
|
||||
|
||||
bool swapBuffers();
|
||||
|
||||
void readback(void* pixels, const IntRect&);
|
||||
void readback(void* pixels, const gfx::Rect&);
|
||||
|
||||
void setRootLayer(scoped_ptr<LayerImpl>);
|
||||
LayerImpl* rootLayer() { return m_rootLayerImpl.get(); }
|
||||
@ -199,8 +199,8 @@ public:
|
||||
void resetContentsTexturesPurged();
|
||||
size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.bytesLimitWhenVisible; }
|
||||
|
||||
void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
|
||||
const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
|
||||
void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
|
||||
const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
|
||||
|
||||
float deviceScaleFactor() const { return m_deviceScaleFactor; }
|
||||
void setDeviceScaleFactor(float);
|
||||
@ -295,7 +295,7 @@ private:
|
||||
bool calculateRenderPasses(FrameData&);
|
||||
void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base::Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
|
||||
void setBackgroundTickingEnabled(bool);
|
||||
IntSize contentSize() const;
|
||||
gfx::Size contentSize() const;
|
||||
|
||||
void sendDidLoseContextRecursive(LayerImpl*);
|
||||
void clearRenderSurfaces();
|
||||
@ -316,8 +316,8 @@ private:
|
||||
int m_scrollingLayerIdFromPreviousTree;
|
||||
bool m_scrollDeltaIsInViewportSpace;
|
||||
LayerTreeSettings m_settings;
|
||||
IntSize m_layoutViewportSize;
|
||||
IntSize m_deviceViewportSize;
|
||||
gfx::Size m_layoutViewportSize;
|
||||
gfx::Size m_deviceViewportSize;
|
||||
float m_deviceScaleFactor;
|
||||
bool m_visible;
|
||||
bool m_contentsTexturesPurged;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,8 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
#include "third_party/khronos/GLES2/gl2ext.h"
|
||||
#include "ui/gfx/point_conversions.h"
|
||||
#include "ui/gfx/size_conversions.h"
|
||||
#include <public/WebLayerScrollClient.h>
|
||||
#include <public/WebSize.h>
|
||||
|
||||
@ -309,7 +311,7 @@ public:
|
||||
m_numCommits++;
|
||||
if (m_numCommits == 1) {
|
||||
// Make the viewport empty so the host says it can't draw.
|
||||
m_layerTreeHost->setViewportSize(IntSize(0, 0), IntSize(0, 0));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(0, 0), gfx::Size(0, 0));
|
||||
|
||||
scoped_array<char> pixels(new char[4]);
|
||||
m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1));
|
||||
@ -990,7 +992,7 @@ public:
|
||||
|
||||
virtual void beginTest() OVERRIDE
|
||||
{
|
||||
m_layerTreeHost->setViewportSize(IntSize(20, 20), IntSize(20, 20));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(20, 20), gfx::Size(20, 20));
|
||||
m_layerTreeHost->setBackgroundColor(SK_ColorGRAY);
|
||||
m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5);
|
||||
|
||||
@ -999,7 +1001,7 @@ public:
|
||||
|
||||
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
|
||||
{
|
||||
EXPECT_EQ(IntSize(20, 20), impl->layoutViewportSize());
|
||||
EXPECT_EQ(gfx::Size(20, 20), impl->layoutViewportSize());
|
||||
EXPECT_EQ(SK_ColorGRAY, impl->backgroundColor());
|
||||
EXPECT_EQ(5, impl->pageScaleFactor());
|
||||
|
||||
@ -1159,8 +1161,8 @@ private:
|
||||
: ContentLayer(client)
|
||||
, m_paintContentsCount(0)
|
||||
{
|
||||
setAnchorPoint(FloatPoint(0, 0));
|
||||
setBounds(IntSize(10, 10));
|
||||
setAnchorPoint(gfx::PointF(0, 0));
|
||||
setBounds(gfx::Size(10, 10));
|
||||
setIsDrawable(true);
|
||||
}
|
||||
virtual ~ContentLayerWithUpdateTracking()
|
||||
@ -1224,7 +1226,7 @@ class NoScaleContentLayer : public ContentLayer {
|
||||
public:
|
||||
static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client) { return make_scoped_refptr(new NoScaleContentLayer(client)); }
|
||||
|
||||
virtual IntSize contentBounds() const OVERRIDE { return bounds(); }
|
||||
virtual gfx::Size contentBounds() const OVERRIDE { return bounds(); }
|
||||
virtual float contentsScaleX() const OVERRIDE { return 1.0; }
|
||||
virtual float contentsScaleY() const OVERRIDE { return 1.0; }
|
||||
|
||||
@ -1244,7 +1246,7 @@ public:
|
||||
|
||||
virtual void beginTest() OVERRIDE
|
||||
{
|
||||
m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
m_layerTreeHost->rootLayer()->addChild(m_updateCheckLayer);
|
||||
m_updateCheckLayer->setOpacity(0);
|
||||
m_updateCheckLayer->setDrawOpacity(0);
|
||||
@ -1287,20 +1289,20 @@ public:
|
||||
|
||||
virtual void beginTest() OVERRIDE
|
||||
{
|
||||
m_layerTreeHost->setViewportSize(IntSize(40, 40), IntSize(60, 60));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(40, 40), gfx::Size(60, 60));
|
||||
m_layerTreeHost->setDeviceScaleFactor(1.5);
|
||||
EXPECT_EQ(IntSize(40, 40), m_layerTreeHost->layoutViewportSize());
|
||||
EXPECT_EQ(IntSize(60, 60), m_layerTreeHost->deviceViewportSize());
|
||||
EXPECT_EQ(gfx::Size(40, 40), m_layerTreeHost->layoutViewportSize());
|
||||
EXPECT_EQ(gfx::Size(60, 60), m_layerTreeHost->deviceViewportSize());
|
||||
|
||||
m_rootLayer->addChild(m_childLayer);
|
||||
|
||||
m_rootLayer->setIsDrawable(true);
|
||||
m_rootLayer->setBounds(IntSize(30, 30));
|
||||
m_rootLayer->setBounds(gfx::Size(30, 30));
|
||||
m_rootLayer->setAnchorPoint(FloatPoint(0, 0));
|
||||
|
||||
m_childLayer->setIsDrawable(true);
|
||||
m_childLayer->setPosition(IntPoint(2, 2));
|
||||
m_childLayer->setBounds(IntSize(10, 10));
|
||||
m_childLayer->setPosition(gfx::Point(2, 2));
|
||||
m_childLayer->setBounds(gfx::Size(10, 10));
|
||||
m_childLayer->setAnchorPoint(FloatPoint(0, 0));
|
||||
|
||||
m_layerTreeHost->setRootLayer(m_rootLayer);
|
||||
@ -1320,15 +1322,15 @@ public:
|
||||
ASSERT_EQ(1u, impl->rootLayer()->children().size());
|
||||
|
||||
// Device viewport is scaled.
|
||||
EXPECT_EQ(IntSize(40, 40), impl->layoutViewportSize());
|
||||
EXPECT_EQ(IntSize(60, 60), impl->deviceViewportSize());
|
||||
EXPECT_EQ(gfx::Size(40, 40), impl->layoutViewportSize());
|
||||
EXPECT_EQ(gfx::Size(60, 60), impl->deviceViewportSize());
|
||||
|
||||
LayerImpl* root = impl->rootLayer();
|
||||
LayerImpl* child = impl->rootLayer()->children()[0];
|
||||
|
||||
// Positions remain in layout pixels.
|
||||
EXPECT_EQ(IntPoint(0, 0), root->position());
|
||||
EXPECT_EQ(IntPoint(2, 2), child->position());
|
||||
EXPECT_EQ(gfx::Point(0, 0), root->position());
|
||||
EXPECT_EQ(gfx::Point(2, 2), child->position());
|
||||
|
||||
// Compute all the layer transforms for the frame.
|
||||
MockLayerTreeHostImpl::LayerList renderSurfaceLayerList;
|
||||
@ -1340,11 +1342,11 @@ public:
|
||||
ASSERT_EQ(2u, root->renderSurface()->layerList().size());
|
||||
|
||||
// The root render surface is the size of the viewport.
|
||||
EXPECT_RECT_EQ(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), root->renderSurface()->contentRect());
|
||||
|
||||
// The content bounds of the child should be scaled.
|
||||
IntSize childBoundsScaled = child->bounds();
|
||||
childBoundsScaled.scale(1.5);
|
||||
gfx::Size childBoundsScaled = child->bounds();
|
||||
childBoundsScaled = gfx::ToRoundedSize(childBoundsScaled.Scale(1.5));
|
||||
EXPECT_EQ(childBoundsScaled, child->contentBounds());
|
||||
|
||||
WebTransformationMatrix scaleTransform;
|
||||
@ -1399,7 +1401,7 @@ public:
|
||||
virtual void beginTest() OVERRIDE
|
||||
{
|
||||
m_layerTreeHost->setRootLayer(m_layer);
|
||||
m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
|
||||
postSetNeedsCommitToMainThread();
|
||||
postSetNeedsRedrawToMainThread();
|
||||
@ -1473,7 +1475,7 @@ TEST_F(LayerTreeHostTestAtomicCommit, runMultiThread)
|
||||
runTest(true);
|
||||
}
|
||||
|
||||
static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
|
||||
static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebTransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
|
||||
{
|
||||
layer->removeAllChildren();
|
||||
if (parent)
|
||||
@ -1499,11 +1501,11 @@ public:
|
||||
virtual void beginTest() OVERRIDE
|
||||
{
|
||||
m_layerTreeHost->setRootLayer(m_parent);
|
||||
m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20));
|
||||
|
||||
WebTransformationMatrix identityMatrix;
|
||||
setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true);
|
||||
setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 10), IntSize(10, 10), false);
|
||||
setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true);
|
||||
setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 10), gfx::Size(10, 10), false);
|
||||
|
||||
postSetNeedsCommitToMainThread();
|
||||
postSetNeedsRedrawToMainThread();
|
||||
@ -1590,15 +1592,15 @@ public:
|
||||
break;
|
||||
case 2:
|
||||
// Damage part of layers.
|
||||
m_parent->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
|
||||
m_child->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
|
||||
m_parent->setNeedsDisplayRect(gfx::RectF(0, 0, 5, 5));
|
||||
m_child->setNeedsDisplayRect(gfx::RectF(0, 0, 5, 5));
|
||||
break;
|
||||
case 3:
|
||||
m_child->setNeedsDisplay();
|
||||
m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
|
||||
break;
|
||||
case 4:
|
||||
m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20));
|
||||
m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20));
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
@ -1645,7 +1647,7 @@ private:
|
||||
Region m_occludedScreenSpace;
|
||||
};
|
||||
|
||||
static void setTestLayerPropertiesForTesting(TestLayer* layer, Layer* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
|
||||
static void setTestLayerPropertiesForTesting(TestLayer* layer, Layer* parent, const WebTransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
|
||||
{
|
||||
setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque);
|
||||
layer->clearOccludedScreenSpace();
|
||||
@ -1675,9 +1677,9 @@ public:
|
||||
// positioned on the screen.
|
||||
|
||||
// The child layer is rotated and the grandChild is opaque, but clipped to the child and rootLayer
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), false);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
|
||||
m_layerTreeHost->setRootLayer(rootLayer);
|
||||
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
|
||||
@ -1686,75 +1688,75 @@ public:
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// If the child layer is opaque, then it adds to the occlusion seen by the rootLayer.
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
|
||||
m_layerTreeHost->setRootLayer(rootLayer);
|
||||
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// Add a second child to the root layer and the regions should merge
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(70, 20), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
|
||||
m_layerTreeHost->setRootLayer(rootLayer);
|
||||
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// Move the second child to be sure.
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
|
||||
m_layerTreeHost->setRootLayer(rootLayer);
|
||||
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
|
||||
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
|
||||
child->setMaskLayer(mask.get());
|
||||
|
||||
@ -1763,20 +1765,20 @@ public:
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// If the child layer with a mask is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
|
||||
|
||||
child->setMaskLayer(mask.get());
|
||||
|
||||
@ -1785,20 +1787,20 @@ public:
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
|
||||
child->setMaskLayer(0);
|
||||
child->setOpacity(0.5);
|
||||
@ -1808,20 +1810,20 @@ public:
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
|
||||
|
||||
child->setMaskLayer(0);
|
||||
child->setOpacity(0.5);
|
||||
@ -1831,13 +1833,13 @@ public:
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// Kill the layerTreeHost immediately.
|
||||
@ -1876,10 +1878,10 @@ public:
|
||||
|
||||
// If the child layer has a filter that changes alpha values, and is below child2, then child2 should contribute to occlusion on everything,
|
||||
// and child shouldn't contribute to the rootLayer
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
|
||||
|
||||
{
|
||||
WebFilterOperations filters;
|
||||
@ -1894,21 +1896,21 @@ public:
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtree,
|
||||
// and should not contribute to the rootLayer
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
|
||||
setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
|
||||
|
||||
{
|
||||
WebFilterOperations filters;
|
||||
@ -1921,13 +1923,13 @@ public:
|
||||
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(cc::IntRect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(cc::IntRect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(cc::IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(cc::IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
|
||||
// Kill the layerTreeHost immediately.
|
||||
@ -1962,10 +1964,10 @@ public:
|
||||
for (int i = 0; i < numSurfaces; ++i) {
|
||||
layers.push_back(TestLayer::create());
|
||||
if (!i) {
|
||||
setTestLayerPropertiesForTesting(layers.back().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
setTestLayerPropertiesForTesting(layers.back().get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
layers.back()->createRenderSurface();
|
||||
} else {
|
||||
setTestLayerPropertiesForTesting(layers.back().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true);
|
||||
setTestLayerPropertiesForTesting(layers.back().get(), layers[layers.size()-2].get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(1, 1), gfx::Size(200-i, 200-i), true);
|
||||
layers.back()->setMasksToBounds(true);
|
||||
layers.back()->setReplicaLayer(replica.get()); // Make it have a RenderSurfaceImpl
|
||||
}
|
||||
@ -1973,7 +1975,7 @@ public:
|
||||
|
||||
for (int i = 1; i < numSurfaces; ++i) {
|
||||
children.push_back(TestLayer::create());
|
||||
setTestLayerPropertiesForTesting(children.back().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
|
||||
setTestLayerPropertiesForTesting(children.back().get(), layers[i].get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
|
||||
}
|
||||
|
||||
m_layerTreeHost->setRootLayer(layers[0].get());
|
||||
@ -1984,7 +1986,7 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
for (int i = 0; i < numSurfaces-1; ++i) {
|
||||
IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
|
||||
cc::IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
|
||||
|
||||
EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size());
|
||||
@ -3074,9 +3076,9 @@ public:
|
||||
m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10));
|
||||
|
||||
m_contentLayer = ContentLayer::create(&m_mockDelegate);
|
||||
m_contentLayer->setBounds(IntSize(10, 10));
|
||||
m_contentLayer->setPosition(FloatPoint(0, 0));
|
||||
m_contentLayer->setAnchorPoint(FloatPoint(0, 0));
|
||||
m_contentLayer->setBounds(gfx::Size(10, 10));
|
||||
m_contentLayer->setPosition(gfx::PointF(0, 0));
|
||||
m_contentLayer->setAnchorPoint(gfx::PointF(0, 0));
|
||||
m_contentLayer->setIsDrawable(true);
|
||||
m_layerTreeHost->rootLayer()->addChild(m_contentLayer);
|
||||
|
||||
@ -3134,19 +3136,19 @@ public:
|
||||
m.translate(250, 360);
|
||||
m.scale(2);
|
||||
|
||||
IntPoint point(400, 550);
|
||||
IntPoint transformedPoint;
|
||||
gfx::Point point(400, 550);
|
||||
gfx::Point transformedPoint;
|
||||
|
||||
// Unit transform, no change expected.
|
||||
m_layerTreeHost->setImplTransform(WebTransformationMatrix());
|
||||
transformedPoint = roundedIntPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
|
||||
transformedPoint = gfx::ToRoundedPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
|
||||
EXPECT_EQ(point.x(), transformedPoint.x());
|
||||
EXPECT_EQ(point.y(), transformedPoint.y());
|
||||
|
||||
m_layerTreeHost->setImplTransform(m);
|
||||
|
||||
// Apply m^(-1): 138 = 400/2 - 250/4; 185 = 550/2 - 360/4.
|
||||
transformedPoint = roundedIntPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
|
||||
transformedPoint = gfx::ToRoundedPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
|
||||
EXPECT_EQ(138, transformedPoint.x());
|
||||
EXPECT_EQ(185, transformedPoint.y());
|
||||
endTest();
|
||||
|
@ -419,12 +419,12 @@ TEST_F(LayerTest, checkSetNeedsDisplayCausesCorrectBehavior)
|
||||
testLayer->setLayerTreeHost(m_layerTreeHost.get());
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setIsDrawable(true));
|
||||
|
||||
IntSize testBounds = IntSize(501, 508);
|
||||
gfx::Size testBounds = gfx::Size(501, 508);
|
||||
|
||||
FloatRect dirty1 = FloatRect(10, 15, 1, 2);
|
||||
FloatRect dirty2 = FloatRect(20, 25, 3, 4);
|
||||
FloatRect emptyDirtyRect = FloatRect(40, 45, 0, 0);
|
||||
FloatRect outOfBoundsDirtyRect = FloatRect(400, 405, 500, 502);
|
||||
gfx::RectF dirty1 = gfx::RectF(10, 15, 1, 2);
|
||||
gfx::RectF dirty2 = gfx::RectF(20, 25, 3, 4);
|
||||
gfx::RectF emptyDirtyRect = gfx::RectF(40, 45, 0, 0);
|
||||
gfx::RectF outOfBoundsDirtyRect = gfx::RectF(400, 405, 500, 502);
|
||||
|
||||
// Before anything, testLayer should not be dirty.
|
||||
EXPECT_FALSE(testLayer->needsDisplay());
|
||||
@ -486,25 +486,25 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior)
|
||||
EXPECT_FALSE(testLayer->needsDisplay());
|
||||
|
||||
// Test properties that should not call needsDisplay and needsCommit when changed.
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(IntRect(0, 0, 40, 50)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(gfx::Rect(0, 0, 40, 50)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUseLCDText(true));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setRenderTarget(0));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix()));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(WebTransformationMatrix()));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(IntRect(4, 5, 6, 7)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(gfx::Rect(4, 5, 6, 7)));
|
||||
EXPECT_FALSE(testLayer->needsDisplay());
|
||||
|
||||
// Next, test properties that should call setNeedsCommit (but not setNeedsDisplay)
|
||||
// All properties need to be set to new values in order for setNeedsCommit to be called.
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(FloatPoint(1.23f, 4.56f)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(gfx::PointF(1.23f, 4.56f)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPointZ(0.7f));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(SK_ColorLTGRAY));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMasksToBounds(true));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMaskLayer(dummyLayer.get()));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpacity(0.5));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setContentsOpaque(true));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4, 9)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(gfx::PointF(4, 9)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get()));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true));
|
||||
@ -522,7 +522,7 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior)
|
||||
EXPECT_FALSE(testLayer->needsDisplay());
|
||||
|
||||
// Test properties that should call setNeedsDisplay and setNeedsCommit
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(IntSize(5, 10)));
|
||||
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(gfx::Size(5, 10)));
|
||||
EXPECT_TRUE(testLayer->needsDisplay());
|
||||
}
|
||||
|
||||
@ -533,20 +533,20 @@ TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect)
|
||||
scoped_refptr<Layer> testLayer = Layer::create();
|
||||
scoped_ptr<LayerImpl> implLayer = LayerImpl::create(1);
|
||||
|
||||
testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5)));
|
||||
testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)));
|
||||
testLayer->pushPropertiesTo(implLayer.get());
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(5, 5)), implLayer->updateRect());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)), implLayer->updateRect());
|
||||
|
||||
// The LayerImpl's updateRect should be accumulated here, since we did not do anything to clear it.
|
||||
testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)));
|
||||
testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)));
|
||||
testLayer->pushPropertiesTo(implLayer.get());
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(15, 15)), implLayer->updateRect());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(15, 15)), implLayer->updateRect());
|
||||
|
||||
// If we do clear the LayerImpl side, then the next updateRect should be fresh without accumulation.
|
||||
implLayer->resetAllChangeTrackingForSubtree();
|
||||
testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)));
|
||||
testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)));
|
||||
testLayer->pushPropertiesTo(implLayer.get());
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)), implLayer->updateRect());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)), implLayer->updateRect());
|
||||
}
|
||||
|
||||
class FakeLayerImplTreeHost : public LayerTreeHost {
|
||||
@ -792,9 +792,9 @@ TEST(LayerTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmpt
|
||||
{
|
||||
scoped_refptr<MockLayer> layer(new MockLayer);
|
||||
EXPECT_FALSE(layer->needsDisplay());
|
||||
layer->setBounds(IntSize(0, 10));
|
||||
layer->setBounds(gfx::Size(0, 10));
|
||||
EXPECT_FALSE(layer->needsDisplay());
|
||||
layer->setBounds(IntSize(10, 10));
|
||||
layer->setBounds(gfx::Size(10, 10));
|
||||
EXPECT_TRUE(layer->needsDisplay());
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,11 @@
|
||||
|
||||
#include "cc/math_util.h"
|
||||
|
||||
#include "FloatPoint.h"
|
||||
#include "FloatQuad.h"
|
||||
#include "IntRect.h"
|
||||
#include "FloatSize.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <cmath>
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
|
||||
@ -16,7 +18,7 @@ using WebKit::WebTransformationMatrix;
|
||||
|
||||
namespace cc {
|
||||
|
||||
static HomogeneousCoordinate projectHomogeneousPoint(const WebTransformationMatrix& transform, const FloatPoint& p)
|
||||
static HomogeneousCoordinate projectHomogeneousPoint(const WebTransformationMatrix& transform, const gfx::PointF& p)
|
||||
{
|
||||
// In this case, the layer we are trying to project onto is perpendicular to ray
|
||||
// (point p and z-axis direction) that we are trying to project. This happens when the
|
||||
@ -82,7 +84,7 @@ static HomogeneousCoordinate computeClippedPointForEdge(const HomogeneousCoordin
|
||||
return HomogeneousCoordinate(x, y, z, w);
|
||||
}
|
||||
|
||||
static inline void expandBoundsToIncludePoint(float& xmin, float& xmax, float& ymin, float& ymax, const FloatPoint& p)
|
||||
static inline void expandBoundsToIncludePoint(float& xmin, float& xmax, float& ymin, float& ymax, const gfx::PointF& p)
|
||||
{
|
||||
xmin = std::min(p.x(), xmin);
|
||||
xmax = std::max(p.x(), xmax);
|
||||
@ -90,27 +92,27 @@ static inline void expandBoundsToIncludePoint(float& xmin, float& xmax, float& y
|
||||
ymax = std::max(p.y(), ymax);
|
||||
}
|
||||
|
||||
static inline void addVertexToClippedQuad(const FloatPoint& newVertex, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad)
|
||||
static inline void addVertexToClippedQuad(const gfx::PointF& newVertex, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad)
|
||||
{
|
||||
clippedQuad[numVerticesInClippedQuad] = newVertex;
|
||||
numVerticesInClippedQuad++;
|
||||
}
|
||||
|
||||
IntRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const IntRect& srcRect)
|
||||
gfx::Rect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const gfx::Rect& srcRect)
|
||||
{
|
||||
return enclosingIntRect(mapClippedRect(transform, FloatRect(srcRect)));
|
||||
return gfx::ToEnclosingRect(mapClippedRect(transform, gfx::RectF(srcRect)));
|
||||
}
|
||||
|
||||
FloatRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect)
|
||||
gfx::RectF MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const gfx::RectF& srcRect)
|
||||
{
|
||||
if (transform.isIdentityOrTranslation()) {
|
||||
FloatRect mappedRect(srcRect);
|
||||
mappedRect.move(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
|
||||
gfx::RectF mappedRect(srcRect);
|
||||
mappedRect.Offset(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
|
||||
return mappedRect;
|
||||
}
|
||||
|
||||
// Apply the transform, but retain the result in homogeneous coordinates.
|
||||
FloatQuad q = FloatQuad(FloatRect(srcRect));
|
||||
FloatQuad q = FloatQuad(gfx::RectF(srcRect));
|
||||
HomogeneousCoordinate h1 = mapHomogeneousPoint(transform, q.p1());
|
||||
HomogeneousCoordinate h2 = mapHomogeneousPoint(transform, q.p2());
|
||||
HomogeneousCoordinate h3 = mapHomogeneousPoint(transform, q.p3());
|
||||
@ -119,10 +121,10 @@ FloatRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, con
|
||||
return computeEnclosingClippedRect(h1, h2, h3, h4);
|
||||
}
|
||||
|
||||
FloatRect MathUtil::projectClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect)
|
||||
gfx::RectF MathUtil::projectClippedRect(const WebTransformationMatrix& transform, const gfx::RectF& srcRect)
|
||||
{
|
||||
// Perform the projection, but retain the result in homogeneous coordinates.
|
||||
FloatQuad q = FloatQuad(FloatRect(srcRect));
|
||||
FloatQuad q = FloatQuad(gfx::RectF(srcRect));
|
||||
HomogeneousCoordinate h1 = projectHomogeneousPoint(transform, q.p1());
|
||||
HomogeneousCoordinate h2 = projectHomogeneousPoint(transform, q.p2());
|
||||
HomogeneousCoordinate h3 = projectHomogeneousPoint(transform, q.p3());
|
||||
@ -131,7 +133,7 @@ FloatRect MathUtil::projectClippedRect(const WebTransformationMatrix& transform,
|
||||
return computeEnclosingClippedRect(h1, h2, h3, h4);
|
||||
}
|
||||
|
||||
void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad)
|
||||
void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad)
|
||||
{
|
||||
HomogeneousCoordinate h1 = mapHomogeneousPoint(transform, srcQuad.p1());
|
||||
HomogeneousCoordinate h2 = mapHomogeneousPoint(transform, srcQuad.p2());
|
||||
@ -169,10 +171,10 @@ void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const Fl
|
||||
DCHECK(numVerticesInClippedQuad <= 8);
|
||||
}
|
||||
|
||||
FloatRect MathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices)
|
||||
gfx::RectF MathUtil::computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices)
|
||||
{
|
||||
if (numVertices < 2)
|
||||
return FloatRect();
|
||||
return gfx::RectF();
|
||||
|
||||
float xmin = std::numeric_limits<float>::max();
|
||||
float xmax = -std::numeric_limits<float>::max();
|
||||
@ -182,13 +184,13 @@ FloatRect MathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int nu
|
||||
for (int i = 0; i < numVertices; ++i)
|
||||
expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, vertices[i]);
|
||||
|
||||
return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin));
|
||||
return gfx::RectF(gfx::PointF(xmin, ymin), gfx::SizeF(xmax - xmin, ymax - ymin));
|
||||
}
|
||||
|
||||
FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4)
|
||||
gfx::RectF MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4)
|
||||
{
|
||||
// This function performs clipping as necessary and computes the enclosing 2d
|
||||
// FloatRect of the vertices. Doing these two steps simultaneously allows us to avoid
|
||||
// gfx::RectF of the vertices. Doing these two steps simultaneously allows us to avoid
|
||||
// the overhead of storing an unknown number of clipped vertices.
|
||||
|
||||
// If no vertices on the quad are clipped, then we can simply return the enclosing rect directly.
|
||||
@ -200,7 +202,7 @@ FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1,
|
||||
|
||||
bool everythingClipped = h1.shouldBeClipped() && h2.shouldBeClipped() && h3.shouldBeClipped() && h4.shouldBeClipped();
|
||||
if (everythingClipped)
|
||||
return FloatRect();
|
||||
return gfx::RectF();
|
||||
|
||||
|
||||
float xmin = std::numeric_limits<float>::max();
|
||||
@ -232,7 +234,7 @@ FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1,
|
||||
if (h4.shouldBeClipped() ^ h1.shouldBeClipped())
|
||||
expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h4, h1).cartesianPoint2d());
|
||||
|
||||
return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin));
|
||||
return gfx::RectF(gfx::PointF(xmin, ymin), gfx::SizeF(xmax - xmin, ymax - ymin));
|
||||
}
|
||||
|
||||
FloatQuad MathUtil::mapQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped)
|
||||
@ -255,9 +257,9 @@ FloatQuad MathUtil::mapQuad(const WebTransformationMatrix& transform, const Floa
|
||||
return FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d());
|
||||
}
|
||||
|
||||
FloatPoint MathUtil::mapPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped)
|
||||
gfx::PointF MathUtil::mapPoint(const WebTransformationMatrix& transform, const gfx::PointF& p, bool& clipped)
|
||||
{
|
||||
HomogeneousCoordinate h = mapHomogeneousPoint(transform, p);
|
||||
HomogeneousCoordinate h = mapHomogeneousPoint(transform, cc::FloatPoint(p));
|
||||
|
||||
if (h.w > 0) {
|
||||
clipped = false;
|
||||
@ -269,7 +271,7 @@ FloatPoint MathUtil::mapPoint(const WebTransformationMatrix& transform, const Fl
|
||||
|
||||
// Avoid dividing by w if w == 0.
|
||||
if (!h.w)
|
||||
return FloatPoint();
|
||||
return gfx::PointF();
|
||||
|
||||
// This return value will be invalid because clipped == true, but (1) users of this
|
||||
// code should be ignoring the return value when clipped == true anyway, and (2) this
|
||||
@ -317,7 +319,7 @@ FloatQuad MathUtil::projectQuad(const WebTransformationMatrix& transform, const
|
||||
return projectedQuad;
|
||||
}
|
||||
|
||||
FloatPoint MathUtil::projectPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped)
|
||||
gfx::PointF MathUtil::projectPoint(const WebTransformationMatrix& transform, const gfx::PointF& p, bool& clipped)
|
||||
{
|
||||
HomogeneousCoordinate h = projectHomogeneousPoint(transform, p);
|
||||
|
||||
@ -332,7 +334,7 @@ FloatPoint MathUtil::projectPoint(const WebTransformationMatrix& transform, cons
|
||||
|
||||
// Avoid dividing by w if w == 0.
|
||||
if (!h.w)
|
||||
return FloatPoint();
|
||||
return gfx::PointF();
|
||||
|
||||
// This return value will be invalid because clipped == true, but (1) users of this
|
||||
// code should be ignoring the return value when clipped == true anyway, and (2) this
|
||||
@ -367,13 +369,13 @@ static inline float scaleOnAxis(double a, double b, double c)
|
||||
return std::sqrt(a * a + b * b + c * c);
|
||||
}
|
||||
|
||||
FloatPoint MathUtil::computeTransform2dScaleComponents(const WebTransformationMatrix& transform)
|
||||
gfx::Vector2dF MathUtil::computeTransform2dScaleComponents(const WebTransformationMatrix& transform)
|
||||
{
|
||||
if (transform.hasPerspective())
|
||||
return FloatPoint(1, 1);
|
||||
return gfx::Vector2dF(1, 1);
|
||||
float xScale = scaleOnAxis(transform.m11(), transform.m12(), transform.m13());
|
||||
float yScale = scaleOnAxis(transform.m21(), transform.m22(), transform.m23());
|
||||
return FloatPoint(xScale, yScale);
|
||||
return gfx::Vector2dF(xScale, yScale);
|
||||
}
|
||||
|
||||
float MathUtil::smallestAngleBetweenVectors(const FloatSize& v1, const FloatSize& v2)
|
||||
|
@ -6,18 +6,22 @@
|
||||
#define CCMathUtil_h
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "FloatPoint.h"
|
||||
#include "ui/gfx/point_f.h"
|
||||
#include "FloatPoint3D.h"
|
||||
|
||||
namespace WebKit {
|
||||
class WebTransformationMatrix;
|
||||
}
|
||||
|
||||
namespace gfx {
|
||||
class Rect;
|
||||
class RectF;
|
||||
}
|
||||
|
||||
namespace cc {
|
||||
|
||||
class IntRect;
|
||||
class FloatRect;
|
||||
class FloatQuad;
|
||||
class FloatSize;
|
||||
|
||||
struct HomogeneousCoordinate {
|
||||
HomogeneousCoordinate(double newX, double newY, double newZ, double newW)
|
||||
@ -33,15 +37,15 @@ struct HomogeneousCoordinate {
|
||||
return w <= 0;
|
||||
}
|
||||
|
||||
FloatPoint cartesianPoint2d() const
|
||||
gfx::PointF cartesianPoint2d() const
|
||||
{
|
||||
if (w == 1)
|
||||
return FloatPoint(x, y);
|
||||
return gfx::PointF(x, y);
|
||||
|
||||
// For now, because this code is used privately only by MathUtil, it should never be called when w == 0, and we do not yet need to handle that case.
|
||||
DCHECK(w);
|
||||
double invW = 1.0 / w;
|
||||
return FloatPoint(x * invW, y * invW);
|
||||
return gfx::PointF(x * invW, y * invW);
|
||||
}
|
||||
|
||||
FloatPoint3D cartesianPoint3d() const
|
||||
@ -72,30 +76,30 @@ public:
|
||||
//
|
||||
// These functions return the axis-aligned rect that encloses the correctly clipped,
|
||||
// transformed polygon.
|
||||
static IntRect mapClippedRect(const WebKit::WebTransformationMatrix&, const IntRect&);
|
||||
static FloatRect mapClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
|
||||
static FloatRect projectClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
|
||||
static gfx::Rect mapClippedRect(const WebKit::WebTransformationMatrix&, const gfx::Rect&);
|
||||
static gfx::RectF mapClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&);
|
||||
static gfx::RectF projectClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&);
|
||||
|
||||
// Returns an array of vertices that represent the clipped polygon. After returning, indexes from
|
||||
// 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note that
|
||||
// numVerticesInClippedQuad may be zero, which means the entire quad was clipped, and
|
||||
// none of the vertices in the array are valid.
|
||||
static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad);
|
||||
static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad);
|
||||
|
||||
static FloatRect computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices);
|
||||
static FloatRect computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
|
||||
static gfx::RectF computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices);
|
||||
static gfx::RectF computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
|
||||
|
||||
// NOTE: These functions do not do correct clipping against w = 0 plane, but they
|
||||
// correctly detect the clipped condition via the boolean clipped.
|
||||
static FloatQuad mapQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
|
||||
static FloatPoint mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
|
||||
static gfx::PointF mapPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
|
||||
static FloatPoint3D mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint3D&, bool& clipped);
|
||||
static FloatQuad projectQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
|
||||
static FloatPoint projectPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
|
||||
static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
|
||||
|
||||
static void flattenTransformTo2d(WebKit::WebTransformationMatrix&);
|
||||
|
||||
static FloatPoint computeTransform2dScaleComponents(const WebKit::WebTransformationMatrix&);
|
||||
static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTransformationMatrix&);
|
||||
|
||||
// Returns the smallest angle between the given two vectors in degrees. Neither vector is
|
||||
// assumed to be normalized.
|
||||
|
@ -6,10 +6,11 @@
|
||||
|
||||
#include "cc/math_util.h"
|
||||
|
||||
#include "FloatRect.h"
|
||||
#include "cc/test/geometry_test_utils.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
|
||||
using namespace cc;
|
||||
@ -90,12 +91,12 @@ TEST(MathUtilTest, verifyProjectionOfPerpendicularPlane)
|
||||
transform.makeIdentity();
|
||||
transform.setM33(0);
|
||||
|
||||
FloatRect rect = FloatRect(0, 0, 1, 1);
|
||||
FloatRect projectedRect = MathUtil::projectClippedRect(transform, rect);
|
||||
gfx::RectF rect = gfx::RectF(0, 0, 1, 1);
|
||||
gfx::RectF projectedRect = MathUtil::projectClippedRect(transform, rect);
|
||||
|
||||
EXPECT_EQ(0, projectedRect.x());
|
||||
EXPECT_EQ(0, projectedRect.y());
|
||||
EXPECT_TRUE(projectedRect.isEmpty());
|
||||
EXPECT_TRUE(projectedRect.IsEmpty());
|
||||
}
|
||||
|
||||
TEST(MathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds)
|
||||
@ -109,27 +110,27 @@ TEST(MathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds)
|
||||
// However, if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to
|
||||
// numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing
|
||||
// clipped rect will be computed incorrectly.
|
||||
FloatRect result = MathUtil::computeEnclosingClippedRect(h1, h2, h3, h4);
|
||||
gfx::RectF result = MathUtil::computeEnclosingClippedRect(h1, h2, h3, h4);
|
||||
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(-100, -100), gfx::SizeF(90, 90)), result);
|
||||
}
|
||||
|
||||
TEST(MathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds)
|
||||
{
|
||||
FloatPoint vertices[3];
|
||||
gfx::PointF vertices[3];
|
||||
int numVertices = 3;
|
||||
|
||||
vertices[0] = FloatPoint(-10, -100);
|
||||
vertices[1] = FloatPoint(-100, -10);
|
||||
vertices[2] = FloatPoint(-30, -30);
|
||||
vertices[0] = gfx::PointF(-10, -100);
|
||||
vertices[1] = gfx::PointF(-100, -10);
|
||||
vertices[2] = gfx::PointF(-30, -30);
|
||||
|
||||
// The bounds of the enclosing rect should be -100 to -10 for both x and y. However,
|
||||
// if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to
|
||||
// numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing
|
||||
// clipped rect will be computed incorrectly.
|
||||
FloatRect result = MathUtil::computeEnclosingRectOfVertices(vertices, numVertices);
|
||||
gfx::RectF result = MathUtil::computeEnclosingRectOfVertices(vertices, numVertices);
|
||||
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result);
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(-100, -100), gfx::SizeF(90, 90)), result);
|
||||
}
|
||||
|
||||
TEST(MathUtilTest, smallestAngleBetweenVectors)
|
||||
|
@ -133,7 +133,7 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
|
||||
for (size_t i = 0; i < rects.size(); ++i) {
|
||||
// We've already checked for clipping in the mapQuad call above, these calls should not clip anything further.
|
||||
gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(rects[i])));
|
||||
if (!surface->clipRect().isEmpty())
|
||||
if (!surface->clipRect().IsEmpty())
|
||||
transformedRect.Intersect(surface->clipRect());
|
||||
transformedRegion.unite(cc::IntRect(transformedRect));
|
||||
}
|
||||
@ -185,7 +185,7 @@ static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const gfx:
|
||||
return;
|
||||
|
||||
gfx::Rect boundsInTarget = gfx::ToEnclosingRect(MathUtil::mapClippedRect(surfaceTransform, cc::FloatRect(surfaceRect)));
|
||||
if (!contributingLayer->renderSurface()->clipRect().isEmpty())
|
||||
if (!contributingLayer->renderSurface()->clipRect().IsEmpty())
|
||||
boundsInTarget.Intersect(contributingLayer->renderSurface()->clipRect());
|
||||
|
||||
int outsetTop, outsetRight, outsetBottom, outsetLeft;
|
||||
@ -248,7 +248,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(con
|
||||
template<typename LayerType>
|
||||
static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const gfx::Rect& clipRectInTarget, const gfx::Size& minimumTrackingSize, std::vector<gfx::Rect>* occludingScreenSpaceRects)
|
||||
{
|
||||
DCHECK(layer->visibleContentRect().contains(opaqueContents.bounds()));
|
||||
DCHECK(layer->visibleContentRect().Contains(cc::IntRect(opaqueContents.bounds())));
|
||||
|
||||
bool clipped;
|
||||
FloatQuad visibleTransformedQuad = MathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped);
|
||||
@ -308,7 +308,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
|
||||
|
||||
static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
|
||||
{
|
||||
gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, cc::FloatRect(contentRect));
|
||||
gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
|
||||
// Take the gfx::ToEnclosingRect, as we want to include partial pixels in the test.
|
||||
gfx::Rect targetRect = gfx::IntersectRects(gfx::ToEnclosingRect(transformedRect), clipRectInTarget);
|
||||
return targetRect.IsEmpty() || occlusion.contains(cc::IntRect(targetRect));
|
||||
@ -358,9 +358,9 @@ static inline gfx::Rect computeUnoccludedContentRect(const gfx::Rect& contentRec
|
||||
return contentRect;
|
||||
|
||||
// Take the ToEnclosingRect at each step, as we want to contain any unoccluded partial pixels in the resulting Rect.
|
||||
FloatRect transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, cc::FloatRect(contentRect));
|
||||
gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
|
||||
gfx::Rect shrunkRect = rectSubtractRegion(gfx::IntersectRects(gfx::ToEnclosingRect(transformedRect), clipRectInTarget), occlusion);
|
||||
gfx::Rect unoccludedRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), cc::FloatRect(shrunkRect)));
|
||||
gfx::Rect unoccludedRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), gfx::RectF(shrunkRect)));
|
||||
// The rect back in content space is a bounding box and may extend outside of the original contentRect, so clamp it to the contentRectBounds.
|
||||
return gfx::IntersectRects(unoccludedRect, contentRect);
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ public:
|
||||
virtual Region visibleContentOpaqueRegion() const OVERRIDE
|
||||
{
|
||||
if (m_overrideOpaqueContentsRect)
|
||||
return intersection(m_opaqueContentsRect, visibleContentRect());
|
||||
return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect()));
|
||||
return Layer::visibleContentOpaqueRegion();
|
||||
}
|
||||
void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
|
||||
void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect)
|
||||
{
|
||||
m_overrideOpaqueContentsRect = true;
|
||||
m_opaqueContentsRect = opaqueContentsRect;
|
||||
@ -56,7 +56,7 @@ private:
|
||||
}
|
||||
|
||||
bool m_overrideOpaqueContentsRect;
|
||||
IntRect m_opaqueContentsRect;
|
||||
gfx::Rect m_opaqueContentsRect;
|
||||
};
|
||||
|
||||
class TestContentLayerImpl : public LayerImpl {
|
||||
@ -71,10 +71,10 @@ public:
|
||||
virtual Region visibleContentOpaqueRegion() const OVERRIDE
|
||||
{
|
||||
if (m_overrideOpaqueContentsRect)
|
||||
return intersection(m_opaqueContentsRect, visibleContentRect());
|
||||
return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect()));
|
||||
return LayerImpl::visibleContentOpaqueRegion();
|
||||
}
|
||||
void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
|
||||
void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect)
|
||||
{
|
||||
m_overrideOpaqueContentsRect = true;
|
||||
m_opaqueContentsRect = opaqueContentsRect;
|
||||
@ -82,7 +82,7 @@ public:
|
||||
|
||||
private:
|
||||
bool m_overrideOpaqueContentsRect;
|
||||
IntRect m_opaqueContentsRect;
|
||||
gfx::Rect m_opaqueContentsRect;
|
||||
};
|
||||
|
||||
static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return layer->drawTransformIsAnimating(); }
|
||||
@ -200,7 +200,7 @@ protected:
|
||||
LayerTreeHost::setNeedsFilterContext(false);
|
||||
}
|
||||
|
||||
typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
|
||||
typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
|
||||
{
|
||||
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
|
||||
typename Types::ContentLayerType* layerPtr = layer.get();
|
||||
@ -211,7 +211,7 @@ protected:
|
||||
return layerPtr;
|
||||
}
|
||||
|
||||
typename Types::LayerType* createLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
|
||||
typename Types::LayerType* createLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
|
||||
{
|
||||
typename Types::LayerPtrType layer(Types::createLayer());
|
||||
typename Types::LayerType* layerPtr = layer.get();
|
||||
@ -220,7 +220,7 @@ protected:
|
||||
return layerPtr;
|
||||
}
|
||||
|
||||
typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
|
||||
typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
|
||||
{
|
||||
typename Types::LayerType* layer = createLayer(parent, transform, position, bounds);
|
||||
WebFilterOperations filters;
|
||||
@ -229,7 +229,7 @@ protected:
|
||||
return layer;
|
||||
}
|
||||
|
||||
typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque)
|
||||
typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds, bool opaque)
|
||||
{
|
||||
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
|
||||
typename Types::ContentLayerType* layerPtr = layer.get();
|
||||
@ -240,16 +240,16 @@ protected:
|
||||
else {
|
||||
layerPtr->setContentsOpaque(false);
|
||||
if (opaque)
|
||||
layerPtr->setOpaqueContentsRect(IntRect(IntPoint(), bounds));
|
||||
layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds));
|
||||
else
|
||||
layerPtr->setOpaqueContentsRect(IntRect());
|
||||
layerPtr->setOpaqueContentsRect(gfx::Rect());
|
||||
}
|
||||
|
||||
parent->addChild(Types::passLayerPtr(layer));
|
||||
return layerPtr;
|
||||
}
|
||||
|
||||
typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
|
||||
typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
|
||||
{
|
||||
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
|
||||
typename Types::ContentLayerType* layerPtr = layer.get();
|
||||
@ -258,7 +258,7 @@ protected:
|
||||
return layerPtr;
|
||||
}
|
||||
|
||||
typename Types::LayerType* createMaskLayer(typename Types::LayerType* owningLayer, const IntSize& bounds)
|
||||
typename Types::LayerType* createMaskLayer(typename Types::LayerType* owningLayer, const gfx::Size& bounds)
|
||||
{
|
||||
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
|
||||
typename Types::ContentLayerType* layerPtr = layer.get();
|
||||
@ -267,7 +267,7 @@ protected:
|
||||
return layerPtr;
|
||||
}
|
||||
|
||||
typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque)
|
||||
typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds, bool opaque)
|
||||
{
|
||||
typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque);
|
||||
WebFilterOperations filters;
|
||||
@ -355,7 +355,7 @@ protected:
|
||||
const WebTransformationMatrix identityMatrix;
|
||||
|
||||
private:
|
||||
void setBaseProperties(typename Types::LayerType* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
|
||||
void setBaseProperties(typename Types::LayerType* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
|
||||
{
|
||||
layer->setTransform(transform);
|
||||
layer->setSublayerTransform(WebTransformationMatrix());
|
||||
@ -364,12 +364,12 @@ private:
|
||||
layer->setBounds(bounds);
|
||||
}
|
||||
|
||||
void setProperties(Layer* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
|
||||
void setProperties(Layer* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
|
||||
{
|
||||
setBaseProperties(layer, transform, position, bounds);
|
||||
}
|
||||
|
||||
void setProperties(LayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
|
||||
void setProperties(LayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
|
||||
{
|
||||
setBaseProperties(layer, transform, position, bounds);
|
||||
|
||||
@ -461,8 +461,8 @@ protected:
|
||||
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), gfx::Size(500, 500), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -557,8 +557,8 @@ protected:
|
||||
layerTransform.rotate(90);
|
||||
layerTransform.translate(-250, -250);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -609,8 +609,8 @@ protected:
|
||||
WebTransformationMatrix layerTransform;
|
||||
layerTransform.translate(20, 20);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -675,11 +675,11 @@ protected:
|
||||
childTransform.rotate(90);
|
||||
childTransform.translate(-250, -250);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
|
||||
child->setMasksToBounds(true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -795,14 +795,14 @@ protected:
|
||||
childTransform.rotate(90);
|
||||
childTransform.translate(-250, -250);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
|
||||
child->setMasksToBounds(true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
|
||||
// |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in
|
||||
// leaveToTargetRenderSurface, as the target surface has already been seen.
|
||||
typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true);
|
||||
typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), gfx::Size(60, 20), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -911,10 +911,10 @@ protected:
|
||||
WebTransformationMatrix layerTransform;
|
||||
layerTransform.translate(10, 10);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
|
||||
child->setMasksToBounds(true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), gfx::Size(500, 500), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -975,12 +975,12 @@ protected:
|
||||
childTransform.rotate(90);
|
||||
childTransform.translate(-250, -250);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
|
||||
typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
|
||||
child->setMasksToBounds(true);
|
||||
typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true);
|
||||
typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
|
||||
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), gfx::Size(500, 60), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1065,12 +1065,12 @@ protected:
|
||||
childTransform.rotate(90);
|
||||
childTransform.translate(-250, -250);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* child1 = this->createSurface(parent, childTransform, FloatPoint(30, 30), IntSize(10, 10));
|
||||
typename Types::LayerType* child2 = this->createSurface(parent, childTransform, FloatPoint(20, 40), IntSize(10, 10));
|
||||
typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
|
||||
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
|
||||
typename Types::LayerType* child1 = this->createSurface(parent, childTransform, FloatPoint(30, 30), gfx::Size(10, 10));
|
||||
typename Types::LayerType* child2 = this->createSurface(parent, childTransform, FloatPoint(20, 40), gfx::Size(10, 10));
|
||||
typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
|
||||
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1181,12 +1181,12 @@ protected:
|
||||
child2Transform.rotate(90);
|
||||
child2Transform.translate(-250, -250);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* child1 = this->createSurface(parent, child1Transform, FloatPoint(30, 20), IntSize(10, 10));
|
||||
typename Types::LayerType* child2 = this->createDrawingSurface(parent, child2Transform, FloatPoint(20, 40), IntSize(10, 10), false);
|
||||
typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true);
|
||||
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
|
||||
typename Types::LayerType* child1 = this->createSurface(parent, child1Transform, FloatPoint(30, 20), gfx::Size(10, 10));
|
||||
typename Types::LayerType* child2 = this->createDrawingSurface(parent, child2Transform, FloatPoint(20, 40), gfx::Size(10, 10), false);
|
||||
typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -20), gfx::Size(510, 510), true);
|
||||
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1285,11 +1285,11 @@ protected:
|
||||
layerTransform.rotate(90);
|
||||
layerTransform.translate(-250, -250);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* opacityLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
|
||||
typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
|
||||
typename Types::ContentLayerType* opacityLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
|
||||
|
||||
WebFilterOperations filters;
|
||||
filters.append(WebFilterOperation::createBlurFilter(10));
|
||||
@ -1365,9 +1365,9 @@ protected:
|
||||
OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), gfx::Size());
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1397,10 +1397,10 @@ protected:
|
||||
OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 170));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 170));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), gfx::Size());
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1430,10 +1430,10 @@ protected:
|
||||
OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
|
||||
typename Types::LayerType* replica = this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
|
||||
this->createMaskLayer(replica, IntSize(10, 10));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
|
||||
typename Types::LayerType* replica = this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), gfx::Size());
|
||||
this->createMaskLayer(replica, gfx::Size(10, 10));
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1463,8 +1463,8 @@ protected:
|
||||
OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1508,8 +1508,8 @@ protected:
|
||||
OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100));
|
||||
@ -1553,8 +1553,8 @@ protected:
|
||||
OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1593,8 +1593,8 @@ protected:
|
||||
OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100));
|
||||
@ -1633,8 +1633,8 @@ protected:
|
||||
OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1677,8 +1677,8 @@ protected:
|
||||
OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200));
|
||||
@ -1721,8 +1721,8 @@ protected:
|
||||
OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1765,8 +1765,8 @@ protected:
|
||||
OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100));
|
||||
@ -1809,8 +1809,8 @@ protected:
|
||||
OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1834,8 +1834,8 @@ protected:
|
||||
OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), false);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1871,13 +1871,13 @@ protected:
|
||||
OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), gfx::Size(200, 200), false);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
{
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100));
|
||||
layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100));
|
||||
|
||||
this->resetLayerIterator();
|
||||
this->visitLayer(layer, occlusion);
|
||||
@ -1893,7 +1893,7 @@ protected:
|
||||
|
||||
{
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180));
|
||||
layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180));
|
||||
|
||||
this->resetLayerIterator();
|
||||
this->visitLayer(layer, occlusion);
|
||||
@ -1909,7 +1909,7 @@ protected:
|
||||
|
||||
{
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100));
|
||||
layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100));
|
||||
|
||||
this->resetLayerIterator();
|
||||
this->visitLayer(layer, occlusion);
|
||||
@ -1936,9 +1936,9 @@ protected:
|
||||
WebTransformationMatrix transform;
|
||||
transform.rotate3d(0, 30, 0);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -1969,9 +1969,9 @@ protected:
|
||||
WebTransformationMatrix translationToBack;
|
||||
translationToFront.translate3d(0, 0, -100);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* child1 = this->createDrawingLayer(parent, translationToBack, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, translationToFront, FloatPoint(50, 50), IntSize(100, 100), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* child1 = this->createDrawingLayer(parent, translationToBack, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, translationToFront, FloatPoint(50, 50), gfx::Size(100, 100), true);
|
||||
parent->setPreserves3D(true);
|
||||
|
||||
this->calcDrawEtc(parent);
|
||||
@ -2002,9 +2002,9 @@ protected:
|
||||
transform.rotate3d(1, 0, 0, -30);
|
||||
transform.translate(-150, -150);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
|
||||
container->setPreserves3D(true);
|
||||
layer->setPreserves3D(true);
|
||||
this->calcDrawEtc(parent);
|
||||
@ -2034,9 +2034,9 @@ protected:
|
||||
transform.rotate3d(1, 0, 0, -167);
|
||||
transform.translate(-250, -50);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(500, 100));
|
||||
typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 500));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(0, 0), IntSize(500, 500), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 100));
|
||||
typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(0, 0), gfx::Size(500, 500), true);
|
||||
container->setPreserves3D(true);
|
||||
layer->setPreserves3D(true);
|
||||
this->calcDrawEtc(parent);
|
||||
@ -2065,8 +2065,8 @@ protected:
|
||||
transform.translate3d(0, 0, 110);
|
||||
transform.translate(-50, -50);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
parent->setPreserves3D(true);
|
||||
layer->setPreserves3D(true);
|
||||
this->calcDrawEtc(parent);
|
||||
@ -2096,9 +2096,9 @@ protected:
|
||||
transform.translate3d(0, 0, 99);
|
||||
transform.translate(-50, -50);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
parent->setPreserves3D(true);
|
||||
layer->setPreserves3D(true);
|
||||
this->calcDrawEtc(parent);
|
||||
@ -2125,13 +2125,13 @@ protected:
|
||||
OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
|
||||
typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false);
|
||||
typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
|
||||
typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
|
||||
typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
|
||||
|
||||
addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false);
|
||||
addOpacityTransitionToController(*surface->layerAnimationController(), 10, 0, 1, false);
|
||||
@ -2178,13 +2178,13 @@ protected:
|
||||
OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
|
||||
typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false);
|
||||
typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
|
||||
typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
|
||||
typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
|
||||
|
||||
addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false);
|
||||
addOpacityTransitionToController(*surface->layerAnimationController(), 10, 1, 0, false);
|
||||
@ -2231,12 +2231,12 @@ protected:
|
||||
OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
|
||||
typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
|
||||
typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
|
||||
typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(50, 300), true);
|
||||
|
||||
addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0);
|
||||
addAnimatedTransformToController(*surface->layerAnimationController(), 10, 30, 0);
|
||||
@ -2329,11 +2329,11 @@ protected:
|
||||
surfaceTransform.scale(2);
|
||||
surfaceTransform.translate(-150, -150);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(500, 500));
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false);
|
||||
typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false);
|
||||
surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
|
||||
surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, surfaceTransform, FloatPoint(0, 0), gfx::Size(300, 300), false);
|
||||
typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(300, 300), false);
|
||||
surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
|
||||
surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -2368,10 +2368,10 @@ protected:
|
||||
OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false);
|
||||
surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200));
|
||||
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 300), false);
|
||||
surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200));
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -2394,10 +2394,10 @@ protected:
|
||||
OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100));
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -2433,10 +2433,10 @@ protected:
|
||||
OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100));
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 110), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -2473,11 +2473,11 @@ protected:
|
||||
OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
|
||||
typename Types::LayerType* overSurface = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true);
|
||||
typename Types::LayerType* overReplica = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100));
|
||||
typename Types::LayerType* overSurface = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(40, 100), true);
|
||||
typename Types::LayerType* overReplica = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 100), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -2517,10 +2517,10 @@ protected:
|
||||
{
|
||||
// This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect.
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true);
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 10), gfx::Size(100, 50), true);
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000));
|
||||
@ -2576,8 +2576,8 @@ protected:
|
||||
{
|
||||
// This test verifies that the top-most surface is considered occluded outside of its target's clipRect and outside the viewport rect.
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
{
|
||||
@ -2616,11 +2616,11 @@ protected:
|
||||
{
|
||||
// This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect.
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(80, 200));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(80, 200));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
|
||||
typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false);
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
|
||||
typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
|
||||
typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), false);
|
||||
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
|
||||
this->calcDrawEtc(parent);
|
||||
|
||||
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
|
||||
@ -2672,14 +2672,14 @@ protected:
|
||||
// Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order.
|
||||
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
|
||||
// appears at 50, 50 and the replica at 200, 50.
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
|
||||
typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true);
|
||||
typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true);
|
||||
typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
|
||||
typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
|
||||
typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
|
||||
typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
|
||||
|
||||
// Filters make the layer own a surface.
|
||||
WebFilterOperations filters;
|
||||
@ -2792,12 +2792,12 @@ protected:
|
||||
scaleByHalf.scale(0.5);
|
||||
|
||||
// Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them.
|
||||
typename Types::ContentLayerType* root = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(75, 75));
|
||||
typename Types::LayerType* parent = this->createSurface(root, scaleByHalf, FloatPoint(0, 0), IntSize(150, 150));
|
||||
typename Types::ContentLayerType* root = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(75, 75));
|
||||
typename Types::LayerType* parent = this->createSurface(root, scaleByHalf, FloatPoint(0, 0), gfx::Size(150, 150));
|
||||
parent->setMasksToBounds(true);
|
||||
typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false);
|
||||
typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false);
|
||||
typename Types::LayerType* occludingLayerAbove = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true);
|
||||
typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
|
||||
typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
|
||||
typename Types::LayerType* occludingLayerAbove = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), gfx::Size(50, 50), true);
|
||||
|
||||
// Filters make the layers own surfaces.
|
||||
WebFilterOperations filters;
|
||||
@ -2846,18 +2846,18 @@ protected:
|
||||
void runMyTest()
|
||||
{
|
||||
// Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order.
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
|
||||
// We stick the filtered surface inside a clipping surface so that we can make sure the clip is honored when exposing pixels for
|
||||
// the background filter.
|
||||
typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 70));
|
||||
typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 70));
|
||||
clippingSurface->setMasksToBounds(true);
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(clippingSurface, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(150, 0), IntSize());
|
||||
typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true);
|
||||
typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true);
|
||||
typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true);
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(clippingSurface, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(150, 0), gfx::Size());
|
||||
typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
|
||||
typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
|
||||
typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
|
||||
typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
|
||||
|
||||
// Filters make the layer own a surface. This filter is large enough that it goes outside the bottom of the clippingSurface.
|
||||
WebFilterOperations filters;
|
||||
@ -2973,11 +2973,11 @@ protected:
|
||||
// Make a surface and its replica, each 50x50, with a smaller 30x30 layer centered below each.
|
||||
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
|
||||
// appears at 50, 50 and the replica at 200, 50.
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
|
||||
typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(60, 60), IntSize(30, 30), true);
|
||||
typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(210, 60), IntSize(30, 30), true);
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
|
||||
typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(60, 60), gfx::Size(30, 30), true);
|
||||
typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(210, 60), gfx::Size(30, 30), true);
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
|
||||
|
||||
// Filters make the layer own a surface.
|
||||
WebFilterOperations filters;
|
||||
@ -3023,11 +3023,11 @@ protected:
|
||||
// Make a surface and its replica, each 50x50, that are completely occluded by opaque layers which are above them in the z-order.
|
||||
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
|
||||
// appears at 50, 50 and the replica at 200, 50.
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
|
||||
typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), true);
|
||||
typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), IntSize(50, 50), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
|
||||
typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), true);
|
||||
typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(50, 50), true);
|
||||
|
||||
// Filters make the layer own a surface.
|
||||
WebFilterOperations filters;
|
||||
@ -3072,13 +3072,13 @@ protected:
|
||||
// Make a surface and its replica, each 50x50, that are partially occluded by opaque layers which are above them in the z-order.
|
||||
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
|
||||
// appears at 50, 50 and the replica at 200, 50.
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
|
||||
typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(70, 50), IntSize(30, 50), true);
|
||||
typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), IntSize(30, 50), true);
|
||||
typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(90, 40), IntSize(10, 10), true);
|
||||
typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 40), IntSize(10, 10), true);
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
|
||||
typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
|
||||
this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
|
||||
typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(70, 50), gfx::Size(30, 50), true);
|
||||
typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(30, 50), true);
|
||||
typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(90, 40), gfx::Size(10, 10), true);
|
||||
typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 40), gfx::Size(10, 10), true);
|
||||
|
||||
// Filters make the layer own a surface.
|
||||
WebFilterOperations filters;
|
||||
@ -3139,10 +3139,10 @@ protected:
|
||||
OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
|
||||
void runMyTest()
|
||||
{
|
||||
IntSize trackingSize(100, 100);
|
||||
IntSize belowTrackingSize(99, 99);
|
||||
gfx::Size trackingSize(100, 100);
|
||||
gfx::Size belowTrackingSize(99, 99);
|
||||
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(400, 400));
|
||||
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(400, 400));
|
||||
typename Types::LayerType* large = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), trackingSize, true);
|
||||
typename Types::LayerType* small = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true);
|
||||
this->calcDrawEtc(parent);
|
||||
@ -3162,9 +3162,9 @@ protected:
|
||||
// The large layer is tracked as it is large enough.
|
||||
this->visitLayer(large, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
}
|
||||
};
|
||||
|
@ -33,13 +33,13 @@ OverdrawMetrics::OverdrawMetrics(bool recordMetricsForFrame)
|
||||
{
|
||||
}
|
||||
|
||||
static inline float wedgeProduct(const FloatPoint& p1, const FloatPoint& p2)
|
||||
static inline float wedgeProduct(const gfx::PointF& p1, const gfx::PointF& p2)
|
||||
{
|
||||
return p1.x() * p2.y() - p1.y() * p2.x();
|
||||
}
|
||||
|
||||
// Calculates area of an arbitrary convex polygon with up to 8 points.
|
||||
static inline float polygonArea(const FloatPoint points[8], int numPoints)
|
||||
static inline float polygonArea(const gfx::PointF points[8], int numPoints)
|
||||
{
|
||||
if (numPoints < 3)
|
||||
return 0;
|
||||
@ -53,7 +53,7 @@ static inline float polygonArea(const FloatPoint points[8], int numPoints)
|
||||
// Takes a given quad, maps it by the given transformation, and gives the area of the resulting polygon.
|
||||
static inline float areaOfMappedQuad(const WebTransformationMatrix& transform, const FloatQuad& quad)
|
||||
{
|
||||
FloatPoint clippedQuad[8];
|
||||
gfx::PointF clippedQuad[8];
|
||||
int numVerticesInClippedQuad = 0;
|
||||
MathUtil::mapClippedQuad(transform, quad, clippedQuad, numVerticesInClippedQuad);
|
||||
return polygonArea(clippedQuad, numVerticesInClippedQuad);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "cc/priority_calculator.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -71,9 +72,9 @@ int PriorityCalculator::lingeringPriority(int previousPriority)
|
||||
}
|
||||
|
||||
namespace {
|
||||
int manhattanDistance(const IntRect& a, const IntRect& b)
|
||||
int manhattanDistance(const gfx::Rect& a, const gfx::Rect& b)
|
||||
{
|
||||
IntRect c = unionRect(a, b);
|
||||
gfx::Rect c = gfx::UnionRects(a, b);
|
||||
int x = max(0, c.width() - a.width() - b.width() + 1);
|
||||
int y = max(0, c.height() - a.height() - b.height() + 1);
|
||||
return (x + y);
|
||||
@ -81,7 +82,7 @@ int manhattanDistance(const IntRect& a, const IntRect& b)
|
||||
}
|
||||
|
||||
// static
|
||||
int PriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface)
|
||||
int PriorityCalculator::priorityFromDistance(const gfx::Rect& visibleRect, const gfx::Rect& textureRect, bool drawsToRootSurface)
|
||||
{
|
||||
int distance = manhattanDistance(visibleRect, textureRect);
|
||||
if (!distance)
|
||||
|
@ -5,8 +5,9 @@
|
||||
#ifndef CCPriorityCalculator_h
|
||||
#define CCPriorityCalculator_h
|
||||
|
||||
#include "IntRect.h"
|
||||
#include "IntSize.h"
|
||||
namespace gfx {
|
||||
class Rect;
|
||||
}
|
||||
|
||||
namespace cc {
|
||||
|
||||
@ -16,7 +17,7 @@ public:
|
||||
static int visiblePriority(bool drawsToRootSurface);
|
||||
static int renderSurfacePriority();
|
||||
static int lingeringPriority(int previousPriority);
|
||||
static int priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface);
|
||||
static int priorityFromDistance(const gfx::Rect& visibleRect, const gfx::Rect& textureRect, bool drawsToRootSurface);
|
||||
static int smallAnimatedLayerMinPriority();
|
||||
|
||||
static int highestPriority();
|
||||
|
@ -10,10 +10,13 @@
|
||||
#include "base/time.h"
|
||||
#include <public/WebCompositorOutputSurface.h>
|
||||
|
||||
namespace gfx {
|
||||
class Rect;
|
||||
}
|
||||
|
||||
namespace cc {
|
||||
|
||||
class Thread;
|
||||
class IntRect;
|
||||
class IntSize;
|
||||
struct RenderingStats;
|
||||
struct RendererCapabilities;
|
||||
@ -34,7 +37,7 @@ public:
|
||||
|
||||
virtual ~Proxy();
|
||||
|
||||
virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0;
|
||||
virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) = 0;
|
||||
|
||||
virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration) = 0;
|
||||
|
||||
|
@ -25,25 +25,25 @@ namespace {
|
||||
|
||||
class TestOcclusionTrackerImpl : public OcclusionTrackerImpl {
|
||||
public:
|
||||
TestOcclusionTrackerImpl(const IntRect& scissorRectInScreen, bool recordMetricsForFrame = true)
|
||||
TestOcclusionTrackerImpl(const gfx::Rect& scissorRectInScreen, bool recordMetricsForFrame = true)
|
||||
: OcclusionTrackerImpl(scissorRectInScreen, recordMetricsForFrame)
|
||||
, m_scissorRectInScreen(scissorRectInScreen)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual IntRect layerScissorRectInTargetSurface(const LayerImpl* layer) const { return m_scissorRectInScreen; }
|
||||
virtual gfx::Rect layerScissorRectInTargetSurface(const LayerImpl* layer) const { return m_scissorRectInScreen; }
|
||||
|
||||
private:
|
||||
IntRect m_scissorRectInScreen;
|
||||
gfx::Rect m_scissorRectInScreen;
|
||||
};
|
||||
|
||||
typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
|
||||
|
||||
static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList)
|
||||
static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, const gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList)
|
||||
{
|
||||
scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(1);
|
||||
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(100, 100), LayerTilingData::NoBorderTexels);
|
||||
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(100, 100), LayerTilingData::NoBorderTexels);
|
||||
tiler->setBounds(layerRect.size());
|
||||
layer->setTilingData(*tiler);
|
||||
layer->setSkipsDraw(false);
|
||||
@ -58,11 +58,11 @@ static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTra
|
||||
ResourceProvider::ResourceId resourceId = 1;
|
||||
for (int i = 0; i < tiler->numTilesX(); ++i)
|
||||
for (int j = 0; j < tiler->numTilesY(); ++j) {
|
||||
IntRect tileOpaqueRect = opaque ? tiler->tileBounds(i, j) : intersection(tiler->tileBounds(i, j), layerOpaqueRect);
|
||||
gfx::Rect tileOpaqueRect = opaque ? tiler->tileBounds(i, j) : gfx::IntersectRects(tiler->tileBounds(i, j), layerOpaqueRect);
|
||||
layer->pushTileProperties(i, j, resourceId++, tileOpaqueRect, false);
|
||||
}
|
||||
|
||||
IntRect rectInTarget = MathUtil::mapClippedRect(layer->drawTransform(), layer->visibleContentRect());
|
||||
gfx::Rect rectInTarget = MathUtil::mapClippedRect(layer->drawTransform(), layer->visibleContentRect());
|
||||
if (!parent) {
|
||||
layer->createRenderSurface();
|
||||
surfaceLayerList.push_back(layer.get());
|
||||
@ -70,7 +70,7 @@ static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTra
|
||||
} else {
|
||||
layer->setRenderTarget(parent->renderTarget());
|
||||
parent->renderSurface()->layerList().push_back(layer.get());
|
||||
rectInTarget.unite(MathUtil::mapClippedRect(parent->drawTransform(), parent->visibleContentRect()));
|
||||
rectInTarget.Union(MathUtil::mapClippedRect(parent->drawTransform(), parent->visibleContentRect()));
|
||||
}
|
||||
layer->setDrawableContentRect(rectInTarget);
|
||||
|
||||
@ -89,22 +89,22 @@ static void appendQuads(QuadList& quadList, SharedQuadStateList& sharedStateList
|
||||
|
||||
#define DECLARE_AND_INITIALIZE_TEST_QUADS \
|
||||
DebugScopedSetImplThread impl; \
|
||||
QuadList quadList; \
|
||||
SharedQuadStateList sharedStateList; \
|
||||
std::vector<LayerImpl*> renderSurfaceLayerList; \
|
||||
QuadList quadList; \
|
||||
SharedQuadStateList sharedStateList; \
|
||||
std::vector<LayerImpl*> renderSurfaceLayerList; \
|
||||
WebTransformationMatrix childTransform; \
|
||||
IntSize rootSize = IntSize(300, 300); \
|
||||
IntRect rootRect = IntRect(IntPoint(), rootSize); \
|
||||
IntSize childSize = IntSize(200, 200); \
|
||||
IntRect childRect = IntRect(IntPoint(), childSize);
|
||||
gfx::Size rootSize = gfx::Size(300, 300); \
|
||||
gfx::Rect rootRect = gfx::Rect(rootSize); \
|
||||
gfx::Size childSize = gfx::Size(200, 200); \
|
||||
gfx::Rect childRect = gfx::Rect(childSize);
|
||||
|
||||
TEST(QuadCullerTest, verifyNoCulling)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -119,9 +119,9 @@ TEST(QuadCullerTest, verifyCullChildLinesUpTopLeft)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -136,9 +136,9 @@ TEST(QuadCullerTest, verifyCullWhenChildOpacityNotOne)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -153,9 +153,9 @@ TEST(QuadCullerTest, verifyCullWhenChildOpaqueFlagFalse)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -172,9 +172,9 @@ TEST(QuadCullerTest, verifyCullCenterTileOnly)
|
||||
|
||||
childTransform.translate(50, 50);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -213,11 +213,11 @@ TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize1)
|
||||
rootTransform.translate(99.1, 99.1);
|
||||
rootTransform.scale(1.018);
|
||||
|
||||
rootRect = childRect = IntRect(0, 0, 100, 100);
|
||||
rootRect = childRect = gfx::Rect(0, 0, 100, 100);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -241,11 +241,11 @@ TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize2)
|
||||
WebTransformationMatrix rootTransform;
|
||||
rootTransform.translate(100, 100);
|
||||
|
||||
rootRect = childRect = IntRect(0, 0, 100, 100);
|
||||
rootRect = childRect = gfx::Rect(0, 0, 100, 100);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -263,9 +263,9 @@ TEST(QuadCullerTest, verifyCullChildLinesUpBottomRight)
|
||||
|
||||
childTransform.translate(100, 100);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -282,10 +282,10 @@ TEST(QuadCullerTest, verifyCullSubRegion)
|
||||
|
||||
childTransform.translate(50, 50);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -302,10 +302,10 @@ TEST(QuadCullerTest, verifyCullSubRegion2)
|
||||
|
||||
childTransform.translate(50, 10);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -322,10 +322,10 @@ TEST(QuadCullerTest, verifyCullSubRegionCheckOvercull)
|
||||
|
||||
childTransform.translate(50, 49);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -343,9 +343,9 @@ TEST(QuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude)
|
||||
// Use a small rotation so as to not disturb the geometry significantly.
|
||||
childTransform.rotate(1);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -369,9 +369,9 @@ TEST(QuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled)
|
||||
WebTransformationMatrix parentTransform;
|
||||
parentTransform.rotate(1);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -386,9 +386,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverTile)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(200, 100, 100, 100));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -403,9 +403,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverCulledTile)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(100, 100, 100, 100));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -420,9 +420,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverPartialTiles)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(50, 50, 200, 200));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -437,9 +437,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverNoTiles)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100));
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(500, 500, 100, 100));
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
@ -454,9 +454,9 @@ TEST(QuadCullerTest, verifyWithoutMetrics)
|
||||
{
|
||||
DECLARE_AND_INITIALIZE_TEST_QUADS
|
||||
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false);
|
||||
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
|
||||
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(50, 50, 200, 200), false);
|
||||
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
|
||||
|
||||
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
|
||||
|
@ -92,7 +92,7 @@ void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
|
||||
// Manually create the quad state for the gutter quads, as the root layer
|
||||
// doesn't have any bounds and so can't generate this itself.
|
||||
// FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas).
|
||||
IntRect rootTargetRect = rootLayer->renderSurface()->contentRect();
|
||||
gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect();
|
||||
float opacity = 1;
|
||||
bool opaque = true;
|
||||
SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque));
|
||||
@ -101,7 +101,7 @@ void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
|
||||
Vector<WebCore::IntRect> fillRects = fillRegion.rects();
|
||||
for (size_t i = 0; i < fillRects.size(); ++i) {
|
||||
// The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient.
|
||||
IntRect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc::IntRect(fillRects[i]));
|
||||
gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc::IntRect(fillRects[i]));
|
||||
// Skip the quad culler and just append the quads directly to avoid occlusion checks.
|
||||
m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>());
|
||||
}
|
||||
|
@ -28,11 +28,11 @@ RenderSurface::~RenderSurface()
|
||||
{
|
||||
}
|
||||
|
||||
FloatRect RenderSurface::drawableContentRect() const
|
||||
gfx::RectF RenderSurface::drawableContentRect() const
|
||||
{
|
||||
FloatRect drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
|
||||
gfx::RectF drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
|
||||
if (m_owningLayer->hasReplica())
|
||||
drawableContentRect.unite(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
|
||||
drawableContentRect.Union(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
|
||||
return drawableContentRect;
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "FloatRect.h"
|
||||
#include "IntRect.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
#include <vector>
|
||||
|
||||
@ -23,10 +23,10 @@ public:
|
||||
~RenderSurface();
|
||||
|
||||
// Returns the rect that encloses the RenderSurfaceImpl including any reflection.
|
||||
FloatRect drawableContentRect() const;
|
||||
gfx::RectF drawableContentRect() const;
|
||||
|
||||
const IntRect& contentRect() const { return m_contentRect; }
|
||||
void setContentRect(const IntRect& contentRect) { m_contentRect = contentRect; }
|
||||
const gfx::Rect& contentRect() const { return m_contentRect; }
|
||||
void setContentRect(const gfx::Rect& contentRect) { m_contentRect = contentRect; }
|
||||
|
||||
float drawOpacity() const { return m_drawOpacity; }
|
||||
void setDrawOpacity(float drawOpacity) { m_drawOpacity = drawOpacity; }
|
||||
@ -53,8 +53,8 @@ public:
|
||||
bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
|
||||
void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
|
||||
|
||||
const IntRect& clipRect() const { return m_clipRect; }
|
||||
void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; }
|
||||
const gfx::Rect& clipRect() const { return m_clipRect; }
|
||||
void setClipRect(const gfx::Rect& clipRect) { m_clipRect = clipRect; }
|
||||
|
||||
typedef std::vector<scoped_refptr<Layer> > LayerList;
|
||||
LayerList& layerList() { return m_layerList; }
|
||||
@ -72,7 +72,7 @@ private:
|
||||
Layer* m_owningLayer;
|
||||
|
||||
// Uses this surface's space.
|
||||
IntRect m_contentRect;
|
||||
gfx::Rect m_contentRect;
|
||||
|
||||
float m_drawOpacity;
|
||||
bool m_drawOpacityIsAnimating;
|
||||
@ -84,7 +84,7 @@ private:
|
||||
bool m_screenSpaceTransformsAreAnimating;
|
||||
|
||||
// Uses the space of the surface's target surface.
|
||||
IntRect m_clipRect;
|
||||
gfx::Rect m_clipRect;
|
||||
|
||||
LayerList m_layerList;
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "cc/render_pass_draw_quad.h"
|
||||
#include "cc/render_pass_sink.h"
|
||||
#include "cc/shared_quad_state.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
|
||||
using WebKit::WebTransformationMatrix;
|
||||
@ -51,11 +52,11 @@ RenderSurfaceImpl::~RenderSurfaceImpl()
|
||||
{
|
||||
}
|
||||
|
||||
FloatRect RenderSurfaceImpl::drawableContentRect() const
|
||||
gfx::RectF RenderSurfaceImpl::drawableContentRect() const
|
||||
{
|
||||
FloatRect drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
|
||||
gfx::RectF drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
|
||||
if (m_owningLayer->hasReplica())
|
||||
drawableContentRect.unite(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
|
||||
drawableContentRect.Union(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
|
||||
|
||||
return drawableContentRect;
|
||||
}
|
||||
@ -102,7 +103,7 @@ int RenderSurfaceImpl::owningLayerId() const
|
||||
}
|
||||
|
||||
|
||||
void RenderSurfaceImpl::setClipRect(const IntRect& clipRect)
|
||||
void RenderSurfaceImpl::setClipRect(const gfx::Rect& clipRect)
|
||||
{
|
||||
if (m_clipRect == clipRect)
|
||||
return;
|
||||
@ -113,10 +114,10 @@ void RenderSurfaceImpl::setClipRect(const IntRect& clipRect)
|
||||
|
||||
bool RenderSurfaceImpl::contentsChanged() const
|
||||
{
|
||||
return !m_damageTracker->currentDamageRect().isEmpty();
|
||||
return !m_damageTracker->currentDamageRect().IsEmpty();
|
||||
}
|
||||
|
||||
void RenderSurfaceImpl::setContentRect(const IntRect& contentRect)
|
||||
void RenderSurfaceImpl::setContentRect(const gfx::Rect& contentRect)
|
||||
{
|
||||
if (m_contentRect == contentRect)
|
||||
return;
|
||||
@ -157,23 +158,24 @@ void RenderSurfaceImpl::clearLayerLists()
|
||||
m_contributingDelegatedRenderPassLayerList.clear();
|
||||
}
|
||||
|
||||
static inline IntRect computeClippedRectInTarget(const LayerImpl* owningLayer)
|
||||
static inline gfx::Rect computeClippedRectInTarget(const LayerImpl* owningLayer)
|
||||
{
|
||||
DCHECK(owningLayer->parent());
|
||||
|
||||
const LayerImpl* renderTarget = owningLayer->parent()->renderTarget();
|
||||
const RenderSurfaceImpl* self = owningLayer->renderSurface();
|
||||
|
||||
IntRect clippedRectInTarget = self->clipRect();
|
||||
gfx::Rect clippedRectInTarget = self->clipRect();
|
||||
if (owningLayer->backgroundFilters().hasFilterThatMovesPixels()) {
|
||||
// If the layer has background filters that move pixels, we cannot scissor as tightly.
|
||||
// FIXME: this should be able to be a tighter scissor, perhaps expanded by the filter outsets?
|
||||
clippedRectInTarget = renderTarget->renderSurface()->contentRect();
|
||||
} else if (clippedRectInTarget.isEmpty()) {
|
||||
} else if (clippedRectInTarget.IsEmpty()) {
|
||||
// For surfaces, empty clipRect means that the surface does not clip anything.
|
||||
clippedRectInTarget = enclosingIntRect(intersection(renderTarget->renderSurface()->contentRect(), self->drawableContentRect()));
|
||||
clippedRectInTarget = renderTarget->renderSurface()->contentRect();
|
||||
clippedRectInTarget.Intersect(gfx::ToEnclosingRect(self->drawableContentRect()));
|
||||
} else
|
||||
clippedRectInTarget.intersect(enclosingIntRect(self->drawableContentRect()));
|
||||
clippedRectInTarget.Intersect(gfx::ToEnclosingRect(self->drawableContentRect()));
|
||||
return clippedRectInTarget;
|
||||
}
|
||||
|
||||
@ -202,7 +204,7 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
|
||||
{
|
||||
DCHECK(!forReplica || m_owningLayer->hasReplica());
|
||||
|
||||
IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
|
||||
gfx::Rect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
|
||||
bool isOpaque = false;
|
||||
const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
|
||||
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque).Pass());
|
||||
@ -222,12 +224,12 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
|
||||
// to draw the layer and its reflection in. For now we only apply a separate reflection
|
||||
// mask if the contents don't have a mask of their own.
|
||||
LayerImpl* maskLayer = m_owningLayer->maskLayer();
|
||||
if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty()))
|
||||
if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().IsEmpty()))
|
||||
maskLayer = 0;
|
||||
|
||||
if (!maskLayer && forReplica) {
|
||||
maskLayer = m_owningLayer->replicaLayer()->maskLayer();
|
||||
if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty()))
|
||||
if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().IsEmpty()))
|
||||
maskLayer = 0;
|
||||
}
|
||||
|
||||
@ -243,7 +245,7 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
|
||||
}
|
||||
|
||||
ResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0;
|
||||
IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect();
|
||||
gfx::Rect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : gfx::Rect();
|
||||
|
||||
quadSink.append(RenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame,
|
||||
maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<DrawQuad>(), appendQuadsData);
|
||||
|
@ -5,12 +5,12 @@
|
||||
#ifndef CCRenderSurface_h
|
||||
#define CCRenderSurface_h
|
||||
|
||||
#include "FloatRect.h"
|
||||
#include "IntRect.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "cc/render_pass.h"
|
||||
#include "cc/shared_quad_state.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
|
||||
namespace cc {
|
||||
@ -31,10 +31,10 @@ public:
|
||||
std::string name() const;
|
||||
void dumpSurface(std::string*, int indent) const;
|
||||
|
||||
FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).center(); }
|
||||
gfx::PointF contentRectCenter() const { return gfx::RectF(m_contentRect).CenterPoint(); }
|
||||
|
||||
// Returns the rect that encloses the RenderSurfaceImpl including any reflection.
|
||||
FloatRect drawableContentRect() const;
|
||||
gfx::RectF drawableContentRect() const;
|
||||
|
||||
float drawOpacity() const { return m_drawOpacity; }
|
||||
void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
|
||||
@ -62,13 +62,13 @@ public:
|
||||
bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
|
||||
void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
|
||||
|
||||
void setClipRect(const IntRect&);
|
||||
const IntRect& clipRect() const { return m_clipRect; }
|
||||
void setClipRect(const gfx::Rect&);
|
||||
const gfx::Rect& clipRect() const { return m_clipRect; }
|
||||
|
||||
bool contentsChanged() const;
|
||||
|
||||
void setContentRect(const IntRect&);
|
||||
const IntRect& contentRect() const { return m_contentRect; }
|
||||
void setContentRect(const gfx::Rect&);
|
||||
const gfx::Rect& contentRect() const { return m_contentRect; }
|
||||
|
||||
std::vector<LayerImpl*>& layerList() { return m_layerList; }
|
||||
void addContributingDelegatedRenderPassLayer(LayerImpl*);
|
||||
@ -91,7 +91,7 @@ private:
|
||||
LayerImpl* m_owningLayer;
|
||||
|
||||
// Uses this surface's space.
|
||||
IntRect m_contentRect;
|
||||
gfx::Rect m_contentRect;
|
||||
bool m_surfacePropertyChanged;
|
||||
|
||||
float m_drawOpacity;
|
||||
@ -104,7 +104,7 @@ private:
|
||||
bool m_screenSpaceTransformsAreAnimating;
|
||||
|
||||
// Uses the space of the surface's target surface.
|
||||
IntRect m_clipRect;
|
||||
gfx::Rect m_clipRect;
|
||||
|
||||
std::vector<LayerImpl*> m_layerList;
|
||||
std::vector<DelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;
|
||||
|
@ -17,7 +17,7 @@ class ScopedTexture;
|
||||
|
||||
class RendererClient {
|
||||
public:
|
||||
virtual const IntSize& deviceViewportSize() const = 0;
|
||||
virtual const gfx::Size& deviceViewportSize() const = 0;
|
||||
virtual const LayerTreeSettings& settings() const = 0;
|
||||
virtual void didLoseContext() = 0;
|
||||
virtual void onSwapBuffersComplete() = 0;
|
||||
@ -61,7 +61,7 @@ public:
|
||||
// puts backbuffer onscreen
|
||||
virtual bool swapBuffers() = 0;
|
||||
|
||||
virtual void getFramebufferPixels(void *pixels, const IntRect&) = 0;
|
||||
virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) = 0;
|
||||
|
||||
virtual bool isContextLost();
|
||||
|
||||
|
@ -19,10 +19,10 @@ ScopedTexture::~ScopedTexture()
|
||||
free();
|
||||
}
|
||||
|
||||
bool ScopedTexture::allocate(int pool, const IntSize& size, GLenum format, ResourceProvider::TextureUsageHint hint)
|
||||
bool ScopedTexture::allocate(int pool, const gfx::Size& size, GLenum format, ResourceProvider::TextureUsageHint hint)
|
||||
{
|
||||
DCHECK(!id());
|
||||
DCHECK(!size.isEmpty());
|
||||
DCHECK(!size.IsEmpty());
|
||||
|
||||
setDimensions(size, format);
|
||||
setId(m_resourceProvider->createResource(pool, size, format, hint));
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
using Texture::format;
|
||||
using Texture::bytes;
|
||||
|
||||
bool allocate(int pool, const IntSize&, GLenum format, ResourceProvider::TextureUsageHint);
|
||||
bool allocate(int pool, const gfx::Size&, GLenum format, ResourceProvider::TextureUsageHint);
|
||||
void free();
|
||||
void leak();
|
||||
|
||||
|
@ -65,10 +65,10 @@ void ScrollbarAnimationController::updateScrollOffset(LayerImpl* scrollLayer)
|
||||
updateScrollOffsetAtTime(scrollLayer, (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF());
|
||||
}
|
||||
|
||||
IntSize ScrollbarAnimationController::getScrollLayerBounds(const LayerImpl* scrollLayer)
|
||||
gfx::Size ScrollbarAnimationController::getScrollLayerBounds(const LayerImpl* scrollLayer)
|
||||
{
|
||||
if (!scrollLayer->children().size())
|
||||
return IntSize();
|
||||
return gfx::Size();
|
||||
// Copy & paste from LayerTreeHostImpl...
|
||||
// FIXME: Hardcoding the first child here is weird. Think of
|
||||
// a cleaner way to get the contentBounds on the Impl side.
|
||||
|
@ -9,6 +9,10 @@
|
||||
#include "FloatPoint.h"
|
||||
#include "IntSize.h"
|
||||
|
||||
namespace gfx {
|
||||
class Size;
|
||||
}
|
||||
|
||||
namespace cc {
|
||||
|
||||
class LayerImpl;
|
||||
@ -35,7 +39,7 @@ public:
|
||||
ScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScrollbarLayer; }
|
||||
|
||||
FloatPoint currentPos() const { return m_currentPos; }
|
||||
IntSize totalSize() const { return m_totalSize; }
|
||||
gfx::Size totalSize() const { return m_totalSize; }
|
||||
IntSize maximum() const { return m_maximum; }
|
||||
|
||||
virtual void didPinchGestureBeginAtTime(double monotonicTime) { }
|
||||
@ -47,14 +51,14 @@ protected:
|
||||
explicit ScrollbarAnimationController(LayerImpl* scrollLayer);
|
||||
|
||||
private:
|
||||
static IntSize getScrollLayerBounds(const LayerImpl*);
|
||||
static gfx::Size getScrollLayerBounds(const LayerImpl*);
|
||||
|
||||
// Beware of dangling pointer. Always update these during tree synchronization.
|
||||
ScrollbarLayerImpl* m_horizontalScrollbarLayer;
|
||||
ScrollbarLayerImpl* m_verticalScrollbarLayer;
|
||||
|
||||
FloatPoint m_currentPos;
|
||||
IntSize m_totalSize;
|
||||
gfx::Size m_totalSize;
|
||||
IntSize m_maximum;
|
||||
};
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "cc/layer_tree_host.h"
|
||||
#include "cc/resource_update_queue.h"
|
||||
#include "cc/scrollbar_layer_impl.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
#include <public/WebRect.h>
|
||||
|
||||
using WebKit::WebRect;
|
||||
@ -198,13 +199,13 @@ void ScrollbarLayer::createUpdaterIfNeeded()
|
||||
m_thumb = m_thumbUpdater->createResource(layerTreeHost()->contentsTextureManager());
|
||||
}
|
||||
|
||||
void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* texture, const IntRect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
|
||||
void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* texture, const gfx::Rect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
|
||||
{
|
||||
// Skip painting and uploading if there are no invalidations and
|
||||
// we already have valid texture data.
|
||||
if (texture->texture()->haveBackingTexture()
|
||||
&& texture->texture()->size() == rect.size()
|
||||
&& m_updateRect.isEmpty())
|
||||
&& m_updateRect.IsEmpty())
|
||||
return;
|
||||
|
||||
// We should always have enough memory for UI.
|
||||
@ -224,18 +225,17 @@ void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer
|
||||
texture->update(queue, rect, destOffset, false, stats);
|
||||
}
|
||||
|
||||
IntRect ScrollbarLayer::scrollbarLayerRectToContentRect(const WebRect& layerRect) const
|
||||
gfx::Rect ScrollbarLayer::scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const
|
||||
{
|
||||
// Don't intersect with the bounds as in layerRectToContentRect() because
|
||||
// layerRect here might be in coordinates of the containing layer.
|
||||
FloatRect contentRect(layerRect.x, layerRect.y, layerRect.width, layerRect.height);
|
||||
contentRect.scale(contentsScaleX(), contentsScaleY());
|
||||
return enclosingIntRect(contentRect);
|
||||
gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), contentsScaleY());
|
||||
return gfx::ToEnclosingRect(contentRect);
|
||||
}
|
||||
|
||||
void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
|
||||
{
|
||||
if (contentBounds().isEmpty())
|
||||
if (contentBounds().IsEmpty())
|
||||
return;
|
||||
|
||||
createUpdaterIfNeeded();
|
||||
@ -250,7 +250,7 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
|
||||
m_foreTrack->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
|
||||
}
|
||||
if (m_thumb) {
|
||||
IntSize thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
|
||||
gfx::Size thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
|
||||
m_thumb->texture()->setDimensions(thumbSize, m_textureFormat);
|
||||
m_thumb->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
|
||||
}
|
||||
@ -258,20 +258,20 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
|
||||
|
||||
void ScrollbarLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*, RenderingStats& stats)
|
||||
{
|
||||
if (contentBounds().isEmpty())
|
||||
if (contentBounds().IsEmpty())
|
||||
return;
|
||||
|
||||
createUpdaterIfNeeded();
|
||||
|
||||
IntRect contentRect = scrollbarLayerRectToContentRect(WebRect(m_scrollbar->location().x, m_scrollbar->location().y, bounds().width(), bounds().height()));
|
||||
gfx::Rect contentRect = scrollbarLayerRectToContentRect(gfx::Rect(m_scrollbar->location(), bounds()));
|
||||
updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, queue, stats);
|
||||
if (m_foreTrack && m_foreTrackUpdater)
|
||||
updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, queue, stats);
|
||||
|
||||
// Consider the thumb to be at the origin when painting.
|
||||
WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
|
||||
IntRect originThumbRect = scrollbarLayerRectToContentRect(WebRect(0, 0, thumbRect.width, thumbRect.height));
|
||||
if (!originThumbRect.isEmpty())
|
||||
gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0, thumbRect.width, thumbRect.height));
|
||||
if (!originThumbRect.IsEmpty())
|
||||
updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,9 @@ protected:
|
||||
virtual ~ScrollbarLayer();
|
||||
|
||||
private:
|
||||
void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*, const IntRect&, ResourceUpdateQueue&, RenderingStats&);
|
||||
void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*, const gfx::Rect&, ResourceUpdateQueue&, RenderingStats&);
|
||||
void createUpdaterIfNeeded();
|
||||
IntRect scrollbarLayerRectToContentRect(const WebKit::WebRect& layerRect) const;
|
||||
gfx::Rect scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const;
|
||||
|
||||
scoped_ptr<WebKit::WebScrollbar> m_scrollbar;
|
||||
WebKit::WebScrollbarThemePainter m_painter;
|
||||
|
@ -66,10 +66,9 @@ void ScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar)
|
||||
m_geometry->update(scrollbar);
|
||||
}
|
||||
|
||||
static FloatRect toUVRect(const WebRect& r, const IntRect& bounds)
|
||||
static gfx::RectF toUVRect(const gfx::Rect& r, const gfx::Rect& bounds)
|
||||
{
|
||||
return FloatRect(static_cast<float>(r.x) / bounds.width(), static_cast<float>(r.y) / bounds.height(),
|
||||
static_cast<float>(r.width) / bounds.width(), static_cast<float>(r.height) / bounds.height());
|
||||
return gfx::ScaleRect(r, 1.0 / bounds.width(), 1.0 / bounds.height());
|
||||
}
|
||||
|
||||
IntRect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const WebRect& layerRect) const
|
||||
@ -85,9 +84,9 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
|
||||
{
|
||||
bool premultipledAlpha = false;
|
||||
bool flipped = false;
|
||||
FloatRect uvRect(0, 0, 1, 1);
|
||||
IntRect boundsRect(IntPoint(), bounds());
|
||||
IntRect contentBoundsRect(IntPoint(), contentBounds());
|
||||
gfx::RectF uvRect(0, 0, 1, 1);
|
||||
gfx::Rect boundsRect(gfx::Point(), bounds());
|
||||
gfx::Rect contentBoundsRect(gfx::Point(), contentBounds());
|
||||
|
||||
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
|
||||
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
|
||||
@ -112,8 +111,8 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
|
||||
|
||||
// Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and
|
||||
// fore track quads. The back track texture contains (and displays) the buttons.
|
||||
if (!contentBoundsRect.isEmpty())
|
||||
quadSink.append(TextureDrawQuad::create(sharedQuadState, IntRect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
|
||||
if (!contentBoundsRect.IsEmpty())
|
||||
quadSink.append(TextureDrawQuad::create(sharedQuadState, gfx::Rect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
|
||||
}
|
||||
|
||||
void ScrollbarLayerImpl::didLoseContext()
|
||||
|
@ -43,7 +43,7 @@ SingleThreadProxy::~SingleThreadProxy()
|
||||
DCHECK(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called.
|
||||
}
|
||||
|
||||
bool SingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
|
||||
bool SingleThreadProxy::compositeAndReadback(void *pixels, const gfx::Rect& rect)
|
||||
{
|
||||
TRACE_EVENT0("cc", "SingleThreadProxy::compositeAndReadback");
|
||||
DCHECK(Proxy::isMainThread());
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
virtual ~SingleThreadProxy();
|
||||
|
||||
// Proxy implementation
|
||||
virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
|
||||
virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE;
|
||||
virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE;
|
||||
virtual void finishAllRendering() OVERRIDE;
|
||||
virtual bool isStarted() const OVERRIDE;
|
||||
|
@ -268,7 +268,7 @@ void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua
|
||||
DCHECK(isSoftwareResource(quad->resourceId()));
|
||||
ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->resourceId());
|
||||
|
||||
SkIRect uvRect = toSkIRect(gfx::Rect(quad->textureOffset(), quad->quadRect().size()));
|
||||
SkIRect uvRect = toSkIRect(gfx::Rect(gfx::PointAtOffsetFromOrigin(quad->textureOffset()), quad->quadRect().size()));
|
||||
m_skCurrentCanvas->drawBitmapRect(*lock.skBitmap(), &uvRect, toSkRect(quadVertexRect()), &m_skCurrentPaint);
|
||||
}
|
||||
|
||||
@ -344,11 +344,11 @@ bool SoftwareRenderer::swapBuffers()
|
||||
return true;
|
||||
}
|
||||
|
||||
void SoftwareRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
|
||||
void SoftwareRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect)
|
||||
{
|
||||
SkBitmap fullBitmap = m_outputDevice->lock(false)->getSkBitmap();
|
||||
SkBitmap subsetBitmap;
|
||||
SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - rect.maxY(), rect.width(), rect.height());
|
||||
SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - rect.bottom(), rect.width(), rect.height());
|
||||
fullBitmap.extractSubset(&subsetBitmap, invertRect);
|
||||
subsetBitmap.copyPixelsTo(pixels, rect.width() * rect.height() * 4, rect.width() * 4);
|
||||
m_outputDevice->unlock();
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
|
||||
virtual bool swapBuffers() OVERRIDE;
|
||||
|
||||
virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
|
||||
virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE;
|
||||
|
||||
virtual void setVisible(bool) OVERRIDE;
|
||||
|
||||
|
@ -40,10 +40,10 @@ public:
|
||||
FakeWebCompositorOutputSurface* outputSurface() const { return m_outputSurface.get(); }
|
||||
ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
|
||||
SoftwareRenderer* renderer() const { return m_renderer.get(); }
|
||||
void setViewportSize(IntSize viewportSize) { m_viewportSize = viewportSize; }
|
||||
void setViewportSize(gfx::Size viewportSize) { m_viewportSize = viewportSize; }
|
||||
|
||||
// RendererClient implementation.
|
||||
virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
|
||||
virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
|
||||
virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settings; }
|
||||
virtual void didLoseContext() OVERRIDE { }
|
||||
virtual void onSwapBuffersComplete() OVERRIDE { }
|
||||
@ -57,17 +57,17 @@ protected:
|
||||
scoped_ptr<FakeWebCompositorOutputSurface> m_outputSurface;
|
||||
scoped_ptr<ResourceProvider> m_resourceProvider;
|
||||
scoped_ptr<SoftwareRenderer> m_renderer;
|
||||
IntSize m_viewportSize;
|
||||
gfx::Size m_viewportSize;
|
||||
LayerTreeSettings m_settings;
|
||||
};
|
||||
|
||||
TEST_F(SoftwareRendererTest, solidColorQuad)
|
||||
{
|
||||
IntSize outerSize(100, 100);
|
||||
gfx::Size outerSize(100, 100);
|
||||
int outerPixels = outerSize.width() * outerSize.height();
|
||||
IntSize innerSize(98, 98);
|
||||
IntRect outerRect(IntPoint(), outerSize);
|
||||
IntRect innerRect(IntPoint(1, 1), innerSize);
|
||||
gfx::Size innerSize(98, 98);
|
||||
gfx::Rect outerRect(gfx::Point(), outerSize);
|
||||
gfx::Rect innerRect(gfx::Point(1, 1), innerSize);
|
||||
setViewportSize(outerSize);
|
||||
|
||||
initializeRenderer();
|
||||
@ -103,12 +103,12 @@ TEST_F(SoftwareRendererTest, solidColorQuad)
|
||||
|
||||
TEST_F(SoftwareRendererTest, tileQuad)
|
||||
{
|
||||
IntSize outerSize(100, 100);
|
||||
gfx::Size outerSize(100, 100);
|
||||
int outerPixels = outerSize.width() * outerSize.height();
|
||||
IntSize innerSize(98, 98);
|
||||
gfx::Size innerSize(98, 98);
|
||||
int innerPixels = innerSize.width() * innerSize.height();
|
||||
IntRect outerRect(IntPoint(), outerSize);
|
||||
IntRect innerRect(IntPoint(1, 1), innerSize);
|
||||
gfx::Rect outerRect(gfx::Point(), outerSize);
|
||||
gfx::Rect innerRect(gfx::Point(1, 1), innerSize);
|
||||
setViewportSize(outerSize);
|
||||
initializeRenderer();
|
||||
|
||||
@ -127,13 +127,13 @@ TEST_F(SoftwareRendererTest, tileQuad)
|
||||
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());
|
||||
gfx::Rect rect = gfx::Rect(gfx::Point(), deviceViewportSize());
|
||||
|
||||
scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true);
|
||||
RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1);
|
||||
scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, IntRect(IntPoint(), deviceViewportSize()), WebTransformationMatrix());
|
||||
scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, IntPoint(), outerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
|
||||
scoped_ptr<DrawQuad> innerQuad = TileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, IntPoint(), innerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
|
||||
scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, gfx::Rect(gfx::Point(), deviceViewportSize()), WebTransformationMatrix());
|
||||
scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, gfx::Vector2d(), outerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
|
||||
scoped_ptr<DrawQuad> innerQuad = TileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, gfx::Vector2d(), innerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
|
||||
rootRenderPass->appendQuad(innerQuad.Pass());
|
||||
rootRenderPass->appendQuad(outerQuad.Pass());
|
||||
|
||||
|
@ -39,10 +39,16 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FloatPoint3D(WebCore::FloatPoint point)
|
||||
: WebCore::FloatPoint3D(point)
|
||||
{
|
||||
}
|
||||
|
||||
explicit FloatPoint3D(gfx::PointF point)
|
||||
: WebCore::FloatPoint3D(point.x(), point.y(), 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
explicit FloatSize(gfx::SizeF size)
|
||||
: WebCore::FloatSize(size.width(), size.height())
|
||||
{
|
||||
}
|
||||
|
||||
operator gfx::SizeF() const { return gfx::SizeF(width(), height()); }
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,11 @@ public:
|
||||
IntPoint(WebCore::IntPoint point)
|
||||
: WebCore::IntPoint(point.x(), point.y())
|
||||
{
|
||||
}
|
||||
|
||||
explicit IntPoint(gfx::Point point)
|
||||
: WebCore::IntPoint(point.x(), point.y())
|
||||
{
|
||||
}
|
||||
|
||||
operator gfx::Point() const { return gfx::Point(x(), y()); }
|
||||
|
@ -5,11 +5,23 @@
|
||||
#ifndef CC_STUBS_SKIAUTILS_H_
|
||||
#define CC_STUBS_SKIAUTILS_H_
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "third_party/skia/include/core/SkScalar.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
// Skia has problems when passed infinite, etc floats, filter them to 0.
|
||||
inline SkScalar FloatToSkScalar(float f)
|
||||
{
|
||||
return SkFloatToScalar(isfinite(f) ? f : 0);
|
||||
// This checks if |f| is NaN.
|
||||
if (f != f)
|
||||
return 0;
|
||||
if (f == std::numeric_limits<double>::infinity())
|
||||
return 0;
|
||||
if (f == -std::numeric_limits<double>::infinity())
|
||||
return 0;
|
||||
return SkFloatToScalar(f);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,48 +6,52 @@
|
||||
|
||||
#include "cc/test/layer_test_common.h"
|
||||
|
||||
#include "Region.h"
|
||||
#include "cc/draw_quad.h"
|
||||
#include "cc/math_util.h"
|
||||
#include "cc/render_pass.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/point_conversions.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
#include "ui/gfx/size_conversions.h"
|
||||
|
||||
namespace LayerTestCommon {
|
||||
|
||||
// Align with expected and actual output
|
||||
const char* quadString = " Quad: ";
|
||||
|
||||
bool floatRectCanBeSafelyRoundedToIntRect(const cc::FloatRect& r)
|
||||
bool canRectFBeSafelyRoundedToRect(const gfx::RectF& r)
|
||||
{
|
||||
// Ensure that range of float values is not beyond integer range.
|
||||
if (!r.isExpressibleAsIntRect())
|
||||
if (!cc::FloatRect(r).isExpressibleAsIntRect())
|
||||
return false;
|
||||
|
||||
// Ensure that the values are actually integers.
|
||||
if (floorf(r.x()) == r.x()
|
||||
&& floorf(r.y()) == r.y()
|
||||
&& floorf(r.width()) == r.width()
|
||||
&& floorf(r.height()) == r.height())
|
||||
if (gfx::ToFlooredPoint(r.origin()) == r.origin()
|
||||
&& gfx::ToFlooredSize(r.size()) == r.size())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void verifyQuadsExactlyCoverRect(const cc::QuadList& quads,
|
||||
const cc::IntRect& rect) {
|
||||
cc::Region remaining(rect);
|
||||
const gfx::Rect& rect) {
|
||||
cc::Region remaining = cc::IntRect(rect);
|
||||
|
||||
for (size_t i = 0; i < quads.size(); ++i) {
|
||||
cc::DrawQuad* quad = quads[i];
|
||||
cc::FloatRect floatQuadRect = cc::MathUtil::mapClippedRect(quad->sharedQuadState()->quadTransform, cc::FloatRect(quad->quadRect()));
|
||||
gfx::RectF quadRectF = cc::MathUtil::mapClippedRect(quad->sharedQuadState()->quadTransform, gfx::RectF(quad->quadRect()));
|
||||
|
||||
// Before testing for exact coverage in the integer world, assert that rounding
|
||||
// will not round the rect incorrectly.
|
||||
ASSERT_TRUE(floatRectCanBeSafelyRoundedToIntRect(floatQuadRect));
|
||||
ASSERT_TRUE(canRectFBeSafelyRoundedToRect(quadRectF));
|
||||
|
||||
cc::IntRect quadRect = enclosingIntRect(floatQuadRect);
|
||||
gfx::Rect quadRect = gfx::ToEnclosingRect(quadRectF);
|
||||
|
||||
EXPECT_TRUE(rect.contains(quadRect)) << quadString << i;
|
||||
EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i;
|
||||
remaining.subtract(cc::Region(quadRect));
|
||||
EXPECT_TRUE(rect.Contains(quadRect)) << quadString << i;
|
||||
EXPECT_TRUE(remaining.contains(cc::IntRect(quadRect))) << quadString << i;
|
||||
remaining.subtract(cc::IntRect(quadRect));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(remaining.isEmpty());
|
||||
|
@ -5,15 +5,19 @@
|
||||
#ifndef CCLayerTestCommon_h
|
||||
#define CCLayerTestCommon_h
|
||||
|
||||
#include "IntRect.h"
|
||||
#include "Region.h"
|
||||
#include "cc/render_pass.h"
|
||||
namespace cc {
|
||||
class QuadList;
|
||||
}
|
||||
|
||||
namespace gfx {
|
||||
class Rect;
|
||||
}
|
||||
|
||||
namespace LayerTestCommon {
|
||||
|
||||
extern const char* quadString;
|
||||
|
||||
void verifyQuadsExactlyCoverRect(const cc::QuadList&, const cc::IntRect&);
|
||||
void verifyQuadsExactlyCoverRect(const cc::QuadList&, const gfx::Rect&);
|
||||
|
||||
} // namespace LayerTestCommon
|
||||
#endif // CCLayerTestCommon_h
|
||||
|
@ -49,15 +49,15 @@ void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
|
||||
{
|
||||
m_prepareCount++;
|
||||
m_lastUpdateRect = contentRect;
|
||||
if (!m_rectToInvalidate.isEmpty()) {
|
||||
if (!m_rectToInvalidate.IsEmpty()) {
|
||||
m_layer->invalidateContentRect(m_rectToInvalidate);
|
||||
m_rectToInvalidate = IntRect();
|
||||
m_rectToInvalidate = gfx::Rect();
|
||||
m_layer = NULL;
|
||||
}
|
||||
resultingOpaqueRect = m_opaquePaintRect;
|
||||
}
|
||||
|
||||
void FakeLayerUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayer* layer)
|
||||
void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer)
|
||||
{
|
||||
m_rectToInvalidate = rect;
|
||||
m_layer = layer;
|
||||
@ -101,7 +101,7 @@ FakeTiledLayer::~FakeTiledLayer()
|
||||
{
|
||||
}
|
||||
|
||||
void FakeTiledLayer::setNeedsDisplayRect(const FloatRect& rect)
|
||||
void FakeTiledLayer::setNeedsDisplayRect(const gfx::RectF& rect)
|
||||
{
|
||||
m_lastNeedsDisplayRect = rect;
|
||||
TiledLayer::setNeedsDisplayRect(rect);
|
||||
@ -134,7 +134,7 @@ cc::LayerUpdater* FakeTiledLayer::updater() const
|
||||
return m_fakeUpdater.get();
|
||||
}
|
||||
|
||||
cc::IntSize FakeTiledLayerWithScaledBounds::contentBounds() const
|
||||
gfx::Size FakeTiledLayerWithScaledBounds::contentBounds() const
|
||||
{
|
||||
return m_forcedContentBounds;
|
||||
}
|
||||
|
@ -5,8 +5,6 @@
|
||||
#ifndef CCTiledLayerTestCommon_h
|
||||
#define CCTiledLayerTestCommon_h
|
||||
|
||||
#include "IntRect.h"
|
||||
#include "IntSize.h"
|
||||
#include "Region.h"
|
||||
#include "cc/layer_updater.h"
|
||||
#include "cc/prioritized_texture.h"
|
||||
@ -16,6 +14,8 @@
|
||||
#include "cc/texture_uploader.h"
|
||||
#include "cc/tiled_layer.h"
|
||||
#include "cc/tiled_layer_impl.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/gfx/size.h"
|
||||
|
||||
namespace WebKitTests {
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
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*);
|
||||
void setRectToInvalidate(const gfx::Rect&, FakeTiledLayer*);
|
||||
// Last rect passed to prepareToUpdate().
|
||||
const gfx::Rect& lastUpdateRect() const { return m_lastUpdateRect; }
|
||||
|
||||
@ -63,7 +63,7 @@ protected:
|
||||
private:
|
||||
int m_prepareCount;
|
||||
int m_updateCount;
|
||||
cc::IntRect m_rectToInvalidate;
|
||||
gfx::Rect m_rectToInvalidate;
|
||||
gfx::Rect m_lastUpdateRect;
|
||||
gfx::Rect m_opaquePaintRect;
|
||||
scoped_refptr<FakeTiledLayer> m_layer;
|
||||
@ -82,7 +82,7 @@ class FakeTiledLayer : public cc::TiledLayer {
|
||||
public:
|
||||
explicit FakeTiledLayer(cc::PrioritizedTextureManager*);
|
||||
|
||||
static cc::IntSize tileSize() { return cc::IntSize(100, 100); }
|
||||
static gfx::Size tileSize() { return gfx::Size(100, 100); }
|
||||
|
||||
using cc::TiledLayer::invalidateContentRect;
|
||||
using cc::TiledLayer::needsIdlePaint;
|
||||
@ -90,14 +90,14 @@ public:
|
||||
using cc::TiledLayer::numPaintedTiles;
|
||||
using cc::TiledLayer::idlePaintRect;
|
||||
|
||||
virtual void setNeedsDisplayRect(const cc::FloatRect&) OVERRIDE;
|
||||
const cc::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
|
||||
virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
|
||||
const gfx::RectF& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
|
||||
|
||||
virtual void setTexturePriorities(const cc::PriorityCalculator&) OVERRIDE;
|
||||
|
||||
virtual cc::PrioritizedTextureManager* textureManager() const OVERRIDE;
|
||||
FakeLayerUpdater* fakeLayerUpdater() { return m_fakeUpdater.get(); }
|
||||
cc::FloatRect updateRect() { return m_updateRect; }
|
||||
gfx::RectF updateRect() { return m_updateRect; }
|
||||
|
||||
protected:
|
||||
virtual cc::LayerUpdater* updater() const OVERRIDE;
|
||||
@ -107,22 +107,22 @@ protected:
|
||||
private:
|
||||
scoped_refptr<FakeLayerUpdater> m_fakeUpdater;
|
||||
cc::PrioritizedTextureManager* m_textureManager;
|
||||
cc::FloatRect m_lastNeedsDisplayRect;
|
||||
gfx::RectF m_lastNeedsDisplayRect;
|
||||
};
|
||||
|
||||
class FakeTiledLayerWithScaledBounds : public FakeTiledLayer {
|
||||
public:
|
||||
explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedTextureManager*);
|
||||
|
||||
void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBounds = contentBounds; }
|
||||
virtual cc::IntSize contentBounds() const OVERRIDE;
|
||||
void setContentBounds(const gfx::Size& contentBounds) { m_forcedContentBounds = contentBounds; }
|
||||
virtual gfx::Size contentBounds() const OVERRIDE;
|
||||
virtual float contentsScaleX() const OVERRIDE;
|
||||
virtual float contentsScaleY() const OVERRIDE;
|
||||
virtual void setContentsScale(float) OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual ~FakeTiledLayerWithScaledBounds();
|
||||
cc::IntSize m_forcedContentBounds;
|
||||
gfx::Size m_forcedContentBounds;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ void TextureLayer::setFlipped(bool flipped)
|
||||
setNeedsCommit();
|
||||
}
|
||||
|
||||
void TextureLayer::setUVRect(const FloatRect& rect)
|
||||
void TextureLayer::setUVRect(const gfx::RectF& rect)
|
||||
{
|
||||
m_uvRect = rect;
|
||||
setNeedsCommit();
|
||||
@ -90,7 +90,7 @@ void TextureLayer::willModifyTexture()
|
||||
}
|
||||
}
|
||||
|
||||
void TextureLayer::setNeedsDisplayRect(const FloatRect& dirtyRect)
|
||||
void TextureLayer::setNeedsDisplayRect(const gfx::RectF& dirtyRect)
|
||||
{
|
||||
Layer::setNeedsDisplayRect(dirtyRect);
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
void setFlipped(bool);
|
||||
|
||||
// Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1).
|
||||
void setUVRect(const FloatRect&);
|
||||
void setUVRect(const gfx::RectF&);
|
||||
|
||||
// Sets whether the alpha channel is premultiplied or unpremultiplied. Defaults to true.
|
||||
void setPremultipliedAlpha(bool);
|
||||
@ -46,7 +46,7 @@ public:
|
||||
|
||||
void willModifyTexture();
|
||||
|
||||
virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
|
||||
virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
|
||||
|
||||
virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
|
||||
virtual bool drawsContent() const OVERRIDE;
|
||||
@ -61,7 +61,7 @@ private:
|
||||
TextureLayerClient* m_client;
|
||||
|
||||
bool m_flipped;
|
||||
FloatRect m_uvRect;
|
||||
gfx::RectF m_uvRect;
|
||||
bool m_premultipliedAlpha;
|
||||
bool m_rateLimitContext;
|
||||
bool m_contextLost;
|
||||
|
@ -43,7 +43,7 @@ void TextureLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQu
|
||||
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
|
||||
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
|
||||
|
||||
IntRect quadRect(IntPoint(), contentBounds());
|
||||
gfx::Rect quadRect(gfx::Point(), contentBounds());
|
||||
quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<DrawQuad>(), appendQuadsData);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
void setTextureId(unsigned id) { m_textureId = id; }
|
||||
void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; }
|
||||
void setFlipped(bool flipped) { m_flipped = flipped; }
|
||||
void setUVRect(const FloatRect& rect) { m_uvRect = rect; }
|
||||
void setUVRect(const gfx::RectF& rect) { m_uvRect = rect; }
|
||||
|
||||
private:
|
||||
explicit TextureLayerImpl(int);
|
||||
@ -40,7 +40,7 @@ private:
|
||||
ResourceProvider::ResourceId m_externalTextureResource;
|
||||
bool m_premultipliedAlpha;
|
||||
bool m_flipped;
|
||||
FloatRect m_uvRect;
|
||||
gfx::RectF m_uvRect;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ ThreadProxy::~ThreadProxy()
|
||||
DCHECK(!m_started);
|
||||
}
|
||||
|
||||
bool ThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
|
||||
bool ThreadProxy::compositeAndReadback(void *pixels, const gfx::Rect& rect)
|
||||
{
|
||||
TRACE_EVENT0("cc", "ThreadPRoxy::compositeAndReadback");
|
||||
DCHECK(isMainThread());
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
virtual ~ThreadProxy();
|
||||
|
||||
// Proxy implementation
|
||||
virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
|
||||
virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE;
|
||||
virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE;
|
||||
virtual void finishAllRendering() OVERRIDE;
|
||||
virtual bool isStarted() const OVERRIDE;
|
||||
@ -105,7 +105,7 @@ private:
|
||||
CompletionEvent completion;
|
||||
bool success;
|
||||
void* pixels;
|
||||
IntRect rect;
|
||||
gfx::Rect rect;
|
||||
};
|
||||
void forceBeginFrameOnImplThread(CompletionEvent*);
|
||||
void beginFrameCompleteOnImplThread(CompletionEvent*, ResourceUpdateQueue*);
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace cc {
|
||||
|
||||
scoped_ptr<TileDrawQuad> TileDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
|
||||
scoped_ptr<TileDrawQuad> TileDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
|
||||
{
|
||||
return make_scoped_ptr(new TileDrawQuad(sharedQuadState, quadRect, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA));
|
||||
}
|
||||
|
||||
TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
|
||||
TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
|
||||
: DrawQuad(sharedQuadState, DrawQuad::TiledContent, quadRect)
|
||||
, m_resourceId(resourceId)
|
||||
, m_textureOffset(textureOffset)
|
||||
|
@ -17,10 +17,10 @@ namespace cc {
|
||||
|
||||
class TileDrawQuad : public DrawQuad {
|
||||
public:
|
||||
static scoped_ptr<TileDrawQuad> create(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
|
||||
static scoped_ptr<TileDrawQuad> create(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
|
||||
|
||||
unsigned resourceId() const { return m_resourceId; }
|
||||
gfx::Point textureOffset() const { return m_textureOffset; }
|
||||
gfx::Vector2d textureOffset() const { return m_textureOffset; }
|
||||
gfx::Size textureSize() const { return m_textureSize; }
|
||||
GLint textureFilter() const { return m_textureFilter; }
|
||||
bool swizzleContents() const { return m_swizzleContents; }
|
||||
@ -34,10 +34,10 @@ public:
|
||||
|
||||
static const TileDrawQuad* materialCast(const DrawQuad*);
|
||||
private:
|
||||
TileDrawQuad(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
|
||||
TileDrawQuad(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
|
||||
|
||||
unsigned m_resourceId;
|
||||
gfx::Point m_textureOffset;
|
||||
gfx::Vector2d m_textureOffset;
|
||||
gfx::Size m_textureSize;
|
||||
GLint m_textureFilter;
|
||||
bool m_swizzleContents;
|
||||
|
@ -8,11 +8,13 @@
|
||||
|
||||
#include "Region.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "cc/geometry.h"
|
||||
#include "cc/layer_impl.h"
|
||||
#include "cc/layer_tree_host.h"
|
||||
#include "cc/overdraw_metrics.h"
|
||||
#include "cc/tiled_layer_impl.h"
|
||||
#include "third_party/khronos/GLES2/gl2.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
|
||||
using namespace std;
|
||||
using WebKit::WebTransformationMatrix;
|
||||
@ -39,7 +41,7 @@ public:
|
||||
LayerUpdater::Resource* updaterResource() { return m_updaterResource.get(); }
|
||||
PrioritizedTexture* managedTexture() { return m_updaterResource->texture(); }
|
||||
|
||||
bool isDirty() const { return !dirtyRect.isEmpty(); }
|
||||
bool isDirty() const { return !dirtyRect.IsEmpty(); }
|
||||
|
||||
// Reset update state for the current frame. This should occur before painting
|
||||
// for all layers. Since painting one layer can invalidate another layer
|
||||
@ -47,7 +49,7 @@ public:
|
||||
// such that invalidations during painting won't prevent them from being pushed.
|
||||
void resetUpdateState()
|
||||
{
|
||||
updateRect = IntRect();
|
||||
updateRect = gfx::Rect();
|
||||
occluded = false;
|
||||
partialUpdate = false;
|
||||
validForFrame = !isDirty();
|
||||
@ -60,11 +62,11 @@ public:
|
||||
{
|
||||
validForFrame = true;
|
||||
updateRect = dirtyRect;
|
||||
dirtyRect = IntRect();
|
||||
dirtyRect = gfx::Rect();
|
||||
}
|
||||
|
||||
IntRect dirtyRect;
|
||||
IntRect updateRect;
|
||||
gfx::Rect dirtyRect;
|
||||
gfx::Rect updateRect;
|
||||
bool partialUpdate;
|
||||
bool validForFrame;
|
||||
bool occluded;
|
||||
@ -90,7 +92,7 @@ TiledLayer::TiledLayer()
|
||||
, m_failedUpdate(false)
|
||||
, m_tilingOption(AutoTile)
|
||||
{
|
||||
m_tiler = LayerTilingData::create(IntSize(), LayerTilingData::HasBorderTexels);
|
||||
m_tiler = LayerTilingData::create(gfx::Size(), LayerTilingData::HasBorderTexels);
|
||||
}
|
||||
|
||||
TiledLayer::~TiledLayer()
|
||||
@ -106,22 +108,22 @@ void TiledLayer::updateTileSizeAndTilingOption()
|
||||
{
|
||||
DCHECK(layerTreeHost());
|
||||
|
||||
const IntSize& defaultTileSize = layerTreeHost()->settings().defaultTileSize;
|
||||
const IntSize& maxUntiledLayerSize = layerTreeHost()->settings().maxUntiledLayerSize;
|
||||
gfx::Size defaultTileSize = layerTreeHost()->settings().defaultTileSize;
|
||||
gfx::Size maxUntiledLayerSize = layerTreeHost()->settings().maxUntiledLayerSize;
|
||||
int layerWidth = contentBounds().width();
|
||||
int layerHeight = contentBounds().height();
|
||||
|
||||
const IntSize tileSize(min(defaultTileSize.width(), layerWidth), min(defaultTileSize.height(), layerHeight));
|
||||
gfx::Size tileSize(min(defaultTileSize.width(), layerWidth), min(defaultTileSize.height(), layerHeight));
|
||||
|
||||
// Tile if both dimensions large, or any one dimension large and the other
|
||||
// extends into a second tile but the total layer area isn't larger than that
|
||||
// of the largest possible untiled layer. This heuristic allows for long skinny layers
|
||||
// (e.g. scrollbars) that are Nx1 tiles to minimize wasted texture space but still avoids
|
||||
// creating very large tiles.
|
||||
const bool anyDimensionLarge = layerWidth > maxUntiledLayerSize.width() || layerHeight > maxUntiledLayerSize.height();
|
||||
const bool anyDimensionOneTile = (layerWidth <= defaultTileSize.width() || layerHeight <= defaultTileSize.height())
|
||||
bool anyDimensionLarge = layerWidth > maxUntiledLayerSize.width() || layerHeight > maxUntiledLayerSize.height();
|
||||
bool anyDimensionOneTile = (layerWidth <= defaultTileSize.width() || layerHeight <= defaultTileSize.height())
|
||||
&& (layerWidth * layerHeight) <= (maxUntiledLayerSize.width() * maxUntiledLayerSize.height());
|
||||
const bool autoTiled = anyDimensionLarge && !anyDimensionOneTile;
|
||||
bool autoTiled = anyDimensionLarge && !anyDimensionOneTile;
|
||||
|
||||
bool isTiled;
|
||||
if (m_tilingOption == AlwaysTile)
|
||||
@ -131,30 +133,30 @@ void TiledLayer::updateTileSizeAndTilingOption()
|
||||
else
|
||||
isTiled = autoTiled;
|
||||
|
||||
IntSize requestedSize = isTiled ? tileSize : contentBounds();
|
||||
gfx::Size requestedSize = isTiled ? tileSize : contentBounds();
|
||||
const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize;
|
||||
IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize));
|
||||
gfx::Size clampedSize = ClampSizeFromAbove(requestedSize, gfx::Size(maxSize, maxSize));
|
||||
setTileSize(clampedSize);
|
||||
}
|
||||
|
||||
void TiledLayer::updateBounds()
|
||||
{
|
||||
IntSize oldBounds = m_tiler->bounds();
|
||||
IntSize newBounds = contentBounds();
|
||||
gfx::Size oldBounds = m_tiler->bounds();
|
||||
gfx::Size newBounds = contentBounds();
|
||||
if (oldBounds == newBounds)
|
||||
return;
|
||||
m_tiler->setBounds(newBounds);
|
||||
|
||||
// Invalidate any areas that the new bounds exposes.
|
||||
Region oldRegion(IntRect(IntPoint(), oldBounds));
|
||||
Region newRegion(IntRect(IntPoint(), newBounds));
|
||||
Region oldRegion = IntRect(IntPoint(), cc::IntSize(oldBounds));
|
||||
Region newRegion = IntRect(IntPoint(), cc::IntSize(newBounds));
|
||||
newRegion.subtract(oldRegion);
|
||||
Vector<WebCore::IntRect> rects = newRegion.rects();
|
||||
for (size_t i = 0; i < rects.size(); ++i)
|
||||
invalidateContentRect(rects[i]);
|
||||
invalidateContentRect(cc::IntRect(rects[i]));
|
||||
}
|
||||
|
||||
void TiledLayer::setTileSize(const IntSize& size)
|
||||
void TiledLayer::setTileSize(const gfx::Size& size)
|
||||
{
|
||||
m_tiler->setTileSize(size);
|
||||
}
|
||||
@ -269,7 +271,7 @@ UpdatableTile* TiledLayer::createTile(int i, int j)
|
||||
return addedTile;
|
||||
}
|
||||
|
||||
void TiledLayer::setNeedsDisplayRect(const FloatRect& dirtyRect)
|
||||
void TiledLayer::setNeedsDisplayRect(const gfx::RectF& dirtyRect)
|
||||
{
|
||||
invalidateContentRect(layerRectToContentRect(dirtyRect));
|
||||
ContentsScalingLayer::setNeedsDisplayRect(dirtyRect);
|
||||
@ -289,10 +291,10 @@ void TiledLayer::setUseLCDText(bool useLCDText)
|
||||
setBorderTexelOption(borderTexelOption);
|
||||
}
|
||||
|
||||
void TiledLayer::invalidateContentRect(const IntRect& contentRect)
|
||||
void TiledLayer::invalidateContentRect(const gfx::Rect& contentRect)
|
||||
{
|
||||
updateBounds();
|
||||
if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw)
|
||||
if (m_tiler->isEmpty() || contentRect.IsEmpty() || m_skipsDraw)
|
||||
return;
|
||||
|
||||
for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) {
|
||||
@ -301,16 +303,16 @@ void TiledLayer::invalidateContentRect(const IntRect& contentRect)
|
||||
// FIXME: This should not ever be null.
|
||||
if (!tile)
|
||||
continue;
|
||||
IntRect bound = m_tiler->tileRect(tile);
|
||||
bound.intersect(contentRect);
|
||||
tile->dirtyRect.unite(bound);
|
||||
gfx::Rect bound = m_tiler->tileRect(tile);
|
||||
bound.Intersect(contentRect);
|
||||
tile->dirtyRect.Union(bound);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true if tile is dirty and only part of it needs to be updated.
|
||||
bool TiledLayer::tileOnlyNeedsPartialUpdate(UpdatableTile* tile)
|
||||
{
|
||||
return !tile->dirtyRect.contains(m_tiler->tileRect(tile)) && tile->managedTexture()->haveBackingTexture();
|
||||
return !tile->dirtyRect.Contains(m_tiler->tileRect(tile)) && tile->managedTexture()->haveBackingTexture();
|
||||
}
|
||||
|
||||
bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats, bool& didPaint)
|
||||
@ -324,12 +326,12 @@ bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceU
|
||||
return false;
|
||||
}
|
||||
|
||||
IntRect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcclusions);
|
||||
gfx::Rect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcclusions);
|
||||
|
||||
if (occlusion)
|
||||
occlusion->overdrawMetrics().didPaint(paintRect);
|
||||
occlusion->overdrawMetrics().didPaint(cc::IntRect(paintRect));
|
||||
|
||||
if (paintRect.isEmpty())
|
||||
if (paintRect.IsEmpty())
|
||||
return true;
|
||||
|
||||
didPaint = true;
|
||||
@ -355,7 +357,7 @@ void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right,
|
||||
if (!tile)
|
||||
continue;
|
||||
DCHECK(!tile->occluded); // Did resetUpdateState get skipped? Are we doing more than one occlusion pass?
|
||||
IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleContentRect());
|
||||
gfx::Rect visibleTileRect = gfx::IntersectRects(m_tiler->tileBounds(i, j), visibleContentRect());
|
||||
if (occlusion && occlusion->occluded(renderTarget(), visibleTileRect, drawTransform(), drawTransformIsAnimating(), drawableContentRect())) {
|
||||
tile->occluded = true;
|
||||
occludedTileCount++;
|
||||
@ -397,9 +399,9 @@ bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom,
|
||||
return true;
|
||||
}
|
||||
|
||||
IntRect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions)
|
||||
gfx::Rect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions)
|
||||
{
|
||||
IntRect paintRect;
|
||||
gfx::Rect paintRect;
|
||||
for (int j = top; j <= bottom; ++j) {
|
||||
for (int i = left; i <= right; ++i) {
|
||||
UpdatableTile* tile = tileAt(i, j);
|
||||
@ -424,20 +426,19 @@ IntRect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom,
|
||||
}
|
||||
}
|
||||
|
||||
paintRect.unite(tile->dirtyRect);
|
||||
paintRect.Union(tile->dirtyRect);
|
||||
tile->markForUpdate();
|
||||
}
|
||||
}
|
||||
return paintRect;
|
||||
}
|
||||
|
||||
void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats)
|
||||
void TiledLayer::updateTileTextures(const gfx::Rect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats)
|
||||
{
|
||||
// The updateRect should be in layer space. So we have to convert the paintRect from content space to layer space.
|
||||
m_updateRect = FloatRect(paintRect);
|
||||
float widthScale = bounds().width() / static_cast<float>(contentBounds().width());
|
||||
float heightScale = bounds().height() / static_cast<float>(contentBounds().height());
|
||||
m_updateRect.scale(widthScale, heightScale);
|
||||
m_updateRect = gfx::ScaleRect(paintRect, widthScale, heightScale);
|
||||
|
||||
// Calling prepareToUpdate() calls into WebKit to paint, which may have the side
|
||||
// effect of disabling compositing, which causes our reference to the texture updater to be deleted.
|
||||
@ -455,49 +456,49 @@ void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
|
||||
if (!tile)
|
||||
continue;
|
||||
|
||||
IntRect tileRect = m_tiler->tileBounds(i, j);
|
||||
gfx::Rect tileRect = m_tiler->tileBounds(i, j);
|
||||
|
||||
// Use updateRect as the above loop copied the dirty rect for this frame to updateRect.
|
||||
const IntRect& dirtyRect = tile->updateRect;
|
||||
if (dirtyRect.isEmpty())
|
||||
const gfx::Rect& dirtyRect = tile->updateRect;
|
||||
if (dirtyRect.IsEmpty())
|
||||
continue;
|
||||
|
||||
// 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, cc::IntRect(paintedOpaqueRect));
|
||||
if (!tilePaintedRect.isEmpty()) {
|
||||
IntRect paintInsideTileOpaqueRect = intersection(tile->opaqueRect(), tilePaintedRect);
|
||||
bool paintInsideTileOpaqueRectIsNonOpaque = !tilePaintedOpaqueRect.contains(paintInsideTileOpaqueRect);
|
||||
bool opaquePaintNotInsideTileOpaqueRect = !tilePaintedOpaqueRect.isEmpty() && !tile->opaqueRect().contains(tilePaintedOpaqueRect);
|
||||
gfx::Rect tilePaintedRect = gfx::IntersectRects(tileRect, paintRect);
|
||||
gfx::Rect tilePaintedOpaqueRect = gfx::IntersectRects(tileRect, paintedOpaqueRect);
|
||||
if (!tilePaintedRect.IsEmpty()) {
|
||||
gfx::Rect paintInsideTileOpaqueRect = gfx::IntersectRects(tile->opaqueRect(), tilePaintedRect);
|
||||
bool paintInsideTileOpaqueRectIsNonOpaque = !tilePaintedOpaqueRect.Contains(paintInsideTileOpaqueRect);
|
||||
bool opaquePaintNotInsideTileOpaqueRect = !tilePaintedOpaqueRect.IsEmpty() && !tile->opaqueRect().Contains(tilePaintedOpaqueRect);
|
||||
|
||||
if (paintInsideTileOpaqueRectIsNonOpaque || opaquePaintNotInsideTileOpaqueRect)
|
||||
tile->setOpaqueRect(tilePaintedOpaqueRect);
|
||||
}
|
||||
|
||||
// sourceRect starts as a full-sized tile with border texels included.
|
||||
IntRect sourceRect = m_tiler->tileRect(tile);
|
||||
sourceRect.intersect(dirtyRect);
|
||||
gfx::Rect sourceRect = m_tiler->tileRect(tile);
|
||||
sourceRect.Intersect(dirtyRect);
|
||||
// Paint rect not guaranteed to line up on tile boundaries, so
|
||||
// make sure that sourceRect doesn't extend outside of it.
|
||||
sourceRect.intersect(paintRect);
|
||||
sourceRect.Intersect(paintRect);
|
||||
|
||||
tile->updateRect = sourceRect;
|
||||
|
||||
if (sourceRect.isEmpty())
|
||||
if (sourceRect.IsEmpty())
|
||||
continue;
|
||||
|
||||
const IntPoint anchor = m_tiler->tileRect(tile).location();
|
||||
const gfx::Point anchor = m_tiler->tileRect(tile).origin();
|
||||
|
||||
// Calculate tile-space rectangle to upload into.
|
||||
gfx::Vector2d destOffset(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y());
|
||||
gfx::Vector2d destOffset = sourceRect.origin() - anchor;
|
||||
if (destOffset.x() < 0)
|
||||
CRASH();
|
||||
if (destOffset.y() < 0)
|
||||
CRASH();
|
||||
|
||||
// Offset from paint rectangle to this tile's dirty rectangle.
|
||||
gfx::Vector2d paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y() - paintRect.y());
|
||||
gfx::Vector2d paintOffset = sourceRect.origin() - paintRect.origin();
|
||||
if (paintOffset.x() < 0)
|
||||
CRASH();
|
||||
if (paintOffset.y() < 0)
|
||||
@ -509,7 +510,7 @@ void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
|
||||
|
||||
tile->updaterResource()->update(queue, sourceRect, destOffset, tile->partialUpdate, stats);
|
||||
if (occlusion)
|
||||
occlusion->overdrawMetrics().didUpload(WebTransformationMatrix(), sourceRect, tile->opaqueRect());
|
||||
occlusion->overdrawMetrics().didUpload(WebTransformationMatrix(), cc::IntRect(sourceRect), cc::IntRect(tile->opaqueRect()));
|
||||
|
||||
}
|
||||
}
|
||||
@ -523,8 +524,8 @@ bool isSmallAnimatedLayer(TiledLayer* layer)
|
||||
{
|
||||
if (!layer->drawTransformIsAnimating() && !layer->screenSpaceTransformIsAnimating())
|
||||
return false;
|
||||
IntSize viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->deviceViewportSize() : IntSize();
|
||||
IntRect contentRect(IntPoint::zero(), layer->contentBounds());
|
||||
gfx::Size viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->deviceViewportSize() : gfx::Size();
|
||||
gfx::Rect contentRect(gfx::Point(), layer->contentBounds());
|
||||
return contentRect.width() <= viewportSize.width() + 64
|
||||
&& contentRect.height() <= viewportSize.height() + 64;
|
||||
}
|
||||
@ -532,14 +533,14 @@ bool isSmallAnimatedLayer(TiledLayer* layer)
|
||||
// FIXME: Remove this and make this based on distance once distance can be calculated
|
||||
// for offscreen layers. For now, prioritize all small animated layers after 512
|
||||
// pixels of pre-painting.
|
||||
void setPriorityForTexture(const IntRect& visibleRect,
|
||||
const IntRect& tileRect,
|
||||
void setPriorityForTexture(const gfx::Rect& visibleRect,
|
||||
const gfx::Rect& tileRect,
|
||||
bool drawsToRoot,
|
||||
bool isSmallAnimatedLayer,
|
||||
PrioritizedTexture* texture)
|
||||
{
|
||||
int priority = PriorityCalculator::lowestPriority();
|
||||
if (!visibleRect.isEmpty())
|
||||
if (!visibleRect.IsEmpty())
|
||||
priority = PriorityCalculator::priorityFromDistance(visibleRect, tileRect, drawsToRoot);
|
||||
if (isSmallAnimatedLayer)
|
||||
priority = PriorityCalculator::maxPriority(priority, PriorityCalculator::smallAnimatedLayerMinPriority());
|
||||
@ -561,10 +562,10 @@ void TiledLayer::setTexturePriorities(const PriorityCalculator& priorityCalc)
|
||||
bool smallAnimatedLayer = isSmallAnimatedLayer(this);
|
||||
|
||||
// Minimally create the tiles in the desired pre-paint rect.
|
||||
IntRect createTilesRect = idlePaintRect();
|
||||
gfx::Rect createTilesRect = idlePaintRect();
|
||||
if (smallAnimatedLayer)
|
||||
createTilesRect = IntRect(IntPoint::zero(), contentBounds());
|
||||
if (!createTilesRect.isEmpty()) {
|
||||
createTilesRect = gfx::Rect(gfx::Point(), contentBounds());
|
||||
if (!createTilesRect.IsEmpty()) {
|
||||
int left, top, right, bottom;
|
||||
m_tiler->contentRectToTileIndices(createTilesRect, left, top, right, bottom);
|
||||
for (int j = top; j <= bottom; ++j) {
|
||||
@ -581,7 +582,7 @@ void TiledLayer::setTexturePriorities(const PriorityCalculator& priorityCalc)
|
||||
// FIXME: This should not ever be null.
|
||||
if (!tile)
|
||||
continue;
|
||||
IntRect tileRect = m_tiler->tileRect(tile);
|
||||
gfx::Rect tileRect = m_tiler->tileRect(tile);
|
||||
setPriorityForTexture(m_predictedVisibleRect, tileRect, drawsToRoot, smallAnimatedLayer, tile->managedTexture());
|
||||
}
|
||||
}
|
||||
@ -591,7 +592,7 @@ Region TiledLayer::visibleContentOpaqueRegion() const
|
||||
if (m_skipsDraw)
|
||||
return Region();
|
||||
if (contentsOpaque())
|
||||
return visibleContentRect();
|
||||
return cc::IntRect(visibleContentRect());
|
||||
return m_tiler->opaqueRegionInContentRect(visibleContentRect());
|
||||
}
|
||||
|
||||
@ -611,12 +612,12 @@ void TiledLayer::resetUpdateState()
|
||||
}
|
||||
|
||||
namespace {
|
||||
IntRect expandRectByDelta(IntRect rect, IntSize delta) {
|
||||
int width = rect.width() + abs(delta.width());
|
||||
int height = rect.height() + abs(delta.height());
|
||||
int x = rect.x() + ((delta.width() < 0) ? delta.width() : 0);
|
||||
int y = rect.y() + ((delta.height() < 0) ? delta.height() : 0);
|
||||
return IntRect(x, y, width, height);
|
||||
gfx::Rect expandRectByDelta(gfx::Rect rect, gfx::Vector2d delta) {
|
||||
int width = rect.width() + abs(delta.x());
|
||||
int height = rect.height() + abs(delta.y());
|
||||
int x = rect.x() + ((delta.x() < 0) ? delta.x() : 0);
|
||||
int y = rect.y() + ((delta.y() < 0) ? delta.y() : 0);
|
||||
return gfx::Rect(x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -630,21 +631,21 @@ void TiledLayer::updateScrollPrediction()
|
||||
// - visibleRect.size() hasn't changed.
|
||||
// These two conditions prevent rotations, scales, pinch-zooms etc. where
|
||||
// the prediction would be incorrect.
|
||||
IntSize delta = visibleContentRect().center() - m_previousVisibleRect.center();
|
||||
gfx::Vector2d delta = visibleContentRect().CenterPoint() - m_previousVisibleRect.CenterPoint();
|
||||
m_predictedScroll = -delta;
|
||||
m_predictedVisibleRect = visibleContentRect();
|
||||
if (m_previousContentBounds == contentBounds() && m_previousVisibleRect.size() == visibleContentRect().size()) {
|
||||
// Only expand the visible rect in the major scroll direction, to prevent
|
||||
// massive paints due to diagonal scrolls.
|
||||
IntSize majorScrollDelta = (abs(delta.width()) > abs(delta.height())) ? IntSize(delta.width(), 0) : IntSize(0, delta.height());
|
||||
gfx::Vector2d majorScrollDelta = (abs(delta.x()) > abs(delta.y())) ? gfx::Vector2d(delta.x(), 0) : gfx::Vector2d(0, delta.y());
|
||||
m_predictedVisibleRect = expandRectByDelta(visibleContentRect(), majorScrollDelta);
|
||||
|
||||
// Bound the prediction to prevent unbounded paints, and clamp to content bounds.
|
||||
IntRect bound = visibleContentRect();
|
||||
bound.inflateX(m_tiler->tileSize().width() * maxPredictiveTilesCount);
|
||||
bound.inflateY(m_tiler->tileSize().height() * maxPredictiveTilesCount);
|
||||
bound.intersect(IntRect(IntPoint::zero(), contentBounds()));
|
||||
m_predictedVisibleRect.intersect(bound);
|
||||
gfx::Rect bound = visibleContentRect();
|
||||
bound.Inset(-m_tiler->tileSize().width() * maxPredictiveTilesCount,
|
||||
-m_tiler->tileSize().height() * maxPredictiveTilesCount);
|
||||
bound.Intersect(gfx::Rect(gfx::Point(), contentBounds()));
|
||||
m_predictedVisibleRect.Intersect(bound);
|
||||
}
|
||||
m_previousContentBounds = contentBounds();
|
||||
m_previousVisibleRect = visibleContentRect();
|
||||
@ -664,7 +665,7 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
|
||||
// hiccups while it is animating.
|
||||
if (isSmallAnimatedLayer(this)) {
|
||||
int left, top, right, bottom;
|
||||
m_tiler->contentRectToTileIndices(IntRect(IntPoint::zero(), contentBounds()), left, top, right, bottom);
|
||||
m_tiler->contentRectToTileIndices(gfx::Rect(gfx::Point(), contentBounds()), left, top, right, bottom);
|
||||
updateTiles(left, top, right, bottom, queue, 0, stats, didPaint);
|
||||
if (didPaint)
|
||||
return;
|
||||
@ -673,7 +674,7 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
|
||||
m_failedUpdate = false;
|
||||
}
|
||||
|
||||
if (m_predictedVisibleRect.isEmpty())
|
||||
if (m_predictedVisibleRect.IsEmpty())
|
||||
return;
|
||||
|
||||
// Visible painting. First occlude visible tiles and paint the non-occluded tiles.
|
||||
@ -687,8 +688,8 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
|
||||
return;
|
||||
|
||||
// If we have already painting everything visible. Do some pre-painting while idle.
|
||||
IntRect idlePaintContentRect = idlePaintRect();
|
||||
if (idlePaintContentRect.isEmpty())
|
||||
gfx::Rect idlePaintContentRect = idlePaintRect();
|
||||
if (idlePaintContentRect.IsEmpty())
|
||||
return;
|
||||
|
||||
// Prepaint anything that was occluded but inside the layer's visible region.
|
||||
@ -700,35 +701,35 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
|
||||
|
||||
// Then expand outwards one row/column at a time until we find a dirty row/column
|
||||
// to update. Increment along the major and minor scroll directions first.
|
||||
IntSize delta = -m_predictedScroll;
|
||||
delta = IntSize(delta.width() == 0 ? 1 : delta.width(),
|
||||
delta.height() == 0 ? 1 : delta.height());
|
||||
IntSize majorDelta = (abs(delta.width()) > abs(delta.height())) ? IntSize(delta.width(), 0) : IntSize(0, delta.height());
|
||||
IntSize minorDelta = (abs(delta.width()) <= abs(delta.height())) ? IntSize(delta.width(), 0) : IntSize(0, delta.height());
|
||||
IntSize deltas[4] = {majorDelta, minorDelta, -majorDelta, -minorDelta};
|
||||
gfx::Vector2d delta = -m_predictedScroll;
|
||||
delta = gfx::Vector2d(delta.x() == 0 ? 1 : delta.x(),
|
||||
delta.y() == 0 ? 1 : delta.y());
|
||||
gfx::Vector2d majorDelta = (abs(delta.x()) > abs(delta.y())) ? gfx::Vector2d(delta.x(), 0) : gfx::Vector2d(0, delta.y());
|
||||
gfx::Vector2d minorDelta = (abs(delta.x()) <= abs(delta.y())) ? gfx::Vector2d(delta.x(), 0) : gfx::Vector2d(0, delta.y());
|
||||
gfx::Vector2d deltas[4] = {majorDelta, minorDelta, -majorDelta, -minorDelta};
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if (deltas[i].height() > 0) {
|
||||
if (deltas[i].y() > 0) {
|
||||
while (bottom < prepaintBottom) {
|
||||
++bottom;
|
||||
if (!updateTiles(left, bottom, right, bottom, queue, 0, stats, didPaint) || didPaint)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (deltas[i].height() < 0) {
|
||||
if (deltas[i].y() < 0) {
|
||||
while (top > prepaintTop) {
|
||||
--top;
|
||||
if (!updateTiles(left, top, right, top, queue, 0, stats, didPaint) || didPaint)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (deltas[i].width() < 0) {
|
||||
if (deltas[i].x() < 0) {
|
||||
while (left > prepaintLeft) {
|
||||
--left;
|
||||
if (!updateTiles(left, top, left, bottom, queue, 0, stats, didPaint) || didPaint)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (deltas[i].width() > 0) {
|
||||
if (deltas[i].x() > 0) {
|
||||
while (right < prepaintRight) {
|
||||
++right;
|
||||
if (!updateTiles(right, top, right, bottom, queue, 0, stats, didPaint) || didPaint)
|
||||
@ -741,11 +742,11 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
|
||||
bool TiledLayer::needsIdlePaint()
|
||||
{
|
||||
// Don't trigger more paints if we failed (as we'll just fail again).
|
||||
if (m_failedUpdate || visibleContentRect().isEmpty() || m_tiler->hasEmptyBounds() || !drawsContent())
|
||||
if (m_failedUpdate || visibleContentRect().IsEmpty() || m_tiler->hasEmptyBounds() || !drawsContent())
|
||||
return false;
|
||||
|
||||
IntRect idlePaintContentRect = idlePaintRect();
|
||||
if (idlePaintContentRect.isEmpty())
|
||||
gfx::Rect idlePaintContentRect = idlePaintRect();
|
||||
if (idlePaintContentRect.IsEmpty())
|
||||
return false;
|
||||
|
||||
int left, top, right, bottom;
|
||||
@ -758,7 +759,7 @@ bool TiledLayer::needsIdlePaint()
|
||||
if (!tile)
|
||||
continue;
|
||||
|
||||
bool updated = !tile->updateRect.isEmpty();
|
||||
bool updated = !tile->updateRect.IsEmpty();
|
||||
bool canAcquire = tile->managedTexture()->canAcquireBackingTexture();
|
||||
bool dirty = tile->isDirty() || !tile->managedTexture()->haveBackingTexture();
|
||||
if (!updated && canAcquire && dirty)
|
||||
@ -768,17 +769,17 @@ bool TiledLayer::needsIdlePaint()
|
||||
return false;
|
||||
}
|
||||
|
||||
IntRect TiledLayer::idlePaintRect()
|
||||
gfx::Rect TiledLayer::idlePaintRect()
|
||||
{
|
||||
// Don't inflate an empty rect.
|
||||
if (visibleContentRect().isEmpty())
|
||||
return IntRect();
|
||||
if (visibleContentRect().IsEmpty())
|
||||
return gfx::Rect();
|
||||
|
||||
IntRect prepaintRect = visibleContentRect();
|
||||
prepaintRect.inflateX(m_tiler->tileSize().width() * prepaintColumns);
|
||||
prepaintRect.inflateY(m_tiler->tileSize().height() * prepaintRows);
|
||||
IntRect contentRect(IntPoint::zero(), contentBounds());
|
||||
prepaintRect.intersect(contentRect);
|
||||
gfx::Rect prepaintRect = visibleContentRect();
|
||||
prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns,
|
||||
-m_tiler->tileSize().height() * prepaintRows);
|
||||
gfx::Rect contentRect(gfx::Point(), contentBounds());
|
||||
prepaintRect.Intersect(contentRect);
|
||||
|
||||
return prepaintRect;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
virtual bool drawsContent() const OVERRIDE;
|
||||
|
||||
virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
|
||||
virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
|
||||
|
||||
virtual void setUseLCDText(bool) OVERRIDE;
|
||||
|
||||
@ -42,7 +42,7 @@ protected:
|
||||
void updateBounds();
|
||||
|
||||
// Exposed to subclasses for testing.
|
||||
void setTileSize(const IntSize&);
|
||||
void setTileSize(const gfx::Size&);
|
||||
void setTextureFormat(GLenum textureFormat) { m_textureFormat = textureFormat; }
|
||||
void setBorderTexelOption(LayerTilingData::BorderTexelOption);
|
||||
size_t numPaintedTiles() { return m_tiler->tiles().size(); }
|
||||
@ -51,14 +51,14 @@ protected:
|
||||
virtual void createUpdaterIfNeeded() = 0;
|
||||
|
||||
// Set invalidations to be potentially repainted during update().
|
||||
void invalidateContentRect(const IntRect& contentRect);
|
||||
void invalidateContentRect(const gfx::Rect& contentRect);
|
||||
|
||||
// Reset state on tiles that will be used for updating the layer.
|
||||
void resetUpdateState();
|
||||
|
||||
// After preparing an update, returns true if more painting is needed.
|
||||
bool needsIdlePaint();
|
||||
IntRect idlePaintRect();
|
||||
gfx::Rect idlePaintRect();
|
||||
|
||||
bool skipsDraw() const { return m_skipsDraw; }
|
||||
|
||||
@ -78,8 +78,8 @@ private:
|
||||
|
||||
bool updateTiles(int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&, bool& didPaint);
|
||||
bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions);
|
||||
IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
|
||||
void updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&);
|
||||
gfx::Rect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
|
||||
void updateTileTextures(const gfx::Rect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&);
|
||||
void updateScrollPrediction();
|
||||
|
||||
UpdatableTile* tileAt(int, int) const;
|
||||
@ -90,10 +90,10 @@ private:
|
||||
bool m_failedUpdate;
|
||||
|
||||
// Used for predictive painting.
|
||||
IntSize m_predictedScroll;
|
||||
IntRect m_predictedVisibleRect;
|
||||
IntRect m_previousVisibleRect;
|
||||
IntSize m_previousContentBounds;
|
||||
gfx::Vector2d m_predictedScroll;
|
||||
gfx::Rect m_predictedVisibleRect;
|
||||
gfx::Rect m_previousVisibleRect;
|
||||
gfx::Size m_previousContentBounds;
|
||||
|
||||
TilingOption m_tilingOption;
|
||||
scoped_ptr<LayerTilingData> m_tiler;
|
||||
|
@ -118,9 +118,9 @@ DrawableTile* TiledLayerImpl::createTile(int i, int j)
|
||||
|
||||
void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData)
|
||||
{
|
||||
const IntRect& contentRect = visibleContentRect();
|
||||
const gfx::Rect& contentRect = visibleContentRect();
|
||||
|
||||
if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty())
|
||||
if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.IsEmpty())
|
||||
return;
|
||||
|
||||
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
|
||||
@ -133,7 +133,7 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
|
||||
for (int j = top; j <= bottom; ++j) {
|
||||
for (int i = left; i <= right; ++i) {
|
||||
DrawableTile* tile = tileAt(i, j);
|
||||
IntRect tileRect = m_tiler->tileBounds(i, j);
|
||||
gfx::Rect tileRect = m_tiler->tileBounds(i, j);
|
||||
SkColor borderColor;
|
||||
|
||||
if (m_skipsDraw || !tile || !tile->resourceId())
|
||||
@ -151,12 +151,12 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
|
||||
for (int j = top; j <= bottom; ++j) {
|
||||
for (int i = left; i <= right; ++i) {
|
||||
DrawableTile* tile = tileAt(i, j);
|
||||
IntRect tileRect = m_tiler->tileBounds(i, j);
|
||||
IntRect displayRect = tileRect;
|
||||
tileRect.intersect(contentRect);
|
||||
gfx::Rect tileRect = m_tiler->tileBounds(i, j);
|
||||
gfx::Rect displayRect = tileRect;
|
||||
tileRect.Intersect(contentRect);
|
||||
|
||||
// Skip empty tiles.
|
||||
if (tileRect.isEmpty())
|
||||
if (tileRect.IsEmpty())
|
||||
continue;
|
||||
|
||||
if (!tile || !tile->resourceId()) {
|
||||
@ -177,16 +177,16 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
|
||||
continue;
|
||||
}
|
||||
|
||||
IntRect tileOpaqueRect = tile->opaqueRect();
|
||||
tileOpaqueRect.intersect(contentRect);
|
||||
gfx::Rect tileOpaqueRect = tile->opaqueRect();
|
||||
tileOpaqueRect.Intersect(contentRect);
|
||||
|
||||
// Keep track of how the top left has moved, so the texture can be
|
||||
// offset the same amount.
|
||||
IntSize displayOffset = tileRect.minXMinYCorner() - displayRect.minXMinYCorner();
|
||||
IntPoint textureOffset = m_tiler->textureOffset(i, j) + displayOffset;
|
||||
gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin();
|
||||
gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + displayOffset;
|
||||
float tileWidth = static_cast<float>(m_tiler->tileSize().width());
|
||||
float tileHeight = static_cast<float>(m_tiler->tileSize().height());
|
||||
IntSize textureSize(tileWidth, tileHeight);
|
||||
gfx::Size textureSize(tileWidth, tileHeight);
|
||||
|
||||
bool clipped = false;
|
||||
FloatQuad visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), FloatQuad(visibleContentRect()), clipped);
|
||||
@ -213,7 +213,7 @@ void TiledLayerImpl::setTilingData(const LayerTilingData& tiler)
|
||||
*m_tiler = tiler;
|
||||
}
|
||||
|
||||
void TiledLayerImpl::pushTileProperties(int i, int j, ResourceProvider::ResourceId resourceId, const IntRect& opaqueRect, bool contentsSwizzled)
|
||||
void TiledLayerImpl::pushTileProperties(int i, int j, ResourceProvider::ResourceId resourceId, const gfx::Rect& opaqueRect, bool contentsSwizzled)
|
||||
{
|
||||
DrawableTile* tile = tileAt(i, j);
|
||||
if (!tile)
|
||||
@ -229,7 +229,7 @@ void TiledLayerImpl::pushInvalidTile(int i, int j)
|
||||
if (!tile)
|
||||
tile = createTile(i, j);
|
||||
tile->setResourceId(0);
|
||||
tile->setOpaqueRect(IntRect());
|
||||
tile->setOpaqueRect(gfx::Rect());
|
||||
tile->setContentsSwizzled(false);
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ Region TiledLayerImpl::visibleContentOpaqueRegion() const
|
||||
if (m_skipsDraw)
|
||||
return Region();
|
||||
if (contentsOpaque())
|
||||
return visibleContentRect();
|
||||
return cc::IntRect(visibleContentRect());
|
||||
return m_tiler->opaqueRegionInContentRect(visibleContentRect());
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
|
||||
void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
|
||||
void setTilingData(const LayerTilingData& tiler);
|
||||
void pushTileProperties(int, int, ResourceProvider::ResourceId, const IntRect& opaqueRect, bool contentsSwizzled);
|
||||
void pushTileProperties(int, int, ResourceProvider::ResourceId, const gfx::Rect& opaqueRect, bool contentsSwizzled);
|
||||
void pushInvalidTile(int, int);
|
||||
|
||||
virtual Region visibleContentOpaqueRegion() const OVERRIDE;
|
||||
|
@ -22,14 +22,14 @@ namespace {
|
||||
|
||||
// Create a default tiled layer with textures for all tiles and a default
|
||||
// visibility of the entire layer size.
|
||||
static scoped_ptr<TiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, LayerTilingData::BorderTexelOption borderTexels)
|
||||
static scoped_ptr<TiledLayerImpl> createLayer(const gfx::Size& tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption borderTexels)
|
||||
{
|
||||
scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(1);
|
||||
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(tileSize, borderTexels);
|
||||
tiler->setBounds(layerSize);
|
||||
layer->setTilingData(*tiler);
|
||||
layer->setSkipsDraw(false);
|
||||
layer->setVisibleContentRect(IntRect(IntPoint(), layerSize));
|
||||
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layerSize));
|
||||
layer->setDrawOpacity(1);
|
||||
layer->setBounds(layerSize);
|
||||
layer->setContentBounds(layerSize);
|
||||
@ -39,7 +39,7 @@ static scoped_ptr<TiledLayerImpl> createLayer(const IntSize& tileSize, const Int
|
||||
ResourceProvider::ResourceId resourceId = 1;
|
||||
for (int i = 0; i < tiler->numTilesX(); ++i)
|
||||
for (int j = 0; j < tiler->numTilesY(); ++j)
|
||||
layer->pushTileProperties(i, j, resourceId++, IntRect(0, 0, 1, 1), false);
|
||||
layer->pushTileProperties(i, j, resourceId++, gfx::Rect(0, 0, 1, 1), false);
|
||||
|
||||
return layer.Pass();
|
||||
}
|
||||
@ -48,10 +48,10 @@ TEST(TiledLayerImplTest, emptyQuadList)
|
||||
{
|
||||
DebugScopedSetImplThread scopedImplThread;
|
||||
|
||||
const IntSize tileSize(90, 90);
|
||||
const gfx::Size tileSize(90, 90);
|
||||
const int numTilesX = 8;
|
||||
const int numTilesY = 4;
|
||||
const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
|
||||
const gfx::Size layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
|
||||
|
||||
// Verify default layer does creates quads
|
||||
{
|
||||
@ -66,7 +66,7 @@ TEST(TiledLayerImplTest, emptyQuadList)
|
||||
// Layer with empty visible layer rect produces no quads
|
||||
{
|
||||
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels);
|
||||
layer->setVisibleContentRect(IntRect());
|
||||
layer->setVisibleContentRect(gfx::Rect());
|
||||
|
||||
MockQuadCuller quadCuller;
|
||||
AppendQuadsData data;
|
||||
@ -78,7 +78,7 @@ TEST(TiledLayerImplTest, emptyQuadList)
|
||||
{
|
||||
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels);
|
||||
|
||||
IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50));
|
||||
gfx::Rect outsideBounds(gfx::Point(-100, -100), gfx::Size(50, 50));
|
||||
layer->setVisibleContentRect(outsideBounds);
|
||||
|
||||
MockQuadCuller quadCuller;
|
||||
@ -103,10 +103,10 @@ TEST(TiledLayerImplTest, checkerboarding)
|
||||
{
|
||||
DebugScopedSetImplThread scopedImplThread;
|
||||
|
||||
const IntSize tileSize(10, 10);
|
||||
const gfx::Size tileSize(10, 10);
|
||||
const int numTilesX = 2;
|
||||
const int numTilesY = 2;
|
||||
const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
|
||||
const gfx::Size layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
|
||||
|
||||
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels);
|
||||
|
||||
@ -124,7 +124,7 @@ TEST(TiledLayerImplTest, checkerboarding)
|
||||
|
||||
for (int i = 0; i < numTilesX; ++i)
|
||||
for (int j = 0; j < numTilesY; ++j)
|
||||
layer->pushTileProperties(i, j, 0, IntRect(), false);
|
||||
layer->pushTileProperties(i, j, 0, gfx::Rect(), false);
|
||||
|
||||
// All checkerboarding
|
||||
{
|
||||
@ -138,7 +138,7 @@ TEST(TiledLayerImplTest, checkerboarding)
|
||||
}
|
||||
}
|
||||
|
||||
static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, IntSize tileSize, const IntSize& layerSize, LayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect)
|
||||
static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, gfx::Size tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption borderTexelOption, const gfx::Rect& visibleContentRect)
|
||||
{
|
||||
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption);
|
||||
layer->setVisibleContentRect(visibleContentRect);
|
||||
@ -164,11 +164,11 @@ static void coverageVisibleRectOnTileBoundaries(LayerTilingData::BorderTexelOpti
|
||||
{
|
||||
DebugScopedSetImplThread scopedImplThread;
|
||||
|
||||
IntSize layerSize(1000, 1000);
|
||||
gfx::Size layerSize(1000, 1000);
|
||||
QuadList quads;
|
||||
SharedQuadStateList sharedStates;
|
||||
getQuads(quads, sharedStates, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize));
|
||||
verifyQuadsExactlyCoverRect(quads, IntRect(IntPoint(), layerSize));
|
||||
getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, borders, gfx::Rect(gfx::Point(), layerSize));
|
||||
verifyQuadsExactlyCoverRect(quads, gfx::Rect(gfx::Point(), layerSize));
|
||||
}
|
||||
WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectOnTileBoundaries);
|
||||
|
||||
@ -177,14 +177,14 @@ static void coverageVisibleRectIntersectsTiles(LayerTilingData::BorderTexelOptio
|
||||
DebugScopedSetImplThread scopedImplThread;
|
||||
|
||||
// This rect intersects the middle 3x3 of the 5x5 tiles.
|
||||
IntPoint topLeft(65, 73);
|
||||
IntPoint bottomRight(182, 198);
|
||||
IntRect visibleContentRect(topLeft, bottomRight - topLeft);
|
||||
gfx::Point topLeft(65, 73);
|
||||
gfx::Point bottomRight(182, 198);
|
||||
gfx::Rect visibleContentRect = gfx::BoundingRect(topLeft, bottomRight);
|
||||
|
||||
IntSize layerSize(250, 250);
|
||||
gfx::Size layerSize(250, 250);
|
||||
QuadList quads;
|
||||
SharedQuadStateList sharedStates;
|
||||
getQuads(quads, sharedStates, IntSize(50, 50), IntSize(250, 250), LayerTilingData::NoBorderTexels, visibleContentRect);
|
||||
getQuads(quads, sharedStates, gfx::Size(50, 50), gfx::Size(250, 250), LayerTilingData::NoBorderTexels, visibleContentRect);
|
||||
verifyQuadsExactlyCoverRect(quads, visibleContentRect);
|
||||
}
|
||||
WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles);
|
||||
@ -193,11 +193,11 @@ static void coverageVisibleRectIntersectsBounds(LayerTilingData::BorderTexelOpti
|
||||
{
|
||||
DebugScopedSetImplThread scopedImplThread;
|
||||
|
||||
IntSize layerSize(220, 210);
|
||||
IntRect visibleContentRect(IntPoint(), layerSize);
|
||||
gfx::Size layerSize(220, 210);
|
||||
gfx::Rect visibleContentRect(gfx::Point(), layerSize);
|
||||
QuadList quads;
|
||||
SharedQuadStateList sharedStates;
|
||||
getQuads(quads, sharedStates, IntSize(100, 100), layerSize, LayerTilingData::NoBorderTexels, visibleContentRect);
|
||||
getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, LayerTilingData::NoBorderTexels, visibleContentRect);
|
||||
verifyQuadsExactlyCoverRect(quads, visibleContentRect);
|
||||
}
|
||||
WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds);
|
||||
@ -206,18 +206,18 @@ TEST(TiledLayerImplTest, textureInfoForLayerNoBorders)
|
||||
{
|
||||
DebugScopedSetImplThread scopedImplThread;
|
||||
|
||||
IntSize tileSize(50, 50);
|
||||
IntSize layerSize(250, 250);
|
||||
gfx::Size tileSize(50, 50);
|
||||
gfx::Size layerSize(250, 250);
|
||||
QuadList quads;
|
||||
SharedQuadStateList sharedStates;
|
||||
getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize));
|
||||
getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, gfx::Rect(gfx::Point(), layerSize));
|
||||
|
||||
for (size_t i = 0; i < quads.size(); ++i) {
|
||||
ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i;
|
||||
TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]);
|
||||
|
||||
EXPECT_NE(quad->resourceId(), 0u) << quadString << i;
|
||||
EXPECT_EQ(quad->textureOffset(), IntPoint()) << quadString << i;
|
||||
EXPECT_EQ(quad->textureOffset(), gfx::Vector2d()) << quadString << i;
|
||||
EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i;
|
||||
EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i;
|
||||
}
|
||||
@ -227,11 +227,11 @@ TEST(TiledLayerImplTest, tileOpaqueRectForLayerNoBorders)
|
||||
{
|
||||
DebugScopedSetImplThread scopedImplThread;
|
||||
|
||||
IntSize tileSize(50, 50);
|
||||
IntSize layerSize(250, 250);
|
||||
gfx::Size tileSize(50, 50);
|
||||
gfx::Size layerSize(250, 250);
|
||||
QuadList quads;
|
||||
SharedQuadStateList sharedStates;
|
||||
getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize));
|
||||
getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, gfx::Rect(gfx::Point(), layerSize));
|
||||
|
||||
for (size_t i = 0; i < quads.size(); ++i) {
|
||||
ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "cc/test/geometry_test_utils.h"
|
||||
#include "cc/test/tiled_layer_test_common.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/gfx/rect_conversions.h"
|
||||
#include <public/WebTransformationMatrix.h>
|
||||
|
||||
using namespace cc;
|
||||
@ -170,9 +171,9 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles.
|
||||
layer->setBounds(IntSize(100, 200));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setBounds(gfx::Size(100, 200));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should have both tiles on the impl side.
|
||||
@ -180,9 +181,9 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
|
||||
EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1));
|
||||
|
||||
// Invalidates both tiles, but then only update one of them.
|
||||
layer->setBounds(IntSize(100, 200));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setBounds(gfx::Size(100, 200));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should only have the first tile since the other tile was invalidated but not painted.
|
||||
@ -198,10 +199,10 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
|
||||
m_occlusion = &occluded;
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles.
|
||||
layer->setBounds(IntSize(100, 200));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setDrawableContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setBounds(gfx::Size(100, 200));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer->setDrawableContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
|
||||
@ -213,9 +214,9 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
|
||||
EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1));
|
||||
|
||||
// Invalidates part of the top tile...
|
||||
layer->invalidateContentRect(IntRect(0, 0, 50, 50));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 50, 50));
|
||||
// ....but the area is occluded.
|
||||
occluded.setOcclusion(IntRect(0, 0, 50, 50));
|
||||
occluded.setOcclusion(cc::IntRect(0, 0, 50, 50));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
|
||||
@ -233,9 +234,9 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles.
|
||||
layer->setBounds(IntSize(100, 200));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setBounds(gfx::Size(100, 200));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should have both tiles on the impl side.
|
||||
@ -254,7 +255,7 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
|
||||
EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1));
|
||||
|
||||
// This should recreate and update one of the deleted textures.
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should have one tiles on the impl side.
|
||||
@ -269,9 +270,9 @@ TEST_F(TiledLayerTest, pushIdlePaintTiles)
|
||||
|
||||
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
|
||||
// This paints 1 visible of the 25 invalid tiles.
|
||||
layer->setBounds(IntSize(500, 500));
|
||||
layer->setVisibleContentRect(IntRect(200, 200, 100, 100));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 500, 500));
|
||||
layer->setBounds(gfx::Size(500, 500));
|
||||
layer->setVisibleContentRect(gfx::Rect(200, 200, 100, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 500, 500));
|
||||
bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
||||
// We should need idle-painting for surrounding tiles.
|
||||
EXPECT_TRUE(needsUpdate);
|
||||
@ -305,35 +306,35 @@ TEST_F(TiledLayerTest, predictivePainting)
|
||||
|
||||
// Prepainting should occur in the scroll direction first, and the
|
||||
// visible rect should be extruded only along the dominant axis.
|
||||
IntSize directions[6] = { IntSize(-10, 0),
|
||||
IntSize(10, 0),
|
||||
IntSize(0, -10),
|
||||
IntSize(0, 10),
|
||||
IntSize(10, 20),
|
||||
IntSize(-20, 10) };
|
||||
gfx::Vector2d directions[6] = { gfx::Vector2d(-10, 0),
|
||||
gfx::Vector2d(10, 0),
|
||||
gfx::Vector2d(0, -10),
|
||||
gfx::Vector2d(0, 10),
|
||||
gfx::Vector2d(10, 20),
|
||||
gfx::Vector2d(-20, 10) };
|
||||
// We should push all tiles that touch the extruded visible rect.
|
||||
IntRect pushedVisibleTiles[6] = { IntRect(2, 2, 2, 1),
|
||||
IntRect(1, 2, 2, 1),
|
||||
IntRect(2, 2, 1, 2),
|
||||
IntRect(2, 1, 1, 2),
|
||||
IntRect(2, 1, 1, 2),
|
||||
IntRect(2, 2, 2, 1) };
|
||||
gfx::Rect pushedVisibleTiles[6] = { gfx::Rect(2, 2, 2, 1),
|
||||
gfx::Rect(1, 2, 2, 1),
|
||||
gfx::Rect(2, 2, 1, 2),
|
||||
gfx::Rect(2, 1, 1, 2),
|
||||
gfx::Rect(2, 1, 1, 2),
|
||||
gfx::Rect(2, 2, 2, 1) };
|
||||
// The first pre-paint should also paint first in the scroll
|
||||
// direction so we should find one additional tile in the scroll direction.
|
||||
IntRect pushedPrepaintTiles[6] = { IntRect(2, 2, 3, 1),
|
||||
IntRect(0, 2, 3, 1),
|
||||
IntRect(2, 2, 1, 3),
|
||||
IntRect(2, 0, 1, 3),
|
||||
IntRect(2, 0, 1, 3),
|
||||
IntRect(2, 2, 3, 1) };
|
||||
gfx::Rect pushedPrepaintTiles[6] = { gfx::Rect(2, 2, 3, 1),
|
||||
gfx::Rect(0, 2, 3, 1),
|
||||
gfx::Rect(2, 2, 1, 3),
|
||||
gfx::Rect(2, 0, 1, 3),
|
||||
gfx::Rect(2, 0, 1, 3),
|
||||
gfx::Rect(2, 2, 3, 1) };
|
||||
for(int k = 0; k < 6; k++) {
|
||||
// The tile size is 100x100. Setup 5x5 tiles with one visible tile
|
||||
// in the center.
|
||||
IntSize contentBounds = IntSize(500, 500);
|
||||
IntRect contentRect = IntRect(0, 0, 500, 500);
|
||||
IntRect visibleRect = IntRect(200, 200, 100, 100);
|
||||
IntRect previousVisibleRect = IntRect(visibleRect.location() + directions[k], visibleRect.size());
|
||||
IntRect nextVisibleRect = IntRect(visibleRect.location() - directions[k], visibleRect.size());
|
||||
gfx::Size contentBounds = gfx::Size(500, 500);
|
||||
gfx::Rect contentRect = gfx::Rect(0, 0, 500, 500);
|
||||
gfx::Rect visibleRect = gfx::Rect(200, 200, 100, 100);
|
||||
gfx::Rect previousVisibleRect = gfx::Rect(visibleRect.origin() + directions[k], visibleRect.size());
|
||||
gfx::Rect nextVisibleRect = gfx::Rect(visibleRect.origin() - directions[k], visibleRect.size());
|
||||
|
||||
// Setup. Use the previousVisibleRect to setup the prediction for next frame.
|
||||
layer->setBounds(contentBounds);
|
||||
@ -348,7 +349,7 @@ TEST_F(TiledLayerTest, predictivePainting)
|
||||
needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int j = 0; j < 5; j++)
|
||||
EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedVisibleTiles[k].contains(i, j));
|
||||
EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedVisibleTiles[k].Contains(i, j));
|
||||
}
|
||||
|
||||
// Move the transform in the same direction without invalidating.
|
||||
@ -359,7 +360,7 @@ TEST_F(TiledLayerTest, predictivePainting)
|
||||
needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int j = 0; j < 5; j++)
|
||||
EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedPrepaintTiles[k].contains(i, j));
|
||||
EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedPrepaintTiles[k].Contains(i, j));
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,16 +385,16 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
|
||||
// layer2, we will fail on the third tile of layer2, and this should not leave the second tile in a bad state.
|
||||
|
||||
// This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer.
|
||||
IntRect layer1Rect(0, 0, 100, 2400);
|
||||
gfx::Rect layer1Rect(0, 0, 100, 2400);
|
||||
|
||||
// This requires 4*30000 bytes of memory.
|
||||
IntRect layer2Rect(0, 0, 100, 300);
|
||||
gfx::Rect layer2Rect(0, 0, 100, 300);
|
||||
|
||||
// Paint a single tile in layer2 so that it will idle paint.
|
||||
layer1->setBounds(layer1Rect.size());
|
||||
layer1->setVisibleContentRect(layer1Rect);
|
||||
layer2->setBounds(layer2Rect.size());
|
||||
layer2->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
||||
layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
||||
bool needsUpdate = updateAndPush(layer1.get(), layerImpl1.get(),
|
||||
layer2.get(), layerImpl2.get());
|
||||
// We should need idle-painting for both remaining tiles in layer2.
|
||||
@ -432,10 +433,10 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
|
||||
m_occlusion = &occluded;
|
||||
|
||||
// The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it.
|
||||
occluded.setOcclusion(IntRect(0, 0, 100, 100));
|
||||
occluded.setOcclusion(cc::IntRect(0, 0, 100, 100));
|
||||
|
||||
layer->setBounds(IntSize(100, 100));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
||||
layer->setBounds(gfx::Size(100, 100));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should have the prepainted tile on the impl side, but culled it during paint.
|
||||
@ -451,9 +452,9 @@ TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint)
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles.
|
||||
// However, during the paint, we invalidate one of the tiles. This should
|
||||
// not prevent the tile from being pushed.
|
||||
layer->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get());
|
||||
layer->setBounds(IntSize(100, 200));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer.get());
|
||||
layer->setBounds(gfx::Size(100, 200));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should have both tiles on the impl side.
|
||||
@ -469,11 +470,11 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
|
||||
ScopedFakeTiledLayerImpl layer2Impl(2);
|
||||
|
||||
// Invalidate a tile on layer1, during update of layer 2.
|
||||
layer2->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
|
||||
layer1->setBounds(IntSize(100, 200));
|
||||
layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer2->setBounds(IntSize(100, 200));
|
||||
layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer2->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer1.get());
|
||||
layer1->setBounds(gfx::Size(100, 200));
|
||||
layer1->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer2->setBounds(gfx::Size(100, 200));
|
||||
layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer1.get(), layer1Impl.get(),
|
||||
layer2.get(), layer2Impl.get());
|
||||
|
||||
@ -491,11 +492,11 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
|
||||
ScopedFakeTiledLayerImpl layer1Impl(1);
|
||||
ScopedFakeTiledLayerImpl layer2Impl(2);
|
||||
|
||||
layer1->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get());
|
||||
layer1->setBounds(IntSize(100, 200));
|
||||
layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer2->setBounds(IntSize(100, 200));
|
||||
layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer1->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer2.get());
|
||||
layer1->setBounds(gfx::Size(100, 200));
|
||||
layer1->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer2->setBounds(gfx::Size(100, 200));
|
||||
layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer1.get(), layer1Impl.get(),
|
||||
layer2.get(), layer2Impl.get());
|
||||
|
||||
@ -519,7 +520,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
|
||||
int layerWidth = 4 * FakeTiledLayer::tileSize().width();
|
||||
int layerHeight = 4 * FakeTiledLayer::tileSize().height();
|
||||
int memoryForLayer = layerWidth * layerHeight * 4;
|
||||
IntSize viewportSize = IntSize(layerWidth, layerHeight);
|
||||
gfx::Size viewportSize = gfx::Size(layerWidth, layerHeight);
|
||||
layerTreeHost->setViewportSize(viewportSize, viewportSize);
|
||||
|
||||
// Use 8x4 tiles to run out of memory.
|
||||
@ -532,9 +533,9 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
|
||||
// Full size layer with half being visible.
|
||||
IntSize contentBounds(layerWidth, layerHeight);
|
||||
IntRect contentRect(IntPoint::zero(), contentBounds);
|
||||
IntRect visibleRect(IntPoint::zero(), IntSize(layerWidth / 2, layerHeight));
|
||||
gfx::Size contentBounds(layerWidth, layerHeight);
|
||||
gfx::Rect contentRect(gfx::Point(), contentBounds);
|
||||
gfx::Rect visibleRect(gfx::Point(), gfx::Size(layerWidth / 2, layerHeight));
|
||||
|
||||
// Pretend the layer is animating.
|
||||
layer->setDrawTransformIsAnimating(true);
|
||||
@ -579,8 +580,8 @@ TEST_F(TiledLayerTest, idlePaintOutOfMemory)
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles.
|
||||
bool needsUpdate = false;
|
||||
layer->setBounds(IntSize(300, 300));
|
||||
layer->setVisibleContentRect(IntRect(100, 100, 100, 100));
|
||||
layer->setBounds(gfx::Size(300, 300));
|
||||
layer->setVisibleContentRect(gfx::Rect(100, 100, 100, 100));
|
||||
for (int i = 0; i < 2; i++)
|
||||
needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
@ -603,8 +604,8 @@ TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
|
||||
|
||||
// The layer's bounds are empty.
|
||||
// Empty layers don't paint or idle-paint.
|
||||
layer->setBounds(IntSize());
|
||||
layer->setVisibleContentRect(IntRect());
|
||||
layer->setBounds(gfx::Size());
|
||||
layer->setVisibleContentRect(gfx::Rect());
|
||||
bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// Empty layers don't have tiles.
|
||||
@ -624,9 +625,9 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
|
||||
// Alternate between not visible and visible.
|
||||
IntRect v(0, 0, 100, 100);
|
||||
IntRect nv(0, 0, 0, 0);
|
||||
IntRect visibleRect[10] = {nv, nv, v, v, nv, nv, v, v, nv, nv};
|
||||
gfx::Rect v(0, 0, 100, 100);
|
||||
gfx::Rect nv(0, 0, 0, 0);
|
||||
gfx::Rect visibleRect[10] = {nv, nv, v, v, nv, nv, v, v, nv, nv};
|
||||
bool invalidate[10] = {true, true, true, true, true, true, true, true, false, false };
|
||||
|
||||
// We should not have any tiles except for when the layer was visible
|
||||
@ -634,11 +635,11 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
|
||||
bool haveTile[10] = { false, false, true, true, false, false, true, true, true, true };
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
layer->setBounds(IntSize(100, 100));
|
||||
layer->setBounds(gfx::Size(100, 100));
|
||||
layer->setVisibleContentRect(visibleRect[i]);
|
||||
|
||||
if (invalidate[i])
|
||||
layer->invalidateContentRect(IntRect(0, 0, 100, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 100, 100));
|
||||
bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should never signal idle paint, as we painted the entire layer
|
||||
@ -654,8 +655,8 @@ TEST_F(TiledLayerTest, invalidateFromPrepare)
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles.
|
||||
layer->setBounds(IntSize(100, 200));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setBounds(gfx::Size(100, 200));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
|
||||
// We should have both tiles on the impl side.
|
||||
@ -669,9 +670,9 @@ TEST_F(TiledLayerTest, invalidateFromPrepare)
|
||||
EXPECT_EQ(0, layer->fakeLayerUpdater()->prepareCount());
|
||||
|
||||
// setRectToInvalidate triggers invalidateContentRect() being invoked from update.
|
||||
layer->fakeLayerUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get());
|
||||
layer->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(25, 25, 50, 50), layer.get());
|
||||
layer->fakeLayerUpdater()->clearPrepareCount();
|
||||
layer->invalidateContentRect(IntRect(0, 0, 50, 50));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 50, 50));
|
||||
updateAndPush(layer.get(), layerImpl.get());
|
||||
EXPECT_EQ(1, layer->fakeLayerUpdater()->prepareCount());
|
||||
layer->fakeLayerUpdater()->clearPrepareCount();
|
||||
@ -687,8 +688,8 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
|
||||
// layer space, not the content space.
|
||||
scoped_refptr<FakeTiledLayerWithScaledBounds> layer = make_scoped_refptr(new FakeTiledLayerWithScaledBounds(m_textureManager.get()));
|
||||
|
||||
IntRect layerBounds(0, 0, 300, 200);
|
||||
IntRect contentBounds(0, 0, 200, 250);
|
||||
gfx::Rect layerBounds(0, 0, 300, 200);
|
||||
gfx::Rect contentBounds(0, 0, 200, 250);
|
||||
|
||||
layer->setBounds(layerBounds.size());
|
||||
layer->setContentBounds(contentBounds.size());
|
||||
@ -701,7 +702,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), 0, m_stats);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->updateRect());
|
||||
updateTextures();
|
||||
|
||||
// After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
|
||||
@ -709,16 +710,16 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->invalidateContentRect(contentBounds);
|
||||
layer->update(*m_queue.get(), 0, m_stats);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(layerBounds), layer->updateRect());
|
||||
updateTextures();
|
||||
|
||||
// Partial re-paint should also be represented by the updateRect in layer space, not content space.
|
||||
IntRect partialDamage(30, 100, 10, 10);
|
||||
gfx::Rect partialDamage(30, 100, 10, 10);
|
||||
layer->invalidateContentRect(partialDamage);
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), 0, m_stats);
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->updateRect());
|
||||
}
|
||||
|
||||
TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
|
||||
@ -727,12 +728,12 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
|
||||
// Create a layer with one tile.
|
||||
layer->setBounds(IntSize(100, 100));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
||||
layer->setBounds(gfx::Size(100, 100));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
||||
|
||||
// Invalidate the entire layer.
|
||||
layer->setNeedsDisplay();
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
||||
|
||||
// Push the tiles to the impl side and check that there is exactly one.
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
@ -748,8 +749,8 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
|
||||
// Change the contents scale and verify that the content rectangle requiring painting
|
||||
// is not scaled.
|
||||
layer->setContentsScale(2);
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 200, 200));
|
||||
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 200, 200));
|
||||
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
||||
|
||||
// The impl side should get 2x2 tiles now.
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
@ -782,8 +783,8 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
|
||||
ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
|
||||
|
||||
// Create two 300 x 300 tiled layers.
|
||||
IntSize contentBounds(300, 300);
|
||||
IntRect contentRect(IntPoint::zero(), contentBounds);
|
||||
gfx::Size contentBounds(300, 300);
|
||||
gfx::Rect contentRect(gfx::Point(), contentBounds);
|
||||
|
||||
// We have enough memory for only one of the two layers.
|
||||
int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel.
|
||||
@ -794,15 +795,15 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
|
||||
|
||||
rootLayer->setBounds(contentBounds);
|
||||
rootLayer->setVisibleContentRect(contentRect);
|
||||
rootLayer->setPosition(FloatPoint(0, 0));
|
||||
rootLayer->setPosition(gfx::PointF(0, 0));
|
||||
childLayer->setBounds(contentBounds);
|
||||
childLayer->setVisibleContentRect(contentRect);
|
||||
childLayer->setPosition(FloatPoint(0, 0));
|
||||
childLayer->setPosition(gfx::PointF(0, 0));
|
||||
rootLayer->invalidateContentRect(contentRect);
|
||||
childLayer->invalidateContentRect(contentRect);
|
||||
|
||||
layerTreeHost->setRootLayer(rootLayer);
|
||||
layerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300));
|
||||
layerTreeHost->setViewportSize(gfx::Size(300, 300), gfx::Size(300, 300));
|
||||
|
||||
layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
|
||||
|
||||
@ -826,16 +827,16 @@ TEST_F(TiledLayerTest, resizeToSmaller)
|
||||
{
|
||||
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
|
||||
|
||||
layer->setBounds(IntSize(700, 700));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 700, 700));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 700, 700));
|
||||
layer->setBounds(gfx::Size(700, 700));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 700, 700));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 700, 700));
|
||||
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), 0, m_stats);
|
||||
|
||||
layer->setBounds(IntSize(200, 200));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 200, 200));
|
||||
layer->setBounds(gfx::Size(200, 200));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 200, 200));
|
||||
}
|
||||
|
||||
TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
|
||||
@ -843,9 +844,9 @@ TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
|
||||
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
|
||||
|
||||
int size = 1 << 30;
|
||||
layer->setBounds(IntSize(size, size));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 700, 700));
|
||||
layer->invalidateContentRect(IntRect(0, 0, size, size));
|
||||
layer->setBounds(gfx::Size(size, size));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 700, 700));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, size, size));
|
||||
|
||||
// Ensure no crash for bounds where size * size would overflow an int.
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
@ -863,17 +864,17 @@ TEST_F(TiledLayerTest, partialUpdates)
|
||||
ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
|
||||
|
||||
// Create one 300 x 200 tiled layer with 3 x 2 tiles.
|
||||
IntSize contentBounds(300, 200);
|
||||
IntRect contentRect(IntPoint::zero(), contentBounds);
|
||||
gfx::Size contentBounds(300, 200);
|
||||
gfx::Rect contentRect(gfx::Point(), contentBounds);
|
||||
|
||||
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
||||
layer->setBounds(contentBounds);
|
||||
layer->setPosition(FloatPoint(0, 0));
|
||||
layer->setPosition(gfx::PointF(0, 0));
|
||||
layer->setVisibleContentRect(contentRect);
|
||||
layer->invalidateContentRect(contentRect);
|
||||
|
||||
layerTreeHost->setRootLayer(layer);
|
||||
layerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200));
|
||||
layerTreeHost->setViewportSize(gfx::Size(300, 200), gfx::Size(300, 200));
|
||||
|
||||
// Full update of all 6 tiles.
|
||||
layerTreeHost->updateLayers(
|
||||
@ -891,7 +892,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
||||
layerTreeHost->commitComplete();
|
||||
|
||||
// Full update of 3 tiles and partial update of 3 tiles.
|
||||
layer->invalidateContentRect(IntRect(0, 0, 300, 150));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 300, 150));
|
||||
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
||||
{
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
@ -906,7 +907,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
||||
layerTreeHost->commitComplete();
|
||||
|
||||
// Partial update of 6 tiles.
|
||||
layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
|
||||
{
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
||||
@ -921,7 +922,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
||||
layerTreeHost->commitComplete();
|
||||
|
||||
// Checkerboard all tiles.
|
||||
layer->invalidateContentRect(IntRect(0, 0, 300, 200));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 300, 200));
|
||||
{
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
layerPushPropertiesTo(layer.get(), layerImpl.get());
|
||||
@ -929,7 +930,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
||||
layerTreeHost->commitComplete();
|
||||
|
||||
// Partial update of 6 checkerboard tiles.
|
||||
layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
|
||||
{
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
||||
@ -944,7 +945,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
||||
layerTreeHost->commitComplete();
|
||||
|
||||
// Partial update of 4 tiles.
|
||||
layer->invalidateContentRect(IntRect(50, 50, 100, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(50, 50, 100, 100));
|
||||
{
|
||||
ScopedFakeTiledLayerImpl layerImpl(1);
|
||||
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
||||
@ -967,10 +968,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion)
|
||||
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles.
|
||||
layer->setBounds(IntSize(100, 200));
|
||||
layer->setDrawableContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
||||
layer->setBounds(gfx::Size(100, 200));
|
||||
layer->setDrawableContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
||||
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
@ -985,12 +986,12 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
|
||||
|
||||
// The tile size is 100x100.
|
||||
|
||||
layer->setBounds(IntSize(600, 600));
|
||||
layer->setBounds(gfx::Size(600, 600));
|
||||
|
||||
occluded.setOcclusion(IntRect(200, 200, 300, 100));
|
||||
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
|
||||
layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
@ -1005,8 +1006,8 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
|
||||
occluded.setOcclusion(IntRect(250, 200, 300, 100));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(250, 200, 300, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
EXPECT_EQ(36-2, layer->fakeLayerUpdater()->updateCount());
|
||||
|
||||
@ -1018,8 +1019,8 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
|
||||
occluded.setOcclusion(IntRect(250, 250, 300, 100));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(250, 250, 300, 100));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
EXPECT_EQ(36, layer->fakeLayerUpdater()->updateCount());
|
||||
|
||||
@ -1035,13 +1036,13 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
|
||||
|
||||
// The tile size is 100x100.
|
||||
|
||||
layer->setBounds(IntSize(600, 600));
|
||||
layer->setBounds(gfx::Size(600, 600));
|
||||
|
||||
// The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled.
|
||||
occluded.setOcclusion(IntRect(200, 200, 300, 150));
|
||||
layer->setDrawableContentRect(IntRect(0, 0, 600, 360));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 600, 360));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
|
||||
layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 360));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 360));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
@ -1055,10 +1056,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
|
||||
layer->fakeLayerUpdater()->clearUpdateCount();
|
||||
|
||||
// Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded.
|
||||
occluded.setOcclusion(IntRect(200, 200, 300, 150));
|
||||
layer->setDrawableContentRect(IntRect(0, 0, 600, 350));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 600, 350));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
|
||||
layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 350));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 350));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
@ -1071,10 +1072,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
|
||||
layer->fakeLayerUpdater()->clearUpdateCount();
|
||||
|
||||
// Now the visible region is even smaller than the occlusion, it should have the same result.
|
||||
occluded.setOcclusion(IntRect(200, 200, 300, 150));
|
||||
layer->setDrawableContentRect(IntRect(0, 0, 600, 340));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 600, 340));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
|
||||
layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 340));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 340));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
@ -1093,12 +1094,12 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
|
||||
|
||||
// The tile size is 100x100.
|
||||
|
||||
layer->setBounds(IntSize(600, 600));
|
||||
layer->setBounds(gfx::Size(600, 600));
|
||||
|
||||
occluded.setOcclusion(IntRect(200, 200, 300, 100));
|
||||
layer->setDrawableContentRect(IntRect(0, 0, 600, 600));
|
||||
layer->setVisibleContentRect(IntRect(0, 0, 600, 600));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
|
||||
layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
@ -1133,16 +1134,16 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms)
|
||||
|
||||
// This makes sure the painting works when the occluded region (in screen space)
|
||||
// is transformed differently than the layer.
|
||||
layer->setBounds(IntSize(600, 600));
|
||||
layer->setBounds(gfx::Size(600, 600));
|
||||
WebTransformationMatrix screenTransform;
|
||||
screenTransform.scale(0.5);
|
||||
layer->setScreenSpaceTransform(screenTransform);
|
||||
layer->setDrawTransform(screenTransform);
|
||||
|
||||
occluded.setOcclusion(IntRect(100, 100, 150, 50));
|
||||
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(100, 100, 150, 50));
|
||||
layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
@ -1165,16 +1166,16 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
|
||||
// pixels, which means none should be occluded.
|
||||
layer->setContentsScale(0.5);
|
||||
EXPECT_FLOAT_EQ(layer->contentsScaleX(), layer->contentsScaleY());
|
||||
layer->setBounds(IntSize(600, 600));
|
||||
layer->setBounds(gfx::Size(600, 600));
|
||||
WebTransformationMatrix drawTransform;
|
||||
drawTransform.scale(1 / layer->contentsScaleX());
|
||||
layer->setDrawTransform(drawTransform);
|
||||
layer->setScreenSpaceTransform(drawTransform);
|
||||
|
||||
occluded.setOcclusion(IntRect(200, 200, 300, 100));
|
||||
layer->setDrawableContentRect(IntRect(IntPoint(), layer->bounds()));
|
||||
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
|
||||
layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->bounds()));
|
||||
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
@ -1192,10 +1193,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
|
||||
// This makes sure the painting works when the content space is scaled to
|
||||
// a different layer space. In this case the occluded region catches the
|
||||
// blown up tiles.
|
||||
occluded.setOcclusion(IntRect(200, 200, 300, 200));
|
||||
layer->setDrawableContentRect(IntRect(IntPoint(), layer->bounds()));
|
||||
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
occluded.setOcclusion(cc::IntRect(200, 200, 300, 200));
|
||||
layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->bounds()));
|
||||
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
@ -1213,13 +1214,12 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
|
||||
layer->setScreenSpaceTransform(screenTransform);
|
||||
layer->setDrawTransform(screenTransform);
|
||||
|
||||
occluded.setOcclusion(IntRect(100, 100, 150, 100));
|
||||
occluded.setOcclusion(cc::IntRect(100, 100, 150, 100));
|
||||
|
||||
IntRect drawableContentRect(IntPoint(), layer->bounds());
|
||||
drawableContentRect.scale(0.5);
|
||||
layer->setDrawableContentRect(drawableContentRect);
|
||||
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
||||
gfx::Rect layerBoundsRect(gfx::Point(), layer->bounds());
|
||||
layer->setDrawableContentRect(gfx::ToEnclosingRect(gfx::ScaleRect(layerBoundsRect, 0.5)));
|
||||
layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
||||
layer->setTexturePriorities(m_priorityCalculator);
|
||||
m_textureManager->prioritizeTextures();
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
@ -1237,11 +1237,11 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
|
||||
|
||||
IntRect opaquePaintRect;
|
||||
gfx::Rect opaquePaintRect;
|
||||
Region opaqueContents;
|
||||
|
||||
IntRect contentBounds = IntRect(0, 0, 100, 200);
|
||||
IntRect visibleBounds = IntRect(0, 0, 100, 150);
|
||||
gfx::Rect contentBounds = gfx::Rect(0, 0, 100, 200);
|
||||
gfx::Rect visibleBounds = gfx::Rect(0, 0, 100, 150);
|
||||
|
||||
layer->setBounds(contentBounds.size());
|
||||
layer->setDrawableContentRect(visibleBounds);
|
||||
@ -1252,7 +1252,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
m_textureManager->prioritizeTextures();
|
||||
|
||||
// If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty.
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
||||
layer->invalidateContentRect(contentBounds);
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
@ -1264,13 +1264,13 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
|
||||
|
||||
// visibleContentOpaqueRegion should match the visible part of what is painted opaque.
|
||||
opaquePaintRect = IntRect(10, 10, 90, 190);
|
||||
opaquePaintRect = gfx::Rect(10, 10, 90, 190);
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(opaquePaintRect);
|
||||
layer->invalidateContentRect(contentBounds);
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
|
||||
@ -1279,11 +1279,11 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
|
||||
|
||||
// If we paint again without invalidating, the same stuff should be opaque.
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
|
||||
@ -1293,12 +1293,12 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
|
||||
// If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should
|
||||
// not be affected.
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
||||
layer->invalidateContentRect(IntRect(0, 0, 1, 1));
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 1, 1));
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1, 1);
|
||||
@ -1308,12 +1308,12 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
|
||||
// If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still
|
||||
// not be affected.
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
||||
layer->invalidateContentRect(IntRect(10, 10, 1, 1));
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
||||
layer->invalidateContentRect(gfx::Rect(10, 10, 1, 1));
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);
|
||||
@ -1329,11 +1329,11 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
||||
|
||||
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
|
||||
|
||||
IntRect opaquePaintRect;
|
||||
gfx::Rect opaquePaintRect;
|
||||
Region opaqueContents;
|
||||
|
||||
IntRect contentBounds = IntRect(0, 0, 100, 300);
|
||||
IntRect visibleBounds = IntRect(0, 0, 100, 300);
|
||||
gfx::Rect contentBounds = gfx::Rect(0, 0, 100, 300);
|
||||
gfx::Rect visibleBounds = gfx::Rect(0, 0, 100, 300);
|
||||
|
||||
layer->setBounds(contentBounds.size());
|
||||
layer->setDrawableContentRect(visibleBounds);
|
||||
@ -1344,7 +1344,7 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
||||
m_textureManager->prioritizeTextures();
|
||||
|
||||
// Invalidates and paints the whole layer.
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
||||
layer->invalidateContentRect(contentBounds);
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
updateTextures();
|
||||
@ -1358,9 +1358,9 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
||||
|
||||
// Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle,
|
||||
// even though it is not dirty and will not be uploaded.
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
||||
layer->invalidateContentRect(IntRect(0, 0, 1, 1));
|
||||
layer->invalidateContentRect(IntRect(50, 200, 10, 10));
|
||||
layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
||||
layer->invalidateContentRect(gfx::Rect(0, 0, 1, 1));
|
||||
layer->invalidateContentRect(gfx::Rect(50, 200, 10, 10));
|
||||
layer->update(*m_queue.get(), &occluded, m_stats);
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
@ -1377,9 +1377,9 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
||||
TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
||||
{
|
||||
// Tile size is 100x100.
|
||||
IntRect rootRect(0, 0, 300, 200);
|
||||
IntRect childRect(0, 0, 300, 100);
|
||||
IntRect child2Rect(0, 100, 300, 100);
|
||||
gfx::Rect rootRect(0, 0, 300, 200);
|
||||
gfx::Rect childRect(0, 0, 300, 100);
|
||||
gfx::Rect child2Rect(0, 100, 300, 100);
|
||||
|
||||
LayerTreeSettings settings;
|
||||
FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient;
|
||||
@ -1392,26 +1392,26 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
||||
scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
||||
|
||||
root->setBounds(rootRect.size());
|
||||
root->setAnchorPoint(FloatPoint());
|
||||
root->setAnchorPoint(gfx::PointF());
|
||||
root->setDrawableContentRect(rootRect);
|
||||
root->setVisibleContentRect(rootRect);
|
||||
root->addChild(surface);
|
||||
|
||||
surface->setForceRenderSurface(true);
|
||||
surface->setAnchorPoint(FloatPoint());
|
||||
surface->setAnchorPoint(gfx::PointF());
|
||||
surface->setOpacity(0.5);
|
||||
surface->addChild(child);
|
||||
surface->addChild(child2);
|
||||
|
||||
child->setBounds(childRect.size());
|
||||
child->setAnchorPoint(FloatPoint());
|
||||
child->setPosition(childRect.location());
|
||||
child->setAnchorPoint(gfx::PointF());
|
||||
child->setPosition(childRect.origin());
|
||||
child->setVisibleContentRect(childRect);
|
||||
child->setDrawableContentRect(rootRect);
|
||||
|
||||
child2->setBounds(child2Rect.size());
|
||||
child2->setAnchorPoint(FloatPoint());
|
||||
child2->setPosition(child2Rect.location());
|
||||
child2->setAnchorPoint(gfx::PointF());
|
||||
child2->setPosition(child2Rect.origin());
|
||||
child2->setVisibleContentRect(child2Rect);
|
||||
child2->setDrawableContentRect(rootRect);
|
||||
|
||||
@ -1570,12 +1570,12 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
|
||||
{
|
||||
scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
|
||||
|
||||
IntRect layerRect(0, 0, 30, 31);
|
||||
layer->setPosition(layerRect.location());
|
||||
gfx::Rect layerRect(0, 0, 30, 31);
|
||||
layer->setPosition(layerRect.origin());
|
||||
layer->setBounds(layerRect.size());
|
||||
layer->setContentsScale(1.5);
|
||||
|
||||
IntRect contentRect(0, 0, 45, 47);
|
||||
gfx::Rect contentRect(0, 0, 45, 47);
|
||||
EXPECT_EQ(contentRect.size(), layer->contentBounds());
|
||||
layer->setVisibleContentRect(contentRect);
|
||||
layer->setDrawableContentRect(contentRect);
|
||||
@ -1587,7 +1587,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
|
||||
layer->update(*m_queue.get(), 0, m_stats);
|
||||
layer->trackingLayerPainter()->resetPaintedRect();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
|
||||
updateTextures();
|
||||
|
||||
// Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds.
|
||||
@ -1601,12 +1601,12 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
|
||||
{
|
||||
scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
|
||||
|
||||
IntRect layerRect(0, 0, 30, 31);
|
||||
layer->setPosition(layerRect.location());
|
||||
gfx::Rect layerRect(0, 0, 30, 31);
|
||||
layer->setPosition(layerRect.origin());
|
||||
layer->setBounds(layerRect.size());
|
||||
layer->setContentsScale(1.3f);
|
||||
|
||||
IntRect contentRect(IntPoint(), layer->contentBounds());
|
||||
gfx::Rect contentRect(gfx::Point(), layer->contentBounds());
|
||||
layer->setVisibleContentRect(contentRect);
|
||||
layer->setDrawableContentRect(contentRect);
|
||||
|
||||
@ -1617,7 +1617,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
|
||||
layer->update(*m_queue.get(), 0, m_stats);
|
||||
layer->trackingLayerPainter()->resetPaintedRect();
|
||||
|
||||
EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
|
||||
updateTextures();
|
||||
|
||||
// Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds.
|
||||
|
@ -228,26 +228,26 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
|
||||
layerTreeRoot->addChild(Layer::create());
|
||||
|
||||
// Pick some random properties to set. The values are not important, we're just testing that at least some properties are making it through.
|
||||
FloatPoint rootPosition = FloatPoint(2.3f, 7.4f);
|
||||
gfx::PointF rootPosition = gfx::PointF(2.3f, 7.4f);
|
||||
layerTreeRoot->setPosition(rootPosition);
|
||||
|
||||
float firstChildOpacity = 0.25f;
|
||||
layerTreeRoot->children()[0]->setOpacity(firstChildOpacity);
|
||||
|
||||
IntSize secondChildBounds = IntSize(25, 53);
|
||||
gfx::Size secondChildBounds = gfx::Size(25, 53);
|
||||
layerTreeRoot->children()[1]->setBounds(secondChildBounds);
|
||||
|
||||
scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
|
||||
expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get());
|
||||
|
||||
// Check that the property values we set on the Layer tree are reflected in the LayerImpl tree.
|
||||
FloatPoint rootLayerImplPosition = layerImplTreeRoot->position();
|
||||
gfx::PointF rootLayerImplPosition = layerImplTreeRoot->position();
|
||||
EXPECT_EQ(rootPosition.x(), rootLayerImplPosition.x());
|
||||
EXPECT_EQ(rootPosition.y(), rootLayerImplPosition.y());
|
||||
|
||||
EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity());
|
||||
|
||||
IntSize secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bounds();
|
||||
gfx::Size secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bounds();
|
||||
EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width());
|
||||
EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height());
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
|
||||
// FIXME: When we pass quads out of process, we need to double-buffer, or
|
||||
// otherwise synchonize use of all textures in the quad.
|
||||
|
||||
gfx::Rect quadRect(contentBounds());
|
||||
gfx::Rect quadRect(gfx::Point(), contentBounds());
|
||||
|
||||
switch (m_format) {
|
||||
case GL_LUMINANCE: {
|
||||
|
@ -56,7 +56,7 @@ void WebExternalTextureLayerImpl::setFlipped(bool flipped)
|
||||
|
||||
void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect)
|
||||
{
|
||||
static_cast<TextureLayer*>(m_layer->layer())->setUVRect(convert(rect));
|
||||
static_cast<TextureLayer*>(m_layer->layer())->setUVRect(rect);
|
||||
}
|
||||
|
||||
void WebExternalTextureLayerImpl::setOpaque(bool opaque)
|
||||
|
@ -89,7 +89,7 @@ int WebLayerImpl::id() const
|
||||
|
||||
void WebLayerImpl::invalidateRect(const WebFloatRect& rect)
|
||||
{
|
||||
m_layer->setNeedsDisplayRect(convert(rect));
|
||||
m_layer->setNeedsDisplayRect(rect);
|
||||
}
|
||||
|
||||
void WebLayerImpl::invalidate()
|
||||
@ -124,12 +124,12 @@ void WebLayerImpl::removeAllChildren()
|
||||
|
||||
void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchorPoint)
|
||||
{
|
||||
m_layer->setAnchorPoint(convert(anchorPoint));
|
||||
m_layer->setAnchorPoint(anchorPoint);
|
||||
}
|
||||
|
||||
WebFloatPoint WebLayerImpl::anchorPoint() const
|
||||
{
|
||||
return WebFloatPoint(m_layer->anchorPoint().x(), m_layer->anchorPoint().y());
|
||||
return m_layer->anchorPoint();
|
||||
}
|
||||
|
||||
void WebLayerImpl::setAnchorPointZ(float anchorPointZ)
|
||||
@ -144,12 +144,12 @@ float WebLayerImpl::anchorPointZ() const
|
||||
|
||||
void WebLayerImpl::setBounds(const WebSize& size)
|
||||
{
|
||||
m_layer->setBounds(convert(size));
|
||||
m_layer->setBounds(size);
|
||||
}
|
||||
|
||||
WebSize WebLayerImpl::bounds() const
|
||||
{
|
||||
return convert(m_layer->bounds());
|
||||
return m_layer->bounds();
|
||||
}
|
||||
|
||||
void WebLayerImpl::setMasksToBounds(bool masksToBounds)
|
||||
@ -194,12 +194,12 @@ bool WebLayerImpl::opaque() const
|
||||
|
||||
void WebLayerImpl::setPosition(const WebFloatPoint& position)
|
||||
{
|
||||
m_layer->setPosition(convert(position));
|
||||
m_layer->setPosition(position);
|
||||
}
|
||||
|
||||
WebFloatPoint WebLayerImpl::position() const
|
||||
{
|
||||
return WebFloatPoint(m_layer->position().x(), m_layer->position().y());
|
||||
return m_layer->position();
|
||||
}
|
||||
|
||||
void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix)
|
||||
|
@ -51,8 +51,8 @@ bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
|
||||
settings.showPaintRects = webSettings.showPaintRects;
|
||||
settings.renderVSyncEnabled = webSettings.renderVSyncEnabled;
|
||||
settings.refreshRate = webSettings.refreshRate;
|
||||
settings.defaultTileSize = convert(webSettings.defaultTileSize);
|
||||
settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize);
|
||||
settings.defaultTileSize = webSettings.defaultTileSize;
|
||||
settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize;
|
||||
m_layerTreeHost = LayerTreeHost::create(this, settings);
|
||||
if (!m_layerTreeHost.get())
|
||||
return false;
|
||||
@ -77,24 +77,24 @@ void WebLayerTreeViewImpl::clearRootLayer()
|
||||
void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize)
|
||||
{
|
||||
if (!deviceViewportSize.isEmpty())
|
||||
m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(deviceViewportSize));
|
||||
m_layerTreeHost->setViewportSize(layoutViewportSize, deviceViewportSize);
|
||||
else
|
||||
m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(layoutViewportSize));
|
||||
m_layerTreeHost->setViewportSize(layoutViewportSize, layoutViewportSize);
|
||||
}
|
||||
|
||||
WebSize WebLayerTreeViewImpl::layoutViewportSize() const
|
||||
{
|
||||
return convert(m_layerTreeHost->layoutViewportSize());
|
||||
return m_layerTreeHost->layoutViewportSize();
|
||||
}
|
||||
|
||||
WebSize WebLayerTreeViewImpl::deviceViewportSize() const
|
||||
{
|
||||
return convert(m_layerTreeHost->deviceViewportSize());
|
||||
return m_layerTreeHost->deviceViewportSize();
|
||||
}
|
||||
|
||||
WebFloatPoint WebLayerTreeViewImpl::adjustEventPointForPinchZoom(const WebFloatPoint& point) const
|
||||
{
|
||||
return convert(m_layerTreeHost->adjustEventPointForPinchZoom(convert(point)));
|
||||
return m_layerTreeHost->adjustEventPointForPinchZoom(point);
|
||||
}
|
||||
|
||||
void WebLayerTreeViewImpl::setDeviceScaleFactor(const float deviceScaleFactor)
|
||||
@ -195,9 +195,9 @@ void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const
|
||||
|
||||
void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectTable[128], int fontHeight)
|
||||
{
|
||||
IntRect asciiToRectTable[128];
|
||||
gfx::Rect asciiToRectTable[128];
|
||||
for (int i = 0; i < 128; ++i)
|
||||
asciiToRectTable[i] = convert(asciiToWebRectTable[i]);
|
||||
asciiToRectTable[i] = asciiToWebRectTable[i];
|
||||
scoped_ptr<FontAtlas> fontAtlas = FontAtlas::create(bitmap, asciiToRectTable, fontHeight);
|
||||
m_layerTreeHost->setFontAtlas(fontAtlas.Pass());
|
||||
}
|
||||
|
Reference in New Issue
Block a user