OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkRect.h" | 10 #include "SkRect.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (srcOpaque.isOpaque() != dst.isOpaque()) { | 50 if (srcOpaque.isOpaque() != dst.isOpaque()) { |
51 report_opaqueness(reporter, srcOpaque, dst); | 51 report_opaqueness(reporter, srcOpaque, dst); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 static void init_src(const SkBitmap& bitmap) { | 55 static void init_src(const SkBitmap& bitmap) { |
56 SkAutoLockPixels lock(bitmap); | 56 SkAutoLockPixels lock(bitmap); |
57 if (bitmap.getPixels()) { | 57 if (bitmap.getPixels()) { |
58 if (bitmap.getColorTable()) { | 58 if (bitmap.getColorTable()) { |
59 sk_bzero(bitmap.getPixels(), bitmap.getSize()); | 59 sk_bzero(bitmap.getPixels(), bitmap.getSize()); |
| 60 } else if (SkBitmap::kA1_Config == bitmap.config()) { |
| 61 // The A1 config can have uninitialized bits at the |
| 62 // end of each row if eraseColor is used |
| 63 memset(bitmap.getPixels(), 0xff, bitmap.getSafeSize()); |
60 } else { | 64 } else { |
61 bitmap.eraseColor(SK_ColorWHITE); | 65 bitmap.eraseColor(SK_ColorWHITE); |
62 } | 66 } |
63 } | 67 } |
64 } | 68 } |
65 | 69 |
66 static SkColorTable* init_ctable(SkAlphaType alphaType) { | 70 static SkColorTable* init_ctable(SkAlphaType alphaType) { |
67 static const SkColor colors[] = { | 71 static const SkColor colors[] = { |
68 SK_ColorBLACK, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE | 72 SK_ColorBLACK, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE |
69 }; | 73 }; |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 false); | 595 false); |
592 | 596 |
593 #endif | 597 #endif |
594 } | 598 } |
595 } // for (size_t copyCase ... | 599 } // for (size_t copyCase ... |
596 } | 600 } |
597 } | 601 } |
598 | 602 |
599 #include "TestClassDef.h" | 603 #include "TestClassDef.h" |
600 DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy) | 604 DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy) |
OLD | NEW |