| 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 ERRORF(reporter, "SkBitmap::deepCopyTo from %s to %s. " |
| 154 str.printf("SkBitmap::deepCopyTo from %s to %s. expected %s
returned %s", | 154 "expected %s returned %s", gConfigName[i], |
| 155 gConfigName[i], gConfigName[j], boolStr(expected)
, | 155 gConfigName[j], boolStr(expected), |
| 156 boolStr(success)); | 156 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 ERRORF(reporter, "SkBitmap::deepCopyTo from %s to %s " |
| 163 str.printf("SkBitmap::deepCopyTo from %s to %s returned %s," | 162 "returned %s, but canCopyTo returned %s", |
| 164 "but canCopyTo returned %s", | 163 gConfigName[i], gConfigName[j], boolStr(success), |
| 165 gConfigName[i], gConfigName[j], boolStr(success), | 164 boolStr(canSucceed)); |
| 166 boolStr(canSucceed)); | |
| 167 reporter->reportFailed(str); | |
| 168 } | 165 } |
| 169 | 166 |
| 170 TestIndividualCopy(reporter, gPairs[j].fConfig, success, src, ds
t); | 167 TestIndividualCopy(reporter, gPairs[j].fConfig, success, src, ds
t); |
| 171 | 168 |
| 172 // Test copying the subset bitmap, using both copyTo and deepCop
yTo. | 169 // Test copying the subset bitmap, using both copyTo and deepCop
yTo. |
| 173 if (extracted) { | 170 if (extracted) { |
| 174 SkBitmap subsetCopy; | 171 SkBitmap subsetCopy; |
| 175 success = subset.copyTo(&subsetCopy, gPairs[j].fConfig); | 172 success = subset.copyTo(&subsetCopy, gPairs[j].fConfig); |
| 176 REPORTER_ASSERT(reporter, success == expected); | 173 REPORTER_ASSERT(reporter, success == expected); |
| 177 REPORTER_ASSERT(reporter, success == canSucceed); | 174 REPORTER_ASSERT(reporter, success == canSucceed); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 188 } | 185 } |
| 189 } // for (size_t j = ... | 186 } // for (size_t j = ... |
| 190 } // for (size_t i = ... | 187 } // for (size_t i = ... |
| 191 } // GrContextFactory::GLContextType | 188 } // GrContextFactory::GLContextType |
| 192 } | 189 } |
| 193 | 190 |
| 194 #include "TestClassDef.h" | 191 #include "TestClassDef.h" |
| 195 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) | 192 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) |
| 196 | 193 |
| 197 #endif | 194 #endif |
| OLD | NEW |