diff options
author | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 07:26:24 +0000 |
---|---|---|
committer | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 07:26:24 +0000 |
commit | 3950477db68ae090f35daadc612734f7356cd580 (patch) | |
tree | bcc1a2829304785b5e9c970377184df2bad58029 /cc | |
parent | 17e28caac4f0088c14f98424efdf0868d3d6c94c (diff) | |
download | chromium_src-3950477db68ae090f35daadc612734f7356cd580.zip chromium_src-3950477db68ae090f35daadc612734f7356cd580.tar.gz chromium_src-3950477db68ae090f35daadc612734f7356cd580.tar.bz2 |
Initialize overlay validator in GpuBrowserCompositorOutputSurface.
Plus refactor overlay transform into separate file to use the same type in cc, ozone and context_support.
BUG=
Review URL: https://codereview.chromium.org/220723006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/output/overlay_candidate.cc | 9 | ||||
-rw-r--r-- | cc/output/overlay_candidate.h | 15 | ||||
-rw-r--r-- | cc/output/overlay_strategy_single_on_top.cc | 4 | ||||
-rw-r--r-- | cc/output/overlay_unittest.cc | 4 | ||||
-rw-r--r-- | cc/test/test_context_support.cc | 11 | ||||
-rw-r--r-- | cc/test/test_context_support.h | 4 |
6 files changed, 20 insertions, 27 deletions
diff --git a/cc/output/overlay_candidate.cc b/cc/output/overlay_candidate.cc index 05a510b..63632fc 100644 --- a/cc/output/overlay_candidate.cc +++ b/cc/output/overlay_candidate.cc @@ -9,7 +9,7 @@ namespace cc { OverlayCandidate::OverlayCandidate() - : transform(NONE), + : transform(gfx::OVERLAY_TRANSFORM_NONE), format(RGBA_8888), uv_rect(0.f, 0.f, 1.f, 1.f), resource_id(0), @@ -19,13 +19,14 @@ OverlayCandidate::OverlayCandidate() OverlayCandidate::~OverlayCandidate() {} // static -OverlayCandidate::OverlayTransform OverlayCandidate::GetOverlayTransform( +gfx::OverlayTransform OverlayCandidate::GetOverlayTransform( const gfx::Transform& quad_transform, bool flipped) { if (!quad_transform.IsIdentityOrTranslation()) - return INVALID; + return gfx::OVERLAY_TRANSFORM_INVALID; - return flipped ? FLIP_VERTICAL : NONE; + return flipped ? gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL + : gfx::OVERLAY_TRANSFORM_NONE; } // static diff --git a/cc/output/overlay_candidate.h b/cc/output/overlay_candidate.h index e6883cc..9961bfd 100644 --- a/cc/output/overlay_candidate.h +++ b/cc/output/overlay_candidate.h @@ -11,23 +11,14 @@ #include "cc/base/cc_export.h" #include "cc/resources/resource_format.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/overlay_transform.h" #include "ui/gfx/transform.h" namespace cc { class CC_EXPORT OverlayCandidate { public: - enum OverlayTransform { - INVALID, - NONE, - FLIP_HORIZONTAL, - FLIP_VERTICAL, - ROTATE_90, - ROTATE_180, - ROTATE_270, - }; - - static OverlayTransform GetOverlayTransform( + static gfx::OverlayTransform GetOverlayTransform( const gfx::Transform& quad_transform, bool flipped); static gfx::Rect GetOverlayRect(const gfx::Transform& quad_transform, @@ -37,7 +28,7 @@ class CC_EXPORT OverlayCandidate { ~OverlayCandidate(); // Transformation to apply to layer during composition. - OverlayTransform transform; + gfx::OverlayTransform transform; // Format of the buffer to composite. ResourceFormat format; // Rect on the display to position the overlay to. diff --git a/cc/output/overlay_strategy_single_on_top.cc b/cc/output/overlay_strategy_single_on_top.cc index d9ac36c..405a191 100644 --- a/cc/output/overlay_strategy_single_on_top.cc +++ b/cc/output/overlay_strategy_single_on_top.cc @@ -38,9 +38,9 @@ bool OverlayStrategySingleOnTop::Attempt( return false; // Simple quads only. - OverlayCandidate::OverlayTransform overlay_transform = + gfx::OverlayTransform overlay_transform = OverlayCandidate::GetOverlayTransform(quad.quadTransform(), quad.flipped); - if (overlay_transform == OverlayCandidate::INVALID || + if (overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID || !quad.quadTransform().IsIdentityOrTranslation() || quad.needs_blending || quad.shared_quad_state->opacity != 1.f || quad.shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode || diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc index a1823c43..a6bc3d7 100644 --- a/cc/output/overlay_unittest.cc +++ b/cc/output/overlay_unittest.cc @@ -497,7 +497,7 @@ class MockOverlayScheduler { public: MOCK_METHOD5(Schedule, void(int plane_z_order, - unsigned plane_transform, + gfx::OverlayTransform plane_transform, unsigned overlay_texture_id, const gfx::Rect& display_bounds, const gfx::RectF& uv_rect)); @@ -565,7 +565,7 @@ TEST_F(GLRendererWithOverlaysTest, OverlayQuadNotDrawn) { EXPECT_CALL(*renderer_, DoDrawQuad(_, _)).Times(2); EXPECT_CALL(scheduler_, Schedule(1, - OverlayCandidate::NONE, + gfx::OVERLAY_TRANSFORM_NONE, _, kOverlayRect, BoundingRect(kUVTopLeft, kUVBottomRight))).Times(1); diff --git a/cc/test/test_context_support.cc b/cc/test/test_context_support.cc index 0e668aa..9c34d68 100644 --- a/cc/test/test_context_support.cc +++ b/cc/test/test_context_support.cc @@ -76,11 +76,12 @@ void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { weak_ptr_factory_.GetWeakPtr())); } -void TestContextSupport::ScheduleOverlayPlane(int plane_z_order, - unsigned plane_transform, - unsigned overlay_texture_id, - const gfx::Rect& display_bounds, - const gfx::RectF& uv_rect) { +void TestContextSupport::ScheduleOverlayPlane( + int plane_z_order, + gfx::OverlayTransform plane_transform, + unsigned overlay_texture_id, + const gfx::Rect& display_bounds, + const gfx::RectF& uv_rect) { if (!schedule_overlay_plane_callback_.is_null()) { schedule_overlay_plane_callback_.Run(plane_z_order, plane_transform, diff --git a/cc/test/test_context_support.h b/cc/test/test_context_support.h index 9fd5d1d..7162b21 100644 --- a/cc/test/test_context_support.h +++ b/cc/test/test_context_support.h @@ -30,7 +30,7 @@ class TestContextSupport : public gpu::ContextSupport { virtual void SetSwapBuffersCompleteCallback( const base::Closure& callback) OVERRIDE; virtual void ScheduleOverlayPlane(int plane_z_order, - unsigned plane_transform, + gfx::OverlayTransform plane_transform, unsigned overlay_texture_id, const gfx::Rect& display_bounds, const gfx::RectF& uv_rect) OVERRIDE; @@ -42,7 +42,7 @@ class TestContextSupport : public gpu::ContextSupport { const SurfaceVisibleCallback& set_visible_callback); typedef base::Callback<void(int plane_z_order, - unsigned plane_transform, + gfx::OverlayTransform plane_transform, unsigned overlay_texture_id, const gfx::Rect& display_bounds, const gfx::RectF& crop_rect)> |