blob: 7af8ac95a2dfa8176387cdf7362dfdc985805b9f [file] [log] [blame]
reed@android.com42263962009-05-01 04:00:01 +00001#include "Test.h"
2#include "SkBitmap.h"
reed@android.com311c82d2009-05-05 23:13:23 +00003#include "SkRect.h"
reed@android.com42263962009-05-01 04:00:01 +00004
5static const char* boolStr(bool value) {
6 return value ? "true" : "false";
7}
8
9// these are in the same order as the SkBitmap::Config enum
10static const char* gConfigName[] = {
11 "None", "A1", "A8", "Index8", "565", "4444", "8888", "RLE_Index8"
12};
13
reed@android.comcafc9f92009-08-22 03:44:57 +000014static void report_opaqueness(skiatest::Reporter* reporter, const SkBitmap& src,
15 const SkBitmap& dst) {
16 SkString str;
17 str.printf("src %s opaque:%d, dst %s opaque:%d",
18 gConfigName[src.config()], src.isOpaque(),
19 gConfigName[dst.config()], dst.isOpaque());
20 reporter->reportFailed(str);
21}
22
23static bool canHaveAlpha(SkBitmap::Config config) {
24 return config != SkBitmap::kRGB_565_Config;
25}
26
27// copyTo() should preserve isOpaque when it makes sense
28static void test_isOpaque(skiatest::Reporter* reporter, const SkBitmap& src,
29 SkBitmap::Config dstConfig) {
30 SkBitmap bitmap(src);
31 SkBitmap dst;
32
33 // we need the lock so that we get a valid colorTable (when available)
34 SkAutoLockPixels alp(bitmap);
35 SkColorTable* ctable = bitmap.getColorTable();
36 unsigned ctableFlags = ctable ? ctable->getFlags() : 0;
37
38 if (canHaveAlpha(bitmap.config()) && canHaveAlpha(dstConfig)) {
39 bitmap.setIsOpaque(false);
40 if (ctable) {
41 ctable->setFlags(ctableFlags & ~SkColorTable::kColorsAreOpaque_Flag);
42 }
43 REPORTER_ASSERT(reporter, bitmap.copyTo(&dst, dstConfig));
44 REPORTER_ASSERT(reporter, dst.config() == dstConfig);
45 if (bitmap.isOpaque() != dst.isOpaque()) {
46 report_opaqueness(reporter, bitmap, dst);
47 }
48 }
49
50 bitmap.setIsOpaque(true);
51 if (ctable) {
52 ctable->setFlags(ctableFlags | SkColorTable::kColorsAreOpaque_Flag);
53 }
54 REPORTER_ASSERT(reporter, bitmap.copyTo(&dst, dstConfig));
55 REPORTER_ASSERT(reporter, dst.config() == dstConfig);
56 if (bitmap.isOpaque() != dst.isOpaque()) {
57 report_opaqueness(reporter, bitmap, dst);
58 }
59
60 if (ctable) {
61 ctable->setFlags(ctableFlags);
62 }
63}
64
reed@android.com42263962009-05-01 04:00:01 +000065static void init_src(const SkBitmap& bitmap) {
weita@google.comf9ab99a2009-05-03 18:23:30 +000066 SkAutoLockPixels lock(bitmap);
reed@android.com42263962009-05-01 04:00:01 +000067 if (bitmap.getPixels()) {
68 memset(bitmap.getPixels(), 4, bitmap.getSize());
69 }
70}
71
72SkColorTable* init_ctable() {
73 static const SkColor colors[] = {
74 SK_ColorBLACK, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE
75 };
76 return new SkColorTable(colors, SK_ARRAY_COUNT(colors));
77}
78
79struct Pair {
80 SkBitmap::Config fConfig;
81 const char* fValid;
82};
83
wjmaclean@chromium.org86bff1f2010-11-16 20:22:41 +000084// Utility functions for copyPixelsTo()/copyPixelsFrom() tests.
85// getPixel()
86// setPixel()
87// getSkConfigName()
88// struct Coordinates
89// reportCopyVerification()
90// writeCoordPixels()
91
92// Utility function to read the value of a given pixel in bm. All
93// values converted to uint32_t for simplification of comparisons.
94uint32_t getPixel(int x, int y, const SkBitmap& bm) {
95 uint32_t val = 0;
96 uint16_t val16;
97 uint8_t val8, shift;
98 SkAutoLockPixels lock(bm);
99 const void* rawAddr = bm.getAddr(x,y);
100
101 switch (bm.getConfig()) {
102 case SkBitmap::kARGB_8888_Config:
103 memcpy(&val, rawAddr, sizeof(uint32_t));
104 break;
105 case SkBitmap::kARGB_4444_Config:
106 case SkBitmap::kRGB_565_Config:
107 memcpy(&val16, rawAddr, sizeof(uint16_t));
108 val = val16;
109 break;
110 case SkBitmap::kA8_Config:
111 case SkBitmap::kIndex8_Config:
112 memcpy(&val8, rawAddr, sizeof(uint8_t));
113 val = val8;
114 break;
115 case SkBitmap::kA1_Config:
116 memcpy(&val8, rawAddr, sizeof(uint8_t));
117 shift = x % 8;
118 val = (val8 >> shift) & 0x1 ;
119 break;
120 default:
121 break;
122 }
123 return val;
124}
125
126// Utility function to set value of any pixel in bm.
127// bm.getConfig() specifies what format 'val' must be
128// converted to, but at present uint32_t can handle all formats.
129void setPixel(int x, int y, uint32_t val, SkBitmap& bm) {
130 uint16_t val16;
131 uint8_t val8, shift;
132 SkAutoLockPixels lock(bm);
133 void* rawAddr = bm.getAddr(x,y);
134
135 switch (bm.getConfig()) {
136 case SkBitmap::kARGB_8888_Config:
137 memcpy(rawAddr, &val, sizeof(uint32_t));
138 break;
139 case SkBitmap::kARGB_4444_Config:
140 case SkBitmap::kRGB_565_Config:
141 val16 = val & 0xFFFF;
142 memcpy(rawAddr, &val16, sizeof(uint16_t));
143 break;
144 case SkBitmap::kA8_Config:
145 case SkBitmap::kIndex8_Config:
146 val8 = val & 0xFF;
147 memcpy(rawAddr, &val8, sizeof(uint8_t));
148 break;
149 case SkBitmap::kA1_Config:
150 shift = x % 8; // We assume we're in the right byte.
151 memcpy(&val8, rawAddr, sizeof(uint8_t));
152 if (val & 0x1) // Turn bit on.
153 val8 |= (0x1 << shift);
154 else // Turn bit off.
155 val8 &= ~(0x1 << shift);
156 memcpy(rawAddr, &val8, sizeof(uint8_t));
157 break;
158 default:
159 // Ignore.
160 break;
161 }
162}
163
164// Utility to return string containing name of each format, to
165// simplify diagnostic output.
166const char* getSkConfigName(const SkBitmap& bm) {
167 switch (bm.getConfig()) {
168 case SkBitmap::kNo_Config: return "SkBitmap::kNo_Config";
169 case SkBitmap::kA1_Config: return "SkBitmap::kA1_Config";
170 case SkBitmap::kA8_Config: return "SkBitmap::kA8_Config";
171 case SkBitmap::kIndex8_Config: return "SkBitmap::kIndex8_Config";
172 case SkBitmap::kRGB_565_Config: return "SkBitmap::kRGB_565_Config";
173 case SkBitmap::kARGB_4444_Config: return "SkBitmap::kARGB_4444_Config";
174 case SkBitmap::kARGB_8888_Config: return "SkBitmap::kARGB_8888_Config";
175 case SkBitmap::kRLE_Index8_Config:
176 return "SkBitmap::kRLE_Index8_Config,";
177 default: return "Unknown SkBitmap configuration.";
178 }
179}
180
181// Helper struct to contain pixel locations, while avoiding need for STL.
182struct Coordinates {
183
184 const int length;
185 SkIPoint* const data;
186
187 explicit Coordinates(int _length): length(_length)
188 , data(new SkIPoint[length]) { }
189
190 ~Coordinates(){
191 delete [] data;
192 }
193
194 SkIPoint* operator[](int i) const {
195 // Use with care, no bounds checking.
196 return data + i;
197 }
198};
199
200// A function to verify that two bitmaps contain the same pixel values
201// at all coordinates indicated by coords. Simplifies verification of
202// copied bitmaps.
203void reportCopyVerification(const SkBitmap& bm1, const SkBitmap& bm2,
204 Coordinates& coords,
205 const char* msg,
206 skiatest::Reporter* reporter){
207 bool success = true;
208
209 // Confirm all pixels in the list match.
210 for (int i = 0; i < coords.length; ++i)
211 success = success &&
212 (getPixel(coords[i]->fX, coords[i]->fY, bm1) ==
213 getPixel(coords[i]->fX, coords[i]->fY, bm2));
214
215 if (!success) {
216 SkString str;
217 str.printf("%s [config = %s]",
218 msg, getSkConfigName(bm1));
219 reporter->reportFailed(str);
220 }
221}
222
223// Writes unique pixel values at locations specified by coords.
224void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) {
225 for (int i = 0; i < coords.length; ++i)
226 setPixel(coords[i]->fX, coords[i]->fY, i, bm);
227}
228
reed@android.com42263962009-05-01 04:00:01 +0000229static void TestBitmapCopy(skiatest::Reporter* reporter) {
230 static const Pair gPairs[] = {
231 { SkBitmap::kNo_Config, "00000000" },
weita@google.comf9ab99a2009-05-03 18:23:30 +0000232 { SkBitmap::kA1_Config, "01000000" },
reed@android.com42263962009-05-01 04:00:01 +0000233 { SkBitmap::kA8_Config, "00101110" },
234 { SkBitmap::kIndex8_Config, "00111110" },
235 { SkBitmap::kRGB_565_Config, "00101110" },
236 { SkBitmap::kARGB_4444_Config, "00101110" },
237 { SkBitmap::kARGB_8888_Config, "00101110" },
reed@android.comfbaa88d2009-05-06 17:44:34 +0000238// TODO: create valid RLE bitmap to test with
239 // { SkBitmap::kRLE_Index8_Config, "00101111" }
reed@android.com42263962009-05-01 04:00:01 +0000240 };
weita@google.comf9ab99a2009-05-03 18:23:30 +0000241
wjmaclean@chromium.org86bff1f2010-11-16 20:22:41 +0000242 static const bool isExtracted[] = {
243 false, true
244 };
245
reed@android.com42263962009-05-01 04:00:01 +0000246 const int W = 20;
247 const int H = 33;
weita@google.comf9ab99a2009-05-03 18:23:30 +0000248
reed@android.com42263962009-05-01 04:00:01 +0000249 for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) {
250 for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) {
251 SkBitmap src, dst;
252 SkColorTable* ct = NULL;
weita@google.comf9ab99a2009-05-03 18:23:30 +0000253
reed@android.com42263962009-05-01 04:00:01 +0000254 src.setConfig(gPairs[i].fConfig, W, H);
reed@android.comfbaa88d2009-05-06 17:44:34 +0000255 if (SkBitmap::kIndex8_Config == src.config() ||
256 SkBitmap::kRLE_Index8_Config == src.config()) {
reed@android.com42263962009-05-01 04:00:01 +0000257 ct = init_ctable();
258 }
259 src.allocPixels(ct);
reed@android.comd0a529d2010-01-08 14:01:41 +0000260 SkSafeUnref(ct);
reed@android.com42263962009-05-01 04:00:01 +0000261
262 init_src(src);
263 bool success = src.copyTo(&dst, gPairs[j].fConfig);
264 bool expected = gPairs[i].fValid[j] != '0';
265 if (success != expected) {
266 SkString str;
267 str.printf("SkBitmap::copyTo from %s to %s. expected %s returned %s",
268 gConfigName[i], gConfigName[j], boolStr(expected),
269 boolStr(success));
270 reporter->reportFailed(str);
271 }
reed@android.comfbaa88d2009-05-06 17:44:34 +0000272
273 bool canSucceed = src.canCopyTo(gPairs[j].fConfig);
274 if (success != canSucceed) {
275 SkString str;
276 str.printf("SkBitmap::copyTo from %s to %s. returned %s canCopyTo %s",
277 gConfigName[i], gConfigName[j], boolStr(success),
278 boolStr(canSucceed));
279 reporter->reportFailed(str);
280 }
weita@google.comf9ab99a2009-05-03 18:23:30 +0000281
reed@android.com42263962009-05-01 04:00:01 +0000282 if (success) {
283 REPORTER_ASSERT(reporter, src.width() == dst.width());
284 REPORTER_ASSERT(reporter, src.height() == dst.height());
weita@google.comf9ab99a2009-05-03 18:23:30 +0000285 REPORTER_ASSERT(reporter, dst.config() == gPairs[j].fConfig);
reed@android.comcafc9f92009-08-22 03:44:57 +0000286 test_isOpaque(reporter, src, dst.config());
reed@android.com42263962009-05-01 04:00:01 +0000287 if (src.config() == dst.config()) {
weita@google.comf9ab99a2009-05-03 18:23:30 +0000288 SkAutoLockPixels srcLock(src);
reed@android.com42263962009-05-01 04:00:01 +0000289 SkAutoLockPixels dstLock(dst);
290 REPORTER_ASSERT(reporter, src.readyToDraw());
291 REPORTER_ASSERT(reporter, dst.readyToDraw());
292 const char* srcP = (const char*)src.getAddr(0, 0);
293 const char* dstP = (const char*)dst.getAddr(0, 0);
294 REPORTER_ASSERT(reporter, srcP != dstP);
295 REPORTER_ASSERT(reporter, !memcmp(srcP, dstP,
296 src.getSize()));
297 }
reed@android.com311c82d2009-05-05 23:13:23 +0000298 // test extractSubset
299 {
300 SkBitmap subset;
301 SkIRect r;
302 r.set(1, 1, 2, 2);
303 if (src.extractSubset(&subset, r)) {
304 REPORTER_ASSERT(reporter, subset.width() == 1);
305 REPORTER_ASSERT(reporter, subset.height() == 1);
306
307 SkBitmap copy;
308 REPORTER_ASSERT(reporter,
309 subset.copyTo(&copy, subset.config()));
310 REPORTER_ASSERT(reporter, copy.width() == 1);
311 REPORTER_ASSERT(reporter, copy.height() == 1);
312 REPORTER_ASSERT(reporter, copy.rowBytes() <= 4);
313
314 SkAutoLockPixels alp0(subset);
315 SkAutoLockPixels alp1(copy);
316 // they should both have, or both not-have, a colortable
317 bool hasCT = subset.getColorTable() != NULL;
318 REPORTER_ASSERT(reporter,
319 (copy.getColorTable() != NULL) == hasCT);
320 }
321 }
reed@android.com42263962009-05-01 04:00:01 +0000322 } else {
323 // dst should be unchanged from its initial state
324 REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config);
325 REPORTER_ASSERT(reporter, dst.width() == 0);
326 REPORTER_ASSERT(reporter, dst.height() == 0);
327 }
wjmaclean@chromium.org86bff1f2010-11-16 20:22:41 +0000328 } // for (size_t j = ...
329
330 // Tests for getSafeSize(), getSafeSize64(), copyPixelsTo(),
331 // copyPixelsFrom().
332 //
333 for (size_t copyCase = 0; copyCase < SK_ARRAY_COUNT(isExtracted);
334 ++copyCase) {
335 // Test copying to/from external buffer.
336 // Note: the tests below have hard-coded values ---
337 // Please take care if modifying.
338 if (gPairs[i].fConfig != SkBitmap::kRLE_Index8_Config) {
339
340 // Tests for getSafeSize64().
341 // Test with a very large configuration without pixel buffer
342 // attached.
343 SkBitmap tstSafeSize;
344 tstSafeSize.setConfig(gPairs[i].fConfig, 100000000U,
345 100000000U);
346 Sk64 safeSize = tstSafeSize.getSafeSize64();
347 if (safeSize.isNeg()) {
348 SkString str;
349 str.printf("getSafeSize64() negative: %s",
350 getSkConfigName(tstSafeSize));
351 reporter->reportFailed(str);
352 }
353 bool sizeFail = false;
354 // Compare against hand-computed values.
355 switch (gPairs[i].fConfig) {
356 case SkBitmap::kNo_Config:
357 break;
358
359 case SkBitmap::kA1_Config:
360 if (safeSize.fHi != 0x470DE ||
361 safeSize.fLo != 0x4DF82000)
362 sizeFail = true;
363 break;
364
365 case SkBitmap::kA8_Config:
366 case SkBitmap::kIndex8_Config:
367 if (safeSize.fHi != 0x2386F2 ||
368 safeSize.fLo != 0x6FC10000)
369 sizeFail = true;
370 break;
371
372 case SkBitmap::kRGB_565_Config:
373 case SkBitmap::kARGB_4444_Config:
374 if (safeSize.fHi != 0x470DE4 ||
375 safeSize.fLo != 0xDF820000)
376 sizeFail = true;
377 break;
378
379 case SkBitmap::kARGB_8888_Config:
380 if (safeSize.fHi != 0x8E1BC9 ||
381 safeSize.fLo != 0xBF040000)
382 sizeFail = true;
383 break;
384
385 case SkBitmap::kRLE_Index8_Config:
386 break;
387
388 default:
389 break;
390 }
391 if (sizeFail) {
392 SkString str;
393 str.printf("getSafeSize64() wrong size: %s",
394 getSkConfigName(tstSafeSize));
395 reporter->reportFailed(str);
396 }
397
398 size_t subW, subH;
399 // Set sizes to be height = 2 to force the last row of the
400 // source to be used, thus verifying correct operation if
401 // the bitmap is an extracted subset.
402 if (gPairs[i].fConfig == SkBitmap::kA1_Config) {
403 // If one-bit per pixel, use 9 pixels to force more than
404 // one byte per row.
405 subW = 9;
406 subH = 2;
407 } else {
408 // All other configurations are at least one byte per pixel,
409 // and different configs will test copying different numbers
410 // of bytes.
411 subW = subH = 2;
412 }
413
414 // Create bitmap to act as source for copies and subsets.
415 SkBitmap src, subset;
416 SkColorTable* ct = NULL;
417 if (isExtracted[copyCase]) { // A larger image to extract from.
418 src.setConfig(gPairs[i].fConfig, 2 * subW + 1, subH);
419 } else // Tests expect a 2x2 bitmap, so make smaller.
420 src.setConfig(gPairs[i].fConfig, subW, subH);
421 if (SkBitmap::kIndex8_Config == src.config() ||
422 SkBitmap::kRLE_Index8_Config == src.config()) {
423 ct = init_ctable();
424 }
425
426 src.allocPixels(ct);
427 SkSafeUnref(ct);
428
429 // Either copy src or extract into 'subset', which is used
430 // for subsequent calls to copyPixelsTo/From.
431 bool srcReady = false;
432 if (isExtracted[copyCase]) {
433 // The extractedSubset() test case allows us to test copy-
434 // ing when src and dst mave possibly different strides.
435 SkIRect r;
436 if (gPairs[i].fConfig == SkBitmap::kA1_Config)
437 // This config seems to need byte-alignment of
438 // extracted subset bits.
439 r.set(0, 0, subW, subH);
440 else
441 r.set(1, 0, 1 + subW, subH); // 2x2 extracted bitmap
442
443 srcReady = src.extractSubset(&subset, r);
444 } else {
445 srcReady = src.copyTo(&subset, src.getConfig());
446 }
447
448 // Not all configurations will generate a valid 'subset'.
449 if (srcReady) {
450
451 // Allocate our target buffer 'buf' for all copies.
452 // To simplify verifying correctness of copies attach
453 // buf to a SkBitmap, but copies are done using the
454 // raw buffer pointer.
455 const uint32_t bufSize = subH *
456 SkBitmap::ComputeRowBytes(src.getConfig(), subW) * 2;
457 uint8_t* buf = new uint8_t[bufSize];
458
459 SkBitmap bufBm; // Attach buf to this bitmap.
460 bool successExpected;
461
462 // Set up values for each pixel being copied.
463 Coordinates coords(subW * subH);
464 for (size_t x = 0; x < subW; ++x)
465 for (size_t y = 0; y < subH; ++y)
466 {
467 size_t index = y * subW + x;
468 SkASSERT(index < coords.length);
469 coords[index]->fX = x;
470 coords[index]->fY = y;
471 }
472
473 writeCoordPixels(subset, coords);
474
475 // Test #1 ////////////////////////////////////////////
476
477 // Before/after comparisons easier if we attach buf
478 // to an appropriately configured SkBitmap.
479 memset(buf, 0xFF, bufSize);
480 // Config with stride greater than src but that fits in buf.
481 bufBm.setConfig(gPairs[i].fConfig, subW, subH,
482 SkBitmap::ComputeRowBytes(subset.getConfig(), subW)
483 * 2);
484 bufBm.setPixels(buf);
485 successExpected = false;
486 // Then attempt to copy with a stride that is too large
487 // to fit in the buffer.
488 REPORTER_ASSERT(reporter,
489 subset.copyPixelsTo(buf, bufSize, bufBm.rowBytes() * 3)
490 == successExpected);
491
492 if (successExpected)
493 reportCopyVerification(subset, bufBm, coords,
494 "copyPixelsTo(buf, bufSize, 1.5*maxRowBytes)",
495 reporter);
496
497 // Test #2 ////////////////////////////////////////////
498 // This test should always succeed, but in the case
499 // of extracted bitmaps only because we handle the
500 // issue of getSafeSize(). Without getSafeSize()
501 // buffer overrun/read would occur.
502 memset(buf, 0xFF, bufSize);
503 bufBm.setConfig(gPairs[i].fConfig, subW, subH,
504 subset.rowBytes());
505 bufBm.setPixels(buf);
506 successExpected = subset.getSafeSize() <= bufSize;
507 REPORTER_ASSERT(reporter,
508 subset.copyPixelsTo(buf, bufSize) ==
509 successExpected);
510 if (successExpected)
511 reportCopyVerification(subset, bufBm, coords,
512 "copyPixelsTo(buf, bufSize)", reporter);
513
514 // Test #3 ////////////////////////////////////////////
515 // Copy with different stride between src and dst.
516 memset(buf, 0xFF, bufSize);
517 bufBm.setConfig(gPairs[i].fConfig, subW, subH,
518 subset.rowBytes()+1);
519 bufBm.setPixels(buf);
520 successExpected = true; // Should always work.
521 REPORTER_ASSERT(reporter,
522 subset.copyPixelsTo(buf, bufSize,
523 subset.rowBytes()+1) == successExpected);
524 if (successExpected)
525 reportCopyVerification(subset, bufBm, coords,
526 "copyPixelsTo(buf, bufSize, rowBytes+1)", reporter);
527
528 // Test #4 ////////////////////////////////////////////
529 // Test copy with stride too small.
530 memset(buf, 0xFF, bufSize);
531 bufBm.setConfig(gPairs[i].fConfig, subW, subH);
532 bufBm.setPixels(buf);
533 successExpected = false;
534 // Request copy with stride too small.
535 REPORTER_ASSERT(reporter,
536 subset.copyPixelsTo(buf, bufSize, bufBm.rowBytes()-1)
537 == successExpected);
538 if (successExpected)
539 reportCopyVerification(subset, bufBm, coords,
540 "copyPixelsTo(buf, bufSize, rowBytes()-1)", reporter);
541
542 // Test #5 ////////////////////////////////////////////
543 // Tests the case where the source stride is too small
544 // for the source configuration.
545 memset(buf, 0xFF, bufSize);
546 bufBm.setConfig(gPairs[i].fConfig, subW, subH);
547 bufBm.setPixels(buf);
548 writeCoordPixels(bufBm, coords);
549 REPORTER_ASSERT(reporter,
550 subset.copyPixelsFrom(buf, bufSize, 1) == false);
551
552 // Test #6 ////////////////////////////////////////////
553 // Tests basic copy from an external buffer to the bitmap.
554 // If the bitmap is "extracted", this also tests the case
555 // where the source stride is different from the dest.
556 // stride.
557 // We've made the buffer large enough to always succeed.
558 bufBm.setConfig(gPairs[i].fConfig, subW, subH);
559 bufBm.setPixels(buf);
560 writeCoordPixels(bufBm, coords);
561 REPORTER_ASSERT(reporter,
562 subset.copyPixelsFrom(buf, bufSize, bufBm.rowBytes()) ==
563 true);
564 reportCopyVerification(bufBm, subset, coords,
565 "copyPixelsFrom(buf, bufSize)",
566 reporter);
567
568 // Test #7 ////////////////////////////////////////////
569 // Tests the case where the source buffer is too small
570 // for the transfer.
571 REPORTER_ASSERT(reporter,
572 subset.copyPixelsFrom(buf, 1, subset.rowBytes()) ==
573 false);
574
575 delete [] buf;
576 }
577 }
578 } // for (size_t copyCase ...
reed@android.com42263962009-05-01 04:00:01 +0000579 }
580}
581
582#include "TestClassDef.h"
583DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy)