diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-08 06:26:50 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-08 06:26:50 +0000 |
commit | ac7c7f5ddf7ccddac616fd7700b020bd30446069 (patch) | |
tree | de606bdf0eda10da177b6c184762364dc09d5202 /cc/test | |
parent | 12a11e2b86333af3bf71dbcf5b61e48f3d43a5bc (diff) | |
download | chromium_src-ac7c7f5ddf7ccddac616fd7700b020bd30446069.zip chromium_src-ac7c7f5ddf7ccddac616fd7700b020bd30446069.tar.gz chromium_src-ac7c7f5ddf7ccddac616fd7700b020bd30446069.tar.bz2 |
cc: Create a Region class that wraps SkRegion, to replace use of WebCore::Region.
We create a class in cc/ called Region which provides a gfx:: type-friendly API
to SkRegion, and allows for easily swapping out region implementations in the
future if required.
During the process, I removed tests dependency on a "size()" method on Region,
that used to give the number of rects in the Region's internal representation.
Instead, we always create a Region in the tests from our expected rects, and
compare the Regions directly. We use ToString() comparisons to get useful
failure outputs, similar to the unit tests of other geometry types in ui/gfx.
This uncovered a WTF::Vector holdout in the OcclusionTracker class, which is
converted to a std::vector.
Covered by existing tests; no change in behaviour.
R=enne
BUG=147395
Review URL: https://chromiumcodereview.appspot.com/11366094
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/layer_test_common.cc | 2 | ||||
-rw-r--r-- | cc/test/occlusion_tracker_test_common.h | 9 | ||||
-rw-r--r-- | cc/test/tiled_layer_test_common.h | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index 3fe716f..d26cfc3 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -6,9 +6,9 @@ #include "cc/test/layer_test_common.h" -#include "Region.h" #include "cc/draw_quad.h" #include "cc/math_util.h" +#include "cc/region.h" #include "cc/render_pass.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/rect.h" diff --git a/cc/test/occlusion_tracker_test_common.h b/cc/test/occlusion_tracker_test_common.h index 7619ad8..8186553 100644 --- a/cc/test/occlusion_tracker_test_common.h +++ b/cc/test/occlusion_tracker_test_common.h @@ -5,7 +5,6 @@ #ifndef CC_TEST_OCCLUSION_TRACKER_TEST_COMMON_H_ #define CC_TEST_OCCLUSION_TRACKER_TEST_COMMON_H_ -#include "Region.h" #include "cc/occlusion_tracker.h" #include "cc/render_surface.h" #include "cc/render_surface_impl.h" @@ -21,11 +20,11 @@ public: { } - cc::Region occlusionInScreenSpace() const { return cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen; } - cc::Region occlusionInTargetSurface() const { return cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget; } + cc::Region occlusionInScreenSpace() const { return cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.back().occlusionInScreen; } + cc::Region occlusionInTargetSurface() const { return cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.back().occlusionInTarget; } - void setOcclusionInScreenSpace(const cc::Region& region) { cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen = region; } - void setOcclusionInTargetSurface(const cc::Region& region) { cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget = region; } + void setOcclusionInScreenSpace(const cc::Region& region) { cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.back().occlusionInScreen = region; } + void setOcclusionInTargetSurface(const cc::Region& region) { cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.back().occlusionInTarget = region; } }; typedef TestOcclusionTrackerBase<cc::Layer, cc::RenderSurface> TestOcclusionTracker; diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index 2a8875b..8079f1d 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h @@ -5,9 +5,9 @@ #ifndef CC_TEST_TILED_LAYER_TEST_COMMON_H_ #define CC_TEST_TILED_LAYER_TEST_COMMON_H_ -#include "Region.h" #include "cc/layer_updater.h" #include "cc/prioritized_resource.h" +#include "cc/region.h" #include "cc/resource_provider.h" #include "cc/resource_update_queue.h" #include "cc/texture_copier.h" |