| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 | 8 |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // Extract a subset. If this succeeds we will test copying the subse
t. | 144 // Extract a subset. If this succeeds we will test copying the subse
t. |
| 145 SkBitmap subset; | 145 SkBitmap subset; |
| 146 const bool extracted = src.extractSubset(&subset, subsetRect); | 146 const bool extracted = src.extractSubset(&subset, subsetRect); |
| 147 | 147 |
| 148 for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) { | 148 for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) { |
| 149 dst.reset(); | 149 dst.reset(); |
| 150 bool success = src.deepCopyTo(&dst, gPairs[j].fConfig); | 150 bool success = src.deepCopyTo(&dst, gPairs[j].fConfig); |
| 151 bool expected = gPairs[i].fValid[j] != '0'; | 151 bool expected = gPairs[i].fValid[j] != '0'; |
| 152 if (success != expected) { | 152 if (success != expected) { |
| 153 SkString str; | 153 REPORTF(reporter, |
| 154 str.printf("SkBitmap::deepCopyTo from %s to %s. expected %s
returned %s", | 154 ("SkBitmap::deepCopyTo from %s to %s. expected %s" |
| 155 gConfigName[i], gConfigName[j], boolStr(expected)
, | 155 " returned %s", gConfigName[i], gConfigName[j], |
| 156 boolStr(success)); | 156 boolStr(expected), boolStr(success))); |
| 157 reporter->reportFailed(str); | |
| 158 } | 157 } |
| 159 | 158 |
| 160 bool canSucceed = src.canCopyTo(gPairs[j].fConfig); | 159 bool canSucceed = src.canCopyTo(gPairs[j].fConfig); |
| 161 if (success != canSucceed) { | 160 if (success != canSucceed) { |
| 162 SkString str; | 161 REPORTF(reporter, |
| 163 str.printf("SkBitmap::deepCopyTo from %s to %s returned %s," | 162 ("SkBitmap::deepCopyTo from %s to %s returned %s," |
| 164 "but canCopyTo returned %s", | 163 "but canCopyTo returned %s", gConfigName[i], |
| 165 gConfigName[i], gConfigName[j], boolStr(success), | 164 gConfigName[j], boolStr(success), |
| 166 boolStr(canSucceed)); | 165 boolStr(canSucceed))); |
| 167 reporter->reportFailed(str); | |
| 168 } | 166 } |
| 169 | 167 |
| 170 TestIndividualCopy(reporter, gPairs[j].fConfig, success, src, ds
t); | 168 TestIndividualCopy(reporter, gPairs[j].fConfig, success, src, ds
t); |
| 171 | 169 |
| 172 // Test copying the subset bitmap, using both copyTo and deepCop
yTo. | 170 // Test copying the subset bitmap, using both copyTo and deepCop
yTo. |
| 173 if (extracted) { | 171 if (extracted) { |
| 174 SkBitmap subsetCopy; | 172 SkBitmap subsetCopy; |
| 175 success = subset.copyTo(&subsetCopy, gPairs[j].fConfig); | 173 success = subset.copyTo(&subsetCopy, gPairs[j].fConfig); |
| 176 REPORTER_ASSERT(reporter, success == expected); | 174 REPORTER_ASSERT(reporter, success == expected); |
| 177 REPORTER_ASSERT(reporter, success == canSucceed); | 175 REPORTER_ASSERT(reporter, success == canSucceed); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 188 } | 186 } |
| 189 } // for (size_t j = ... | 187 } // for (size_t j = ... |
| 190 } // for (size_t i = ... | 188 } // for (size_t i = ... |
| 191 } // GrContextFactory::GLContextType | 189 } // GrContextFactory::GLContextType |
| 192 } | 190 } |
| 193 | 191 |
| 194 #include "TestClassDef.h" | 192 #include "TestClassDef.h" |
| 195 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) | 193 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) |
| 196 | 194 |
| 197 #endif | 195 #endif |
| OLD | NEW |