diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index eafe6a622d..cdb893b0db 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -134,7 +134,7 @@ namespace android rpParams.m_videoTimer = m_videoTimer; rpParams.m_useDefaultFB = true; rpParams.m_rmParams = rmParams; - rpParams.m_primaryRC = make_shared_ptr(new android::RenderContext()); + rpParams.m_primaryRC = make_shared(); char const * suffix = 0; SetBestDensity(densityDpi, rpParams); diff --git a/base/shared_buffer_manager.cpp b/base/shared_buffer_manager.cpp index ddad9522e6..8c177ae615 100644 --- a/base/shared_buffer_manager.cpp +++ b/base/shared_buffer_manager.cpp @@ -15,7 +15,7 @@ SharedBufferManager::shared_buffer_ptr_t SharedBufferManager::reserveSharedBuffe shared_buffer_ptr_list_t & l = m_sharedBuffers[s]; if (l.empty()) - l.push_back(make_shared_ptr(new shared_buffer_t(s))); + l.push_back(make_shared(s)); shared_buffer_ptr_t res = l.front(); l.pop_front(); diff --git a/graphics/display_list_renderer.cpp b/graphics/display_list_renderer.cpp index 73943b4467..d0dc96cb25 100644 --- a/graphics/display_list_renderer.cpp +++ b/graphics/display_list_renderer.cpp @@ -123,7 +123,7 @@ namespace graphics return; if (m_displayList) - m_displayList->uploadResources(make_shared_ptr(new UploadData(resources, count, texture))); + m_displayList->uploadResources(make_shared(resources, count, texture)); else base_t::uploadResources(resources, count, texture); } @@ -199,7 +199,7 @@ namespace graphics void DisplayListRenderer::applyBlitStates() { if (m_displayList) - m_displayList->applyBlitStates(make_shared_ptr(new ApplyBlitStates())); + m_displayList->applyBlitStates(make_shared()); else base_t::applyBlitStates(); } @@ -207,7 +207,7 @@ namespace graphics void DisplayListRenderer::applyStates() { if (m_displayList) - m_displayList->applyStates(make_shared_ptr(new ApplyStates())); + m_displayList->applyStates(make_shared()); else base_t::applyStates(); } @@ -215,7 +215,7 @@ namespace graphics void DisplayListRenderer::applyVarAlfaStates() { if (m_displayList) - m_displayList->applyStates(make_shared_ptr(new ApplyStates(ApplyStates::AlfaVaringProgram))); + m_displayList->applyStates(make_shared(ApplyStates::AlfaVaringProgram)); else base_t::applyVarAlfaStates(); } @@ -223,7 +223,7 @@ namespace graphics void DisplayListRenderer::applySharpStates() { if (m_displayList) - m_displayList->applySharpStates(make_shared_ptr(new ApplySharpStates())); + m_displayList->applySharpStates(make_shared()); else base_t::applySharpStates(); } diff --git a/graphics/glyph_cache_impl.cpp b/graphics/glyph_cache_impl.cpp index 83c39bc21f..156ac9737c 100644 --- a/graphics/glyph_cache_impl.cpp +++ b/graphics/glyph_cache_impl.cpp @@ -625,7 +625,7 @@ namespace graphics FTC_Node_Unref(node, m_manager); - return make_shared_ptr(bitmap); + return shared_ptr(bitmap); } FT_Error GlyphCacheImpl::RequestFace(FTC_FaceID faceID, FT_Library library, FT_Pointer /*requestData*/, FT_Face * face) diff --git a/graphics/graphics_tests/screengl_test.cpp b/graphics/graphics_tests/screengl_test.cpp index 9c87410d71..553442ce8b 100644 --- a/graphics/graphics_tests/screengl_test.cpp +++ b/graphics/graphics_tests/screengl_test.cpp @@ -1224,7 +1224,7 @@ namespace public: void DoDraw(shared_ptr p) { - p->setOverlay(make_shared_ptr(new graphics::Overlay())); + p->setOverlay(make_shared()); p->overlay()->setCouldOverlap(false); p->drawSymbol(m2::PointD(200, 200), "current-position", graphics::EPosUnder, graphics::maxDepth); diff --git a/graphics/opengl/clipper.cpp b/graphics/opengl/clipper.cpp index 79dcea02b2..00d038db81 100644 --- a/graphics/opengl/clipper.cpp +++ b/graphics/opengl/clipper.cpp @@ -43,7 +43,7 @@ namespace graphics { m_isClippingEnabled = flag; - processCommand(make_shared_ptr(new EnableClipRect(flag))); + processCommand(make_shared(flag)); } bool Clipper::clipRectEnabled() const @@ -68,7 +68,7 @@ namespace graphics ASSERT ( m_clipRect.IsValid(), (m_clipRect) ); - processCommand(make_shared_ptr(new SetClipRect(m_clipRect))); + processCommand(make_shared(m_clipRect)); } m2::RectI const & Clipper::clipRect() const diff --git a/graphics/opengl/geometry_renderer.cpp b/graphics/opengl/geometry_renderer.cpp index 13ae10aa0f..2a588f9d5f 100644 --- a/graphics/opengl/geometry_renderer.cpp +++ b/graphics/opengl/geometry_renderer.cpp @@ -143,7 +143,7 @@ namespace graphics size_t count, shared_ptr const & texture) { - processCommand(make_shared_ptr(new UploadData(resources, count, texture))); + processCommand(make_shared(resources, count, texture)); } GeometryRenderer::DrawGeometry::DrawGeometry() @@ -366,12 +366,12 @@ namespace graphics void GeometryRenderer::applyStates() { - processCommand(make_shared_ptr(new ApplyStates())); + processCommand(make_shared()); } void GeometryRenderer::applyVarAlfaStates() { - processCommand(make_shared_ptr(new ApplyStates(ApplyStates::AlfaVaringProgram))); + processCommand(make_shared(ApplyStates::AlfaVaringProgram)); } void GeometryRenderer::ApplyBlitStates::perform() @@ -393,7 +393,7 @@ namespace graphics void GeometryRenderer::applyBlitStates() { - processCommand(make_shared_ptr(new ApplyBlitStates())); + processCommand(make_shared()); } void GeometryRenderer::ApplySharpStates::perform() @@ -435,7 +435,7 @@ namespace graphics void GeometryRenderer::applySharpStates() { - processCommand(make_shared_ptr(new ApplySharpStates())); + processCommand(make_shared()); } } } diff --git a/graphics/opengl/renderer.cpp b/graphics/opengl/renderer.cpp index b71619ad34..209202b5ce 100644 --- a/graphics/opengl/renderer.cpp +++ b/graphics/opengl/renderer.cpp @@ -72,14 +72,14 @@ namespace graphics m_frameBuffer->setRenderTarget(m_renderTarget); m_frameBuffer->setDepthBuffer(m_depthBuffer); - processCommand(make_shared_ptr(new ChangeFrameBuffer(m_frameBuffer))); + processCommand(make_shared(m_frameBuffer)); if (m_renderTarget != 0) m_renderTarget->coordMatrix(coordM); } - processCommand(make_shared_ptr(new ChangeMatrix(EProjection, coordM))); - processCommand(make_shared_ptr(new ChangeMatrix(EModelView, math::Identity()))); + processCommand(make_shared(EProjection, coordM)); + processCommand(make_shared(EModelView, math::Identity())); } bool Renderer::isRendering() const @@ -122,12 +122,12 @@ namespace graphics } if (glDiscardFramebufferFn) - processCommand(make_shared_ptr(new DiscardFramebuffer(doDiscardColor, doDiscardDepth))); + processCommand(make_shared(doDiscardColor, doDiscardDepth)); } void Renderer::copyFramebufferToImage(shared_ptr target) { - processCommand(make_shared_ptr(new CopyFramebufferToImage(target))); + processCommand(make_shared(target)); } void Renderer::endFrame() diff --git a/graphics/packets_queue.cpp b/graphics/packets_queue.cpp index db068d32c9..792745d54a 100644 --- a/graphics/packets_queue.cpp +++ b/graphics/packets_queue.cpp @@ -93,7 +93,7 @@ namespace graphics int PacketsQueue::insertFence(Packet::EType type) { int id = m_fenceManager.insertFence(); - processPacket(Packet(make_shared_ptr(new SignalFence(id, &m_fenceManager)), type)); + processPacket(Packet(make_shared(id, &m_fenceManager), type)); return id; } diff --git a/graphics/packets_queue.hpp b/graphics/packets_queue.hpp index 85a2849b6c..cd42e2c56b 100644 --- a/graphics/packets_queue.hpp +++ b/graphics/packets_queue.hpp @@ -123,7 +123,7 @@ namespace graphics template void processFn(Fn fn, bool performOnCancel = false) { - processPacket(Packet(make_shared_ptr(new FunctorCommand(fn)), Packet::ECommand)); + processPacket(Packet(make_shared>(fn), Packet::ECommand)); } template diff --git a/graphics/pipeline_manager.cpp b/graphics/pipeline_manager.cpp index 17645d0d95..7c1ddf4924 100644 --- a/graphics/pipeline_manager.cpp +++ b/graphics/pipeline_manager.cpp @@ -27,9 +27,9 @@ namespace graphics vector > v; for (unsigned i = 0; i < count; ++i) - v.push_back(make_shared_ptr(new ResourceCache(resourceManager(), - textureType, - pipelinesCount() + i))); + v.push_back(make_shared(resourceManager(), + textureType, + pipelinesCount() + i)); return reservePipelines(v, storageType, decl); } diff --git a/graphics/resource_manager.cpp b/graphics/resource_manager.cpp index 2e285eceb8..05f3d334ec 100644 --- a/graphics/resource_manager.cpp +++ b/graphics/resource_manager.cpp @@ -280,7 +280,7 @@ namespace MYTHROW(RootException, ("Invalid skin file")); string const textureFileName = m_skinBuffer.substr(i, j-i); - m_staticTextures[textureFileName] = make_shared_ptr(new TStaticTexture(textureFileName, density)); + m_staticTextures[textureFileName] = make_shared(textureFileName, density); } catch (RootException const & ex) { @@ -434,11 +434,11 @@ namespace switch (m_params.m_texRtFormat) { case Data8Bpp: - return make_shared_ptr(new gl::Texture(w, h)); + return make_shared>(w, h); case Data4Bpp: - return make_shared_ptr(new gl::Texture(w, h)); + return make_shared>(w, h); case Data565Bpp: - return make_shared_ptr(new gl::Texture(w, h)); + return make_shared>(w, h); default: MYTHROW(ResourceManagerException, ("unknown render target format")); }; diff --git a/graphics/skin_loader.cpp b/graphics/skin_loader.cpp index ec5260cb6f..3a1d15a44e 100644 --- a/graphics/skin_loader.cpp +++ b/graphics/skin_loader.cpp @@ -48,7 +48,7 @@ namespace graphics void SkinLoader::popPage() { - m_caches.push_back(make_shared_ptr(new ResourceCache(m_resourceManager, m_fileName, m_caches.size()))); + m_caches.push_back(make_shared(m_resourceManager, m_fileName, m_caches.size())); TResourceList::iterator prevIt = m_resourceList.end(); diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index 2d0ae5a298..2438c410b6 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -127,15 +127,16 @@ screen->resetDepthBuffer(); renderBuffer.reset(); - /// detaching of old render target will occur inside beginFrame + /// detaching of old render target will occur inside beginFrame screen->beginFrame(); screen->endFrame(); /// allocate the new one - renderBuffer = make_shared_ptr(new iphone::RenderBuffer(renderContext, (CAEAGLLayer*)self.layer)); + renderBuffer.reset(); + renderBuffer.reset(new iphone::RenderBuffer(renderContext, (CAEAGLLayer*)self.layer)); screen->setRenderTarget(renderBuffer); - screen->setDepthBuffer(make_shared_ptr(new graphics::gl::RenderBuffer(width, height, true))); + screen->setDepthBuffer(make_shared(width, height, true)); GetFramework().OnSize(width, height); diff --git a/iphone/Maps/Classes/PlacePageView.mm b/iphone/Maps/Classes/PlacePageView.mm index 163c2234e0..8ab5d52177 100644 --- a/iphone/Maps/Classes/PlacePageView.mm +++ b/iphone/Maps/Classes/PlacePageView.mm @@ -932,7 +932,7 @@ typedef NS_ENUM(NSUInteger, CellRow) - (shared_ptr)cachedMark { - return m_cachedMark ? m_cachedMark : make_shared_ptr(GetFramework().GetAddressMark([self pinPoint])->Copy()); + return m_cachedMark ? m_cachedMark : shared_ptr(GetFramework().GetAddressMark([self pinPoint])->Copy()); } - (void)deleteBookmark @@ -969,7 +969,7 @@ typedef NS_ENUM(NSUInteger, CellRow) m_categoryIndex = framework.LastEditedBMCategory(); size_t const bookmarkIndex = framework.GetBookmarkManager().AddBookmark(m_categoryIndex, [self pinPoint], *m_bookmarkData); - m_mark = make_shared_ptr(category->GetBookmark(bookmarkIndex)->Copy()); + m_mark.reset(category->GetBookmark(bookmarkIndex)->Copy()); } else { @@ -977,7 +977,7 @@ typedef NS_ENUM(NSUInteger, CellRow) BookmarkData data = BookmarkData([[self newBookmarkName] UTF8String], framework.LastEditedBMType()); size_t const bookmarkIndex = framework.AddBookmark(categoryIndex, [self pinPoint], data); BookmarkCategory const * category = framework.GetBmCategory(categoryIndex); - m_mark = make_shared_ptr(category->GetBookmark(bookmarkIndex)->Copy()); + m_mark.reset(category->GetBookmark(bookmarkIndex)->Copy()); } framework.ActivateUserMark([self userMark]); framework.Invalidate(); diff --git a/map/anim_phase_chain.cpp b/map/anim_phase_chain.cpp index e37cc54ab2..ca7242c66a 100644 --- a/map/anim_phase_chain.cpp +++ b/map/anim_phase_chain.cpp @@ -64,6 +64,6 @@ shared_ptr CreateDefaultPinAnim(Framework & f, double & scale) AnimPhaseChain * anim = new AnimPhaseChain(f, scale); InitDefaultPinAnim(anim); - return make_shared_ptr(anim); + return shared_ptr(anim); } diff --git a/map/navigator.cpp b/map/navigator.cpp index d91096ce1b..4c1abe13a0 100644 --- a/map/navigator.cpp +++ b/map/navigator.cpp @@ -509,7 +509,7 @@ shared_ptr Navigator::ScaleToPointAnim(m2::PointD const & pt, double bind(&Navigator::ScaleImpl, this, _1, _2, _3, _4, factor > 1, false), timeInSec); - return make_shared_ptr(anim); + return shared_ptr(anim); } bool Navigator::CheckMinScale(ScreenBase const & screen) const diff --git a/map/qgl_render_context.cpp b/map/qgl_render_context.cpp index f15f7c42e4..662c8672c0 100644 --- a/map/qgl_render_context.cpp +++ b/map/qgl_render_context.cpp @@ -47,8 +47,8 @@ namespace qt RenderContext::RenderContext(RenderContext * renderContext) { QGLFormat const format = renderContext->context()->format(); - m_parent = make_shared_ptr(new QWidget()); - m_context = shared_ptr(new QGLContext(format, m_parent.get())); + m_parent = make_shared(); + m_context = make_shared(format, m_parent.get()); bool sharedContextCreated = m_context->create(renderContext->context().get()); bool isSharing = m_context->isSharing(); ASSERT(sharedContextCreated && isSharing, ("cannot create shared opengl context")); diff --git a/map/render_policy.cpp b/map/render_policy.cpp index ec36e927b0..f2449f4900 100644 --- a/map/render_policy.cpp +++ b/map/render_policy.cpp @@ -54,7 +54,7 @@ void RenderPolicy::InitCacheScreen() cp.m_resourceManager = m_resourceManager; cp.m_renderContext = m_primaryRC; - m_cacheScreen = make_shared_ptr(CreateScreenWithParams(cp)); + m_cacheScreen.reset(CreateScreenWithParams(cp)); } graphics::Screen * RenderPolicy::CreateScreenWithParams(graphics::Screen::Params const & params) const @@ -266,7 +266,7 @@ Drawer * RenderPolicy::CreateDrawer(bool isDefaultFB, { Drawer::Params dp; - dp.m_frameBuffer = make_shared_ptr(new graphics::gl::FrameBuffer(isDefaultFB)); + dp.m_frameBuffer = make_shared(isDefaultFB); dp.m_resourceManager = m_resourceManager; dp.m_threadSlot = m_resourceManager->guiThreadSlot(); dp.m_visualScale = VisualScale(); diff --git a/map/tile_renderer.cpp b/map/tile_renderer.cpp index faa929f890..969ad53ea3 100644 --- a/map/tile_renderer.cpp +++ b/map/tile_renderer.cpp @@ -81,7 +81,7 @@ TileRenderer::TileRenderer( Drawer::Params params; params.m_resourceManager = m_resourceManager; - params.m_frameBuffer = make_shared_ptr(new graphics::gl::FrameBuffer()); + params.m_frameBuffer = make_shared(); params.m_threadSlot = m_resourceManager->renderThreadSlot(i); params.m_visualScale = visualScale; @@ -92,9 +92,9 @@ TileRenderer::TileRenderer( m_threadData[i].m_drawerParams = params; m_threadData[i].m_drawer = 0; m_threadData[i].m_threadSlot = params.m_threadSlot; - m_threadData[i].m_colorBuffer = make_shared_ptr(new graphics::gl::RenderBuffer(tileSz.first, tileSz.second, false, - m_resourceManager->params().m_rgba4RenderBuffer)); - m_threadData[i].m_depthBuffer = make_shared_ptr(new graphics::gl::RenderBuffer(tileSz.first, tileSz.second, true)); + m_threadData[i].m_colorBuffer = make_shared(tileSz.first, tileSz.second, false, + m_resourceManager->params().m_rgba4RenderBuffer); + m_threadData[i].m_depthBuffer = make_shared(tileSz.first, tileSz.second, true); } m_queue.AddInitCommand(bind(&TileRenderer::InitializeThreadGL, this, _1)); @@ -174,7 +174,7 @@ void TileRenderer::DrawTile(core::CommandsQueue::Environment const & env, frameScreen.OnSize(renderRect); - shared_ptr paintEvent = make_shared_ptr(new PaintEvent(drawer, &env)); + shared_ptr paintEvent(new PaintEvent(drawer, &env)); graphics::TTexturePool * texturePool = m_resourceManager->texturePool(graphics::ERenderTargetTexture); diff --git a/map/yopme_render_policy.cpp b/map/yopme_render_policy.cpp index 6e76721f54..553938e92b 100644 --- a/map/yopme_render_policy.cpp +++ b/map/yopme_render_policy.cpp @@ -188,7 +188,7 @@ void YopmeRP::InsertOverlayCross(m2::PointD pivot, Overlay * overlay) params.m_depth = ApiPinDepth; params.m_pivot = pivot; params.m_position = graphics::EPosCenter; - overlay->processOverlayElement(make_shared_ptr(new CrossElement(params))); + overlay->processOverlayElement(make_shared(params)); } void YopmeRP::DrawFrame(shared_ptr const & e, ScreenBase const & s) @@ -264,8 +264,8 @@ void YopmeRP::OnSize(int w, int h) { RenderPolicy::OnSize(w, h); m_offscreenDrawer->onSize(w, h); - m_offscreenDrawer->screen()->setDepthBuffer(make_shared_ptr(new gl::RenderBuffer(w, h, true))); - m_offscreenDrawer->screen()->setRenderTarget(make_shared_ptr(new gl::RenderBuffer(w, h, false))); + m_offscreenDrawer->screen()->setDepthBuffer(make_shared(w, h, true)); + m_offscreenDrawer->screen()->setRenderTarget(make_shared(w, h, false)); } void YopmeRP::SetDrawingApiPin(bool isNeed, m2::PointD const & point) diff --git a/qt_tstfrm/gui_test_widget.hpp b/qt_tstfrm/gui_test_widget.hpp index e52eb9909a..f4d017f367 100644 --- a/qt_tstfrm/gui_test_widget.hpp +++ b/qt_tstfrm/gui_test_widget.hpp @@ -66,7 +66,7 @@ public: cp.m_resourceManager = base_t::m_resourceManager; cp.m_renderContext = base_t::m_primaryContext; - m_cacheScreen = make_shared_ptr(new graphics::Screen(cp)); + m_cacheScreen.reset(new graphics::Screen(cp)); rp.m_CacheScreen = m_cacheScreen.get(); rp.m_GlyphCache = base_t::m_resourceManager->glyphCache(0); diff --git a/qt_tstfrm/tstwidgets.cpp b/qt_tstfrm/tstwidgets.cpp index 7be9eee3e5..37679e3541 100644 --- a/qt_tstfrm/tstwidgets.cpp +++ b/qt_tstfrm/tstwidgets.cpp @@ -24,7 +24,7 @@ namespace tst /// TODO: Show "Please Update Drivers" dialog and close the program. } - m_primaryContext = make_shared_ptr(new qt::gl::RenderContext(this)); + m_primaryContext.reset(new qt::gl::RenderContext(this)); graphics::ResourceManager::Params rmp; rmp.m_texFormat = graphics::Data8Bpp; @@ -125,14 +125,14 @@ namespace tst Drawer::Params params; - m_primaryFrameBuffer = make_shared_ptr(new graphics::gl::FrameBuffer(true)); + m_primaryFrameBuffer.reset(new graphics::gl::FrameBuffer(true)); params.m_frameBuffer = m_primaryFrameBuffer; params.m_resourceManager = m_resourceManager; params.m_threadSlot = m_resourceManager->guiThreadSlot(); params.m_renderContext = m_primaryContext; - m_primaryScreen = make_shared_ptr(new graphics::Screen(params)); + m_primaryScreen.reset(new graphics::Screen(params)); } void GLDrawWidget::resizeGL(int w, int h) diff --git a/search/search_query.cpp b/search/search_query.cpp index 2a1bc13446..652a281936 100644 --- a/search/search_query.cpp +++ b/search/search_query.cpp @@ -2214,7 +2214,7 @@ void Query::SearchAllInViewport(m2::RectD const & viewport, Results & res, unsig impl::PreResult2 * p = maker(FeatureID(i, offsets[i][j])); if (p && !IsResultExists(p, indV)) - indV.push_back(make_shared_ptr(p)); + indV.push_back(shared_ptr(p)); else delete p; } diff --git a/std/shared_ptr.hpp b/std/shared_ptr.hpp index 9d08b751a0..fd70c8f731 100644 --- a/std/shared_ptr.hpp +++ b/std/shared_ptr.hpp @@ -9,6 +9,7 @@ #include using std::shared_ptr; +using std::make_shared; #else @@ -19,18 +20,6 @@ using boost::static_pointer_cast; #endif -template -inline shared_ptr make_shared_ptr(T * t) -{ - return shared_ptr(t); -} - -template -inline shared_ptr make_shared_ptr(T * t, U u) -{ - return shared_ptr(t, u); -} - #ifdef DEBUG_NEW #define new DEBUG_NEW #endif