Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: tests/BitmapTest.cpp

Issue 1510253002: SkBitmap::getColor repsects swizzle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkMallocPixelRef.h" 9 #include "SkMallocPixelRef.h"
10 #include "Test.h" 10 #include "Test.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty()); 116 REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty());
117 } 117 }
118 } 118 }
119 119
120 test_bigwidth(reporter); 120 test_bigwidth(reporter);
121 test_allocpixels(reporter); 121 test_allocpixels(reporter);
122 test_bigalloc(reporter); 122 test_bigalloc(reporter);
123 test_peekpixels(reporter); 123 test_peekpixels(reporter);
124 } 124 }
125
126 /**
127 * This test checks that getColor works for both swizzles.
128 */
129 DEF_TEST(Bitmap_getColor_Swizzle, r) {
130 SkBitmap source;
131 source.allocN32Pixels(1,1);
132 source.eraseColor(SK_ColorRED);
133 SkColorType colorTypes[] = {
134 kRGBA_8888_SkColorType,
135 kBGRA_8888_SkColorType,
136 };
137 for (SkColorType ct : colorTypes) {
138 SkBitmap copy;
139 if (!source.copyTo(&copy, ct)) {
140 ERRORF(r, "SkBitmap::copy failed %d", (int)ct);
141 continue;
142 }
143 SkAutoLockPixels autoLockPixels1(copy);
144 SkAutoLockPixels autoLockPixels2(source);
145 REPORTER_ASSERT(r, source.getColor(0, 0) == copy.getColor(0, 0));
146 }
147 }
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698