diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture.cpp | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture.cpp | 302 |
1 files changed, 151 insertions, 151 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture.cpp index b446e7d..cb61374 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture.cpp | |||
@@ -1,151 +1,151 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #include "IrrCompileConfig.h" | 5 | #include "IrrCompileConfig.h" |
6 | #ifdef _IRR_COMPILE_WITH_SOFTWARE_ | 6 | #ifdef _IRR_COMPILE_WITH_SOFTWARE_ |
7 | 7 | ||
8 | #include "CSoftwareTexture.h" | 8 | #include "CSoftwareTexture.h" |
9 | #include "os.h" | 9 | #include "os.h" |
10 | 10 | ||
11 | namespace irr | 11 | namespace irr |
12 | { | 12 | { |
13 | namespace video | 13 | namespace video |
14 | { | 14 | { |
15 | 15 | ||
16 | //! constructor | 16 | //! constructor |
17 | CSoftwareTexture::CSoftwareTexture(IImage* image, const io::path& name, | 17 | CSoftwareTexture::CSoftwareTexture(IImage* image, const io::path& name, |
18 | bool renderTarget, void* mipmapData) | 18 | bool renderTarget, void* mipmapData) |
19 | : ITexture(name), Texture(0), IsRenderTarget(renderTarget) | 19 | : ITexture(name), Texture(0), IsRenderTarget(renderTarget) |
20 | { | 20 | { |
21 | #ifdef _DEBUG | 21 | #ifdef _DEBUG |
22 | setDebugName("CSoftwareTexture"); | 22 | setDebugName("CSoftwareTexture"); |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | if (image) | 25 | if (image) |
26 | { | 26 | { |
27 | OrigSize = image->getDimension(); | 27 | OrigSize = image->getDimension(); |
28 | core::dimension2d<u32> optSize=OrigSize.getOptimalSize(); | 28 | core::dimension2d<u32> optSize=OrigSize.getOptimalSize(); |
29 | 29 | ||
30 | Image = new CImage(ECF_A1R5G5B5, OrigSize); | 30 | Image = new CImage(ECF_A1R5G5B5, OrigSize); |
31 | image->copyTo(Image); | 31 | image->copyTo(Image); |
32 | 32 | ||
33 | if (optSize == OrigSize) | 33 | if (optSize == OrigSize) |
34 | { | 34 | { |
35 | Texture = Image; | 35 | Texture = Image; |
36 | Texture->grab(); | 36 | Texture->grab(); |
37 | } | 37 | } |
38 | else | 38 | else |
39 | { | 39 | { |
40 | Texture = new CImage(ECF_A1R5G5B5, optSize); | 40 | Texture = new CImage(ECF_A1R5G5B5, optSize); |
41 | Image->copyToScaling(Texture); | 41 | Image->copyToScaling(Texture); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | //! destructor | 48 | //! destructor |
49 | CSoftwareTexture::~CSoftwareTexture() | 49 | CSoftwareTexture::~CSoftwareTexture() |
50 | { | 50 | { |
51 | if (Image) | 51 | if (Image) |
52 | Image->drop(); | 52 | Image->drop(); |
53 | 53 | ||
54 | if (Texture) | 54 | if (Texture) |
55 | Texture->drop(); | 55 | Texture->drop(); |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | //! lock function | 60 | //! lock function |
61 | void* CSoftwareTexture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel) | 61 | void* CSoftwareTexture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel) |
62 | { | 62 | { |
63 | return Image->lock(); | 63 | return Image->lock(); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | //! unlock function | 68 | //! unlock function |
69 | void CSoftwareTexture::unlock() | 69 | void CSoftwareTexture::unlock() |
70 | { | 70 | { |
71 | if (Image != Texture) | 71 | if (Image != Texture) |
72 | { | 72 | { |
73 | os::Printer::log("Performance warning, slow unlock of non power of 2 texture.", ELL_WARNING); | 73 | os::Printer::log("Performance warning, slow unlock of non power of 2 texture.", ELL_WARNING); |
74 | Image->copyToScaling(Texture); | 74 | Image->copyToScaling(Texture); |
75 | } | 75 | } |
76 | 76 | ||
77 | Image->unlock(); | 77 | Image->unlock(); |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | //! Returns original size of the texture. | 81 | //! Returns original size of the texture. |
82 | const core::dimension2d<u32>& CSoftwareTexture::getOriginalSize() const | 82 | const core::dimension2d<u32>& CSoftwareTexture::getOriginalSize() const |
83 | { | 83 | { |
84 | return OrigSize; | 84 | return OrigSize; |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | //! Returns (=size) of the texture. | 88 | //! Returns (=size) of the texture. |
89 | const core::dimension2d<u32>& CSoftwareTexture::getSize() const | 89 | const core::dimension2d<u32>& CSoftwareTexture::getSize() const |
90 | { | 90 | { |
91 | return Image->getDimension(); | 91 | return Image->getDimension(); |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | //! returns unoptimized surface | 95 | //! returns unoptimized surface |
96 | CImage* CSoftwareTexture::getImage() | 96 | CImage* CSoftwareTexture::getImage() |
97 | { | 97 | { |
98 | return Image; | 98 | return Image; |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | //! returns texture surface | 103 | //! returns texture surface |
104 | CImage* CSoftwareTexture::getTexture() | 104 | CImage* CSoftwareTexture::getTexture() |
105 | { | 105 | { |
106 | return Texture; | 106 | return Texture; |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | //! returns driver type of texture (=the driver, who created the texture) | 111 | //! returns driver type of texture (=the driver, who created the texture) |
112 | E_DRIVER_TYPE CSoftwareTexture::getDriverType() const | 112 | E_DRIVER_TYPE CSoftwareTexture::getDriverType() const |
113 | { | 113 | { |
114 | return EDT_SOFTWARE; | 114 | return EDT_SOFTWARE; |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | //! returns color format of texture | 119 | //! returns color format of texture |
120 | ECOLOR_FORMAT CSoftwareTexture::getColorFormat() const | 120 | ECOLOR_FORMAT CSoftwareTexture::getColorFormat() const |
121 | { | 121 | { |
122 | return ECF_A1R5G5B5; | 122 | return ECF_A1R5G5B5; |
123 | } | 123 | } |
124 | 124 | ||
125 | 125 | ||
126 | 126 | ||
127 | //! returns pitch of texture (in bytes) | 127 | //! returns pitch of texture (in bytes) |
128 | u32 CSoftwareTexture::getPitch() const | 128 | u32 CSoftwareTexture::getPitch() const |
129 | { | 129 | { |
130 | return Image->getDimension().Width * 2; | 130 | return Image->getDimension().Width * 2; |
131 | } | 131 | } |
132 | 132 | ||
133 | 133 | ||
134 | //! Regenerates the mip map levels of the texture. Useful after locking and | 134 | //! Regenerates the mip map levels of the texture. Useful after locking and |
135 | //! modifying the texture | 135 | //! modifying the texture |
136 | void CSoftwareTexture::regenerateMipMapLevels(void* mipmapData) | 136 | void CSoftwareTexture::regenerateMipMapLevels(void* mipmapData) |
137 | { | 137 | { |
138 | // our software textures don't have mip maps | 138 | // our software textures don't have mip maps |
139 | } | 139 | } |
140 | 140 | ||
141 | bool CSoftwareTexture::isRenderTarget() const | 141 | bool CSoftwareTexture::isRenderTarget() const |
142 | { | 142 | { |
143 | return IsRenderTarget; | 143 | return IsRenderTarget; |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | } // end namespace video | 147 | } // end namespace video |
148 | } // end namespace irr | 148 | } // end namespace irr |
149 | 149 | ||
150 | #endif // _IRR_COMPILE_WITH_SOFTWARE_ | 150 | #endif // _IRR_COMPILE_WITH_SOFTWARE_ |
151 | 151 | ||