OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 } | 1656 } |
1657 | 1657 |
1658 // Attempts to create a Texture2D with the given specs. If creation fails | 1658 // Attempts to create a Texture2D with the given specs. If creation fails |
1659 // then the method returns NULL. | 1659 // then the method returns NULL. |
1660 Texture2D::Ref RendererD3D9::CreatePlatformSpecificTexture2D( | 1660 Texture2D::Ref RendererD3D9::CreatePlatformSpecificTexture2D( |
1661 int width, | 1661 int width, |
1662 int height, | 1662 int height, |
1663 Texture::Format format, | 1663 Texture::Format format, |
1664 int levels, | 1664 int levels, |
1665 bool enable_render_surfaces) { | 1665 bool enable_render_surfaces) { |
1666 Bitmap bitmap; | 1666 Bitmap::Ref bitmap = Bitmap::Ref(new Bitmap(service_locator())); |
1667 bitmap.set_format(format); | 1667 bitmap->set_format(format); |
1668 bitmap.set_width(width); | 1668 bitmap->set_width(width); |
1669 bitmap.set_height(height); | 1669 bitmap->set_height(height); |
1670 bitmap.set_num_mipmaps(levels); | 1670 bitmap->set_num_mipmaps(levels); |
1671 return Texture2D::Ref(Texture2DD3D9::Create(service_locator(), | 1671 return Texture2D::Ref(Texture2DD3D9::Create(service_locator(), |
1672 &bitmap, | 1672 bitmap, |
1673 this, | 1673 this, |
1674 enable_render_surfaces)); | 1674 enable_render_surfaces)); |
1675 } | 1675 } |
1676 | 1676 |
1677 // Attempts to create a Texture2D with the given specs. If creation fails | 1677 // Attempts to create a Texture2D with the given specs. If creation fails |
1678 // then the method returns NULL. | 1678 // then the method returns NULL. |
1679 TextureCUBE::Ref RendererD3D9::CreatePlatformSpecificTextureCUBE( | 1679 TextureCUBE::Ref RendererD3D9::CreatePlatformSpecificTextureCUBE( |
1680 int edge_length, | 1680 int edge_length, |
1681 Texture::Format format, | 1681 Texture::Format format, |
1682 int levels, | 1682 int levels, |
1683 bool enable_render_surfaces) { | 1683 bool enable_render_surfaces) { |
1684 Bitmap bitmap; | 1684 Bitmap::Ref bitmap = Bitmap::Ref(new Bitmap(service_locator())); |
1685 bitmap.set_format(format); | 1685 bitmap->set_format(format); |
1686 bitmap.set_width(edge_length); | 1686 bitmap->set_width(edge_length); |
1687 bitmap.set_height(edge_length); | 1687 bitmap->set_height(edge_length); |
1688 bitmap.set_num_mipmaps(levels); | 1688 bitmap->set_num_mipmaps(levels); |
1689 bitmap.set_is_cubemap(true); | 1689 bitmap->set_is_cubemap(true); |
1690 return TextureCUBE::Ref(TextureCUBED3D9::Create(service_locator(), | 1690 return TextureCUBE::Ref(TextureCUBED3D9::Create(service_locator(), |
1691 &bitmap, | 1691 bitmap, |
1692 this, | 1692 this, |
1693 enable_render_surfaces)); | 1693 enable_render_surfaces)); |
1694 } | 1694 } |
1695 | 1695 |
1696 RenderDepthStencilSurface::Ref RendererD3D9::CreateDepthStencilSurface( | 1696 RenderDepthStencilSurface::Ref RendererD3D9::CreateDepthStencilSurface( |
1697 int width, | 1697 int width, |
1698 int height) { | 1698 int height) { |
1699 DepthStencilSurfaceConstructor *depth_constructor = | 1699 DepthStencilSurfaceConstructor *depth_constructor = |
1700 new DepthStencilSurfaceConstructor(service_locator(), width, height); | 1700 new DepthStencilSurfaceConstructor(service_locator(), width, height); |
1701 | 1701 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 static int swizzle_table[] = { 2, 1, 0, 3, }; | 1781 static int swizzle_table[] = { 2, 1, 0, 3, }; |
1782 return swizzle_table; | 1782 return swizzle_table; |
1783 } | 1783 } |
1784 | 1784 |
1785 // This is a factory function for creating Renderer objects. Since | 1785 // This is a factory function for creating Renderer objects. Since |
1786 // we're implementing D3D9, we only ever return a D3D9 renderer. | 1786 // we're implementing D3D9, we only ever return a D3D9 renderer. |
1787 Renderer* Renderer::CreateDefaultRenderer(ServiceLocator* service_locator) { | 1787 Renderer* Renderer::CreateDefaultRenderer(ServiceLocator* service_locator) { |
1788 return RendererD3D9::CreateDefault(service_locator); | 1788 return RendererD3D9::CreateDefault(service_locator); |
1789 } | 1789 } |
1790 } // namespace o3d | 1790 } // namespace o3d |
OLD | NEW |