diff options
author | weiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-16 07:51:53 +0000 |
---|---|---|
committer | weiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-16 07:51:53 +0000 |
commit | cb3203581fe6dc48fa6be548d4d662c0cb4260ae (patch) | |
tree | 296dabf33a416d07760954fa66cc8662bca56c58 | |
parent | 3ba3eb71cda723a64fe7e71ef55cc91b8291c01e (diff) | |
download | chromium_src-cb3203581fe6dc48fa6be548d4d662c0cb4260ae.zip chromium_src-cb3203581fe6dc48fa6be548d4d662c0cb4260ae.tar.gz chromium_src-cb3203581fe6dc48fa6be548d4d662c0cb4260ae.tar.bz2 |
Make DrawQuad constructors public, rm DQ::Create() function
In order to let RenderPass control allocation of DrawQuads, public DQ
constructors, and make all use of DQ::Create function to make_scoped_ptr
of public constructors.
Similar to 271683004, and follow 380893004.
BUG=344962
Review URL: https://codereview.chromium.org/398533002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283389 0039d316-1c4b-4281-b951-d872f2087c98
29 files changed, 32 insertions, 92 deletions
diff --git a/cc/quads/checkerboard_draw_quad.cc b/cc/quads/checkerboard_draw_quad.cc index 921a553..b6c5f82 100644 --- a/cc/quads/checkerboard_draw_quad.cc +++ b/cc/quads/checkerboard_draw_quad.cc @@ -11,10 +11,6 @@ namespace cc { CheckerboardDrawQuad::CheckerboardDrawQuad() : color(0) {} -scoped_ptr<CheckerboardDrawQuad> CheckerboardDrawQuad::Create() { - return make_scoped_ptr(new CheckerboardDrawQuad); -} - void CheckerboardDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect, diff --git a/cc/quads/checkerboard_draw_quad.h b/cc/quads/checkerboard_draw_quad.h index d59e53f..ffbf698 100644 --- a/cc/quads/checkerboard_draw_quad.h +++ b/cc/quads/checkerboard_draw_quad.h @@ -14,7 +14,7 @@ namespace cc { class CC_EXPORT CheckerboardDrawQuad : public DrawQuad { public: - static scoped_ptr<CheckerboardDrawQuad> Create(); + CheckerboardDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -37,7 +37,6 @@ class CC_EXPORT CheckerboardDrawQuad : public DrawQuad { private: virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; - CheckerboardDrawQuad(); }; } // namespace cc diff --git a/cc/quads/debug_border_draw_quad.cc b/cc/quads/debug_border_draw_quad.cc index 9c575aa..4254e02 100644 --- a/cc/quads/debug_border_draw_quad.cc +++ b/cc/quads/debug_border_draw_quad.cc @@ -14,10 +14,6 @@ DebugBorderDrawQuad::DebugBorderDrawQuad() width(0) { } -scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::Create() { - return make_scoped_ptr(new DebugBorderDrawQuad); -} - void DebugBorderDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect, diff --git a/cc/quads/debug_border_draw_quad.h b/cc/quads/debug_border_draw_quad.h index 2bfccc4..18dd869 100644 --- a/cc/quads/debug_border_draw_quad.h +++ b/cc/quads/debug_border_draw_quad.h @@ -14,7 +14,7 @@ namespace cc { class CC_EXPORT DebugBorderDrawQuad : public DrawQuad { public: - static scoped_ptr<DebugBorderDrawQuad> Create(); + DebugBorderDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -39,7 +39,6 @@ class CC_EXPORT DebugBorderDrawQuad : public DrawQuad { static const DebugBorderDrawQuad* MaterialCast(const DrawQuad*); private: - DebugBorderDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/io_surface_draw_quad.cc b/cc/quads/io_surface_draw_quad.cc index a7a8f69..cc3581b 100644 --- a/cc/quads/io_surface_draw_quad.cc +++ b/cc/quads/io_surface_draw_quad.cc @@ -15,10 +15,6 @@ IOSurfaceDrawQuad::IOSurfaceDrawQuad() orientation(FLIPPED) { } -scoped_ptr<IOSurfaceDrawQuad> IOSurfaceDrawQuad::Create() { - return make_scoped_ptr(new IOSurfaceDrawQuad); -} - void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, diff --git a/cc/quads/io_surface_draw_quad.h b/cc/quads/io_surface_draw_quad.h index a23e54c..988afeb 100644 --- a/cc/quads/io_surface_draw_quad.h +++ b/cc/quads/io_surface_draw_quad.h @@ -20,7 +20,7 @@ class CC_EXPORT IOSurfaceDrawQuad : public DrawQuad { ORIENTATION_LAST = UNFLIPPED }; - static scoped_ptr<IOSurfaceDrawQuad> Create(); + IOSurfaceDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -49,7 +49,6 @@ class CC_EXPORT IOSurfaceDrawQuad : public DrawQuad { static const IOSurfaceDrawQuad* MaterialCast(const DrawQuad*); private: - IOSurfaceDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/picture_draw_quad.cc b/cc/quads/picture_draw_quad.cc index 37bb07e..cb1c2c1 100644 --- a/cc/quads/picture_draw_quad.cc +++ b/cc/quads/picture_draw_quad.cc @@ -16,10 +16,6 @@ PictureDrawQuad::PictureDrawQuad() { PictureDrawQuad::~PictureDrawQuad() { } -scoped_ptr<PictureDrawQuad> PictureDrawQuad::Create() { - return make_scoped_ptr(new PictureDrawQuad); -} - void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, diff --git a/cc/quads/picture_draw_quad.h b/cc/quads/picture_draw_quad.h index ea1735f..944a8fb 100644 --- a/cc/quads/picture_draw_quad.h +++ b/cc/quads/picture_draw_quad.h @@ -19,7 +19,7 @@ namespace cc { // Used for on-demand tile rasterization. class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase { public: - static scoped_ptr<PictureDrawQuad> Create(); + PictureDrawQuad(); virtual ~PictureDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, @@ -56,7 +56,6 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase { static const PictureDrawQuad* MaterialCast(const DrawQuad* quad); private: - PictureDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h index 6b68f8d..3032f05 100644 --- a/cc/quads/render_pass.h +++ b/cc/quads/render_pass.h @@ -92,7 +92,7 @@ class CC_EXPORT RenderPass { SharedQuadState* CreateAndAppendSharedQuadState(); template <typename DrawQuadType> DrawQuadType* CreateAndAppendDrawQuad() { - scoped_ptr<DrawQuadType> draw_quad = DrawQuadType::Create(); + scoped_ptr<DrawQuadType> draw_quad = make_scoped_ptr(new DrawQuadType); quad_list.push_back(draw_quad.template PassAs<DrawQuad>()); return static_cast<DrawQuadType*>(quad_list.back()); } diff --git a/cc/quads/render_pass_draw_quad.cc b/cc/quads/render_pass_draw_quad.cc index 310ebc2..6259fdf 100644 --- a/cc/quads/render_pass_draw_quad.cc +++ b/cc/quads/render_pass_draw_quad.cc @@ -20,10 +20,6 @@ RenderPassDrawQuad::RenderPassDrawQuad() RenderPassDrawQuad::~RenderPassDrawQuad() { } -scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::Create() { - return make_scoped_ptr(new RenderPassDrawQuad); -} - void RenderPassDrawQuad::SetNew( const SharedQuadState* shared_quad_state, const gfx::Rect& rect, diff --git a/cc/quads/render_pass_draw_quad.h b/cc/quads/render_pass_draw_quad.h index 77e7088..e3d6f14 100644 --- a/cc/quads/render_pass_draw_quad.h +++ b/cc/quads/render_pass_draw_quad.h @@ -17,7 +17,7 @@ namespace cc { class CC_EXPORT RenderPassDrawQuad : public DrawQuad { public: - static scoped_ptr<RenderPassDrawQuad> Create(); + RenderPassDrawQuad(); virtual ~RenderPassDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, @@ -63,7 +63,6 @@ class CC_EXPORT RenderPassDrawQuad : public DrawQuad { static const RenderPassDrawQuad* MaterialCast(const DrawQuad*); private: - RenderPassDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/render_pass_unittest.cc b/cc/quads/render_pass_unittest.cc index 4539533..0d09694 100644 --- a/cc/quads/render_pass_unittest.cc +++ b/cc/quads/render_pass_unittest.cc @@ -212,7 +212,8 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) { SkColor()); // And a RenderPassDrawQuad for the contributing pass. - scoped_ptr<RenderPassDrawQuad> pass_quad = RenderPassDrawQuad::Create(); + scoped_ptr<RenderPassDrawQuad> pass_quad = + make_scoped_ptr(new RenderPassDrawQuad); pass_quad->SetNew(pass->shared_quad_state_list.back(), contrib_output_rect, contrib_output_rect, diff --git a/cc/quads/solid_color_draw_quad.cc b/cc/quads/solid_color_draw_quad.cc index 7c0b554..333ee17 100644 --- a/cc/quads/solid_color_draw_quad.cc +++ b/cc/quads/solid_color_draw_quad.cc @@ -12,10 +12,6 @@ namespace cc { SolidColorDrawQuad::SolidColorDrawQuad() : color(0), force_anti_aliasing_off(false) {} -scoped_ptr<SolidColorDrawQuad> SolidColorDrawQuad::Create() { - return make_scoped_ptr(new SolidColorDrawQuad); -} - void SolidColorDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect, diff --git a/cc/quads/solid_color_draw_quad.h b/cc/quads/solid_color_draw_quad.h index 4b8b9a3..1e746e0 100644 --- a/cc/quads/solid_color_draw_quad.h +++ b/cc/quads/solid_color_draw_quad.h @@ -14,7 +14,7 @@ namespace cc { class CC_EXPORT SolidColorDrawQuad : public DrawQuad { public: - static scoped_ptr<SolidColorDrawQuad> Create(); + SolidColorDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -39,7 +39,6 @@ class CC_EXPORT SolidColorDrawQuad : public DrawQuad { static const SolidColorDrawQuad* MaterialCast(const DrawQuad*); private: - SolidColorDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/stream_video_draw_quad.cc b/cc/quads/stream_video_draw_quad.cc index a9a75bc..683d4e5 100644 --- a/cc/quads/stream_video_draw_quad.cc +++ b/cc/quads/stream_video_draw_quad.cc @@ -12,10 +12,6 @@ namespace cc { StreamVideoDrawQuad::StreamVideoDrawQuad() : resource_id(0) {} -scoped_ptr<StreamVideoDrawQuad> StreamVideoDrawQuad::Create() { - return make_scoped_ptr(new StreamVideoDrawQuad); -} - void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, diff --git a/cc/quads/stream_video_draw_quad.h b/cc/quads/stream_video_draw_quad.h index bc85325..0570f31 100644 --- a/cc/quads/stream_video_draw_quad.h +++ b/cc/quads/stream_video_draw_quad.h @@ -14,7 +14,7 @@ namespace cc { class CC_EXPORT StreamVideoDrawQuad : public DrawQuad { public: - static scoped_ptr<StreamVideoDrawQuad> Create(); + StreamVideoDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -40,7 +40,6 @@ class CC_EXPORT StreamVideoDrawQuad : public DrawQuad { static const StreamVideoDrawQuad* MaterialCast(const DrawQuad*); private: - StreamVideoDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/surface_draw_quad.cc b/cc/quads/surface_draw_quad.cc index 8591261c..04645da 100644 --- a/cc/quads/surface_draw_quad.cc +++ b/cc/quads/surface_draw_quad.cc @@ -12,10 +12,6 @@ namespace cc { SurfaceDrawQuad::SurfaceDrawQuad() { } -scoped_ptr<SurfaceDrawQuad> SurfaceDrawQuad::Create() { - return make_scoped_ptr(new SurfaceDrawQuad); -} - void SurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect, diff --git a/cc/quads/surface_draw_quad.h b/cc/quads/surface_draw_quad.h index e182ea3..7b22ed5 100644 --- a/cc/quads/surface_draw_quad.h +++ b/cc/quads/surface_draw_quad.h @@ -14,7 +14,7 @@ namespace cc { class CC_EXPORT SurfaceDrawQuad : public DrawQuad { public: - static scoped_ptr<SurfaceDrawQuad> Create(); + SurfaceDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -36,7 +36,6 @@ class CC_EXPORT SurfaceDrawQuad : public DrawQuad { static const SurfaceDrawQuad* MaterialCast(const DrawQuad* quad); private: - SurfaceDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/texture_draw_quad.cc b/cc/quads/texture_draw_quad.cc index fd57feb..6637e4f 100644 --- a/cc/quads/texture_draw_quad.cc +++ b/cc/quads/texture_draw_quad.cc @@ -22,10 +22,6 @@ TextureDrawQuad::TextureDrawQuad() this->vertex_opacity[3] = 0.f; } -scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() { - return make_scoped_ptr(new TextureDrawQuad); -} - void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, diff --git a/cc/quads/texture_draw_quad.h b/cc/quads/texture_draw_quad.h index 7fba634..409679b 100644 --- a/cc/quads/texture_draw_quad.h +++ b/cc/quads/texture_draw_quad.h @@ -14,7 +14,7 @@ namespace cc { class CC_EXPORT TextureDrawQuad : public DrawQuad { public: - static scoped_ptr<TextureDrawQuad> Create(); + TextureDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -55,7 +55,6 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad { static const TextureDrawQuad* MaterialCast(const DrawQuad*); private: - TextureDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/tile_draw_quad.cc b/cc/quads/tile_draw_quad.cc index 6e28607..839f0de 100644 --- a/cc/quads/tile_draw_quad.cc +++ b/cc/quads/tile_draw_quad.cc @@ -17,10 +17,6 @@ TileDrawQuad::TileDrawQuad() TileDrawQuad::~TileDrawQuad() { } -scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { - return make_scoped_ptr(new TileDrawQuad); -} - void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, diff --git a/cc/quads/tile_draw_quad.h b/cc/quads/tile_draw_quad.h index 71911ea..2d3c2ee 100644 --- a/cc/quads/tile_draw_quad.h +++ b/cc/quads/tile_draw_quad.h @@ -11,7 +11,7 @@ namespace cc { class CC_EXPORT TileDrawQuad : public ContentDrawQuadBase { public: - static scoped_ptr<TileDrawQuad> Create(); + TileDrawQuad(); virtual ~TileDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, @@ -41,7 +41,6 @@ class CC_EXPORT TileDrawQuad : public ContentDrawQuadBase { static const TileDrawQuad* MaterialCast(const DrawQuad*); private: - TileDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/cc/quads/yuv_video_draw_quad.cc b/cc/quads/yuv_video_draw_quad.cc index bb8ec73..d2443ba 100644 --- a/cc/quads/yuv_video_draw_quad.cc +++ b/cc/quads/yuv_video_draw_quad.cc @@ -17,10 +17,6 @@ YUVVideoDrawQuad::YUVVideoDrawQuad() a_plane_resource_id(0) {} YUVVideoDrawQuad::~YUVVideoDrawQuad() {} -scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { - return make_scoped_ptr(new YUVVideoDrawQuad); -} - void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, diff --git a/cc/quads/yuv_video_draw_quad.h b/cc/quads/yuv_video_draw_quad.h index c95681f..93975d7 100644 --- a/cc/quads/yuv_video_draw_quad.h +++ b/cc/quads/yuv_video_draw_quad.h @@ -23,7 +23,7 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { virtual ~YUVVideoDrawQuad(); - static scoped_ptr<YUVVideoDrawQuad> Create(); + YUVVideoDrawQuad(); void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -61,7 +61,6 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { static const YUVVideoDrawQuad* MaterialCast(const DrawQuad*); private: - YUVVideoDrawQuad(); virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE; }; diff --git a/content/common/cc_messages.cc b/content/common/cc_messages.cc index 4750061..1e2d741 100644 --- a/content/common/cc_messages.cc +++ b/content/common/cc_messages.cc @@ -395,7 +395,7 @@ static size_t ReserveSizeForRenderPassWrite(const cc::RenderPass& p) { template<typename QuadType> static scoped_ptr<cc::DrawQuad> ReadDrawQuad(const Message* m, PickleIterator* iter) { - scoped_ptr<QuadType> quad = QuadType::Create(); + scoped_ptr<QuadType> quad(new QuadType); if (!ReadParam(m, iter, quad.get())) return scoped_ptr<QuadType>().template PassAs<cc::DrawQuad>(); return quad.template PassAs<cc::DrawQuad>(); diff --git a/mojo/examples/surfaces_app/child_impl.cc b/mojo/examples/surfaces_app/child_impl.cc index 52118f0..2d5140a 100644 --- a/mojo/examples/surfaces_app/child_impl.cc +++ b/mojo/examples/surfaces_app/child_impl.cc @@ -85,14 +85,14 @@ void ChildImpl::Draw() { CreateAndAppendSimpleSharedQuadState(pass.get(), gfx::Transform(), size_); - scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); + SolidColorDrawQuad* color_quad = + pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); bool force_anti_aliasing_off = false; color_quad->SetNew(pass->shared_quad_state_list.back(), rect, rect, color_, force_anti_aliasing_off); - pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); delegated_frame_data->render_pass_list.push_back(pass.Pass()); diff --git a/mojo/examples/surfaces_app/embedder.cc b/mojo/examples/surfaces_app/embedder.cc index a525a18..1a620d0 100644 --- a/mojo/examples/surfaces_app/embedder.cc +++ b/mojo/examples/surfaces_app/embedder.cc @@ -49,11 +49,11 @@ void Embedder::ProduceFrame(cc::SurfaceId child_one, one_transform.Translate(-child_size.width() / 2, -child_size.height() / 2); CreateAndAppendSimpleSharedQuadState(pass.get(), one_transform, size); - scoped_ptr<SurfaceDrawQuad> surface_one_quad = SurfaceDrawQuad::Create(); + SurfaceDrawQuad* surface_one_quad = + pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); gfx::Rect one_rect(child_size); surface_one_quad->SetNew( pass->shared_quad_state_list.back(), one_rect, one_rect, child_one); - pass->quad_list.push_back(surface_one_quad.PassAs<DrawQuad>()); gfx::Transform two_transform; two_transform.Translate(10 + size.width() / 2 + child_size.width() / 2, @@ -62,21 +62,21 @@ void Embedder::ProduceFrame(cc::SurfaceId child_one, two_transform.Translate(-child_size.width() / 2, -child_size.height() / 2); CreateAndAppendSimpleSharedQuadState(pass.get(), two_transform, size); - scoped_ptr<SurfaceDrawQuad> surface_two_quad = SurfaceDrawQuad::Create(); + SurfaceDrawQuad* surface_two_quad = + pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); gfx::Rect two_rect(child_size); surface_two_quad->SetNew( pass->shared_quad_state_list.back(), two_rect, two_rect, child_two); - pass->quad_list.push_back(surface_two_quad.PassAs<DrawQuad>()); CreateAndAppendSimpleSharedQuadState(pass.get(), gfx::Transform(), size); - scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); + SolidColorDrawQuad* color_quad = + pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); bool force_anti_aliasing_off = false; color_quad->SetNew(pass->shared_quad_state_list.back(), rect, rect, SK_ColorYELLOW, force_anti_aliasing_off); - pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); delegated_frame_data->render_pass_list.push_back(pass.Pass()); diff --git a/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc b/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc index e61ad94..16527f6 100644 --- a/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc +++ b/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc @@ -113,8 +113,7 @@ scoped_ptr<cc::DrawQuad> ConvertTo(const surfaces::QuadPtr& input, cc::SharedQuadState* sqs) { switch (input->material) { case surfaces::SOLID_COLOR: { - scoped_ptr<cc::SolidColorDrawQuad> color_quad = - cc::SolidColorDrawQuad::Create(); + scoped_ptr<cc::SolidColorDrawQuad> color_quad(new cc::SolidColorDrawQuad); color_quad->SetAll( sqs, input->rect.To<gfx::Rect>(), @@ -126,8 +125,7 @@ scoped_ptr<cc::DrawQuad> ConvertTo(const surfaces::QuadPtr& input, return color_quad.PassAs<cc::DrawQuad>(); } case surfaces::SURFACE_CONTENT: { - scoped_ptr<cc::SurfaceDrawQuad> surface_quad = - cc::SurfaceDrawQuad::Create(); + scoped_ptr<cc::SurfaceDrawQuad> surface_quad(new cc::SurfaceDrawQuad); surface_quad->SetAll( sqs, input->rect.To<gfx::Rect>(), @@ -138,8 +136,7 @@ scoped_ptr<cc::DrawQuad> ConvertTo(const surfaces::QuadPtr& input, return surface_quad.PassAs<cc::DrawQuad>(); } case surfaces::TEXTURE_CONTENT: { - scoped_ptr<cc::TextureDrawQuad> texture_quad = - cc::TextureDrawQuad::Create(); + scoped_ptr<cc::TextureDrawQuad> texture_quad(new cc::TextureDrawQuad); surfaces::TextureQuadStatePtr& texture_quad_state = input->texture_quad_state; texture_quad->SetAll( diff --git a/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc b/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc index 9a39126..5c2f98f 100644 --- a/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc +++ b/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc @@ -56,8 +56,7 @@ class SurfaceLibQuadTest : public testing::Test { }; TEST_F(SurfaceLibQuadTest, ColorQuad) { - scoped_ptr<cc::SolidColorDrawQuad> color_quad = - cc::SolidColorDrawQuad::Create(); + scoped_ptr<cc::SolidColorDrawQuad> color_quad(new cc::SolidColorDrawQuad); SkColor arbitrary_color = SK_ColorGREEN; bool force_anti_aliasing_off = true; color_quad->SetAll(sqs.get(), @@ -97,7 +96,7 @@ TEST_F(SurfaceLibQuadTest, ColorQuad) { } TEST_F(SurfaceLibQuadTest, SurfaceQuad) { - scoped_ptr<cc::SurfaceDrawQuad> surface_quad = cc::SurfaceDrawQuad::Create(); + scoped_ptr<cc::SurfaceDrawQuad> surface_quad(new cc::SurfaceDrawQuad); cc::SurfaceId arbitrary_id(5); surface_quad->SetAll( sqs.get(), rect, opaque_rect, visible_rect, needs_blending, arbitrary_id); @@ -120,7 +119,7 @@ TEST_F(SurfaceLibQuadTest, SurfaceQuad) { } TEST_F(SurfaceLibQuadTest, TextureQuad) { - scoped_ptr<cc::TextureDrawQuad> texture_quad = cc::TextureDrawQuad::Create(); + scoped_ptr<cc::TextureDrawQuad> texture_quad(new cc::TextureDrawQuad); unsigned resource_id = 9; bool premultiplied_alpha = true; gfx::PointF uv_top_left(1.7f, 2.1f); @@ -241,7 +240,7 @@ TEST_F(SurfaceLibQuadTest, RenderPass) { float opacity = 0.65f; int sorting_context_id = 13; SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; - scoped_ptr<cc::SharedQuadState> sqs(new cc::SharedQuadState); + cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); sqs->SetAll(content_to_target_transform, content_bounds, visible_content_rect, @@ -250,10 +249,9 @@ TEST_F(SurfaceLibQuadTest, RenderPass) { opacity, blend_mode, sorting_context_id); - pass->shared_quad_state_list.push_back(sqs.Pass()); - scoped_ptr<cc::SolidColorDrawQuad> color_quad = - cc::SolidColorDrawQuad::Create(); + cc::SolidColorDrawQuad* color_quad = + pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); SkColor arbitrary_color = SK_ColorGREEN; bool force_anti_aliasing_off = true; color_quad->SetAll(pass->shared_quad_state_list.back(), @@ -263,7 +261,6 @@ TEST_F(SurfaceLibQuadTest, RenderPass) { needs_blending, arbitrary_color, force_anti_aliasing_off); - pass->quad_list.push_back(color_quad.PassAs<cc::DrawQuad>()); surfaces::PassPtr mojo_pass = surfaces::Pass::From(*pass); ASSERT_FALSE(mojo_pass.is_null()); |