Mercurial > hg > orthanc
comparison UnitTestsSources/Png.cpp @ 797:37adac56017a
ImageAccessor abstraction
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 May 2014 12:47:26 +0200 |
parents | 8f62e8d5a384 |
children | 777b6b694da6 |
comparison
equal
deleted
inserted
replaced
796:e7b1ca0f1e04 | 797:37adac56017a |
---|---|
117 ASSERT_EQ(r.GetHeight(), height); | 117 ASSERT_EQ(r.GetHeight(), height); |
118 | 118 |
119 v = 0; | 119 v = 0; |
120 for (int y = 0; y < height; y++) | 120 for (int y = 0; y < height; y++) |
121 { | 121 { |
122 uint16_t *p = reinterpret_cast<uint16_t*>((uint8_t*) r.GetBuffer() + y * r.GetPitch()); | 122 const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r.GetConstBuffer() + y * r.GetPitch()); |
123 ASSERT_EQ(p, r.GetBuffer(y)); | 123 ASSERT_EQ(p, r.GetConstRow(y)); |
124 for (int x = 0; x < width; x++, p++, v++) | 124 for (int x = 0; x < width; x++, p++, v++) |
125 { | 125 { |
126 ASSERT_EQ(*p, v); | 126 ASSERT_EQ(*p, v); |
127 } | 127 } |
128 } | 128 } |
140 ASSERT_EQ(r2.GetHeight(), height); | 140 ASSERT_EQ(r2.GetHeight(), height); |
141 | 141 |
142 v = 0; | 142 v = 0; |
143 for (int y = 0; y < height; y++) | 143 for (int y = 0; y < height; y++) |
144 { | 144 { |
145 uint16_t *p = reinterpret_cast<uint16_t*>((uint8_t*) r2.GetBuffer() + y * r2.GetPitch()); | 145 const uint16_t *p = reinterpret_cast<const uint16_t*>((const uint8_t*) r2.GetConstBuffer() + y * r2.GetPitch()); |
146 ASSERT_EQ(p, r2.GetBuffer(y)); | 146 ASSERT_EQ(p, r2.GetConstRow(y)); |
147 for (int x = 0; x < width; x++, p++, v++) | 147 for (int x = 0; x < width; x++, p++, v++) |
148 { | 148 { |
149 ASSERT_EQ(*p, v); | 149 ASSERT_EQ(*p, v); |
150 } | 150 } |
151 } | 151 } |