OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include <new> | 7 #include <new> |
8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
| 9 #include "SkDrawPictureCallback.h" |
9 #include "SkPicturePlayback.h" | 10 #include "SkPicturePlayback.h" |
10 #include "SkPictureRecord.h" | 11 #include "SkPictureRecord.h" |
11 #include "SkPictureStateTree.h" | 12 #include "SkPictureStateTree.h" |
12 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
13 #include "SkTypeface.h" | 14 #include "SkTypeface.h" |
14 #include "SkTSort.h" | 15 #include "SkTSort.h" |
15 #include "SkWriteBuffer.h" | 16 #include "SkWriteBuffer.h" |
16 | 17 |
17 #if SK_SUPPORT_GPU | 18 #if SK_SUPPORT_GPU |
18 #include "GrContext.h" | 19 #include "GrContext.h" |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 SkASSERT(fContentInfo.numAAHairlineConcavePaths() <= fContentInfo.numAAConca
vePaths()); | 1349 SkASSERT(fContentInfo.numAAHairlineConcavePaths() <= fContentInfo.numAAConca
vePaths()); |
1349 | 1350 |
1350 int numNonDashedPathEffects = fContentInfo.numPaintWithPathEffectUses() - | 1351 int numNonDashedPathEffects = fContentInfo.numPaintWithPathEffectUses() - |
1351 fContentInfo.numFastPathDashEffects(); | 1352 fContentInfo.numFastPathDashEffects(); |
1352 | 1353 |
1353 bool suitableForDash = (0 == fContentInfo.numPaintWithPathEffectUses()) || | 1354 bool suitableForDash = (0 == fContentInfo.numPaintWithPathEffectUses()) || |
1354 (numNonDashedPathEffects < kNumPaintWithPathEffectUse
sTol | 1355 (numNonDashedPathEffects < kNumPaintWithPathEffectUse
sTol |
1355 && 0 == sampleCount); | 1356 && 0 == sampleCount); |
1356 | 1357 |
1357 bool ret = suitableForDash && | 1358 bool ret = suitableForDash && |
1358 (fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairli
neConcavePaths()) | 1359 (fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairli
neConcavePaths()) |
1359 < kNumAAConcavePaths; | 1360 < kNumAAConcavePaths; |
1360 if (!ret && NULL != reason) { | 1361 if (!ret && NULL != reason) { |
1361 if (!suitableForDash) { | 1362 if (!suitableForDash) { |
1362 if (0 != sampleCount) { | 1363 if (0 != sampleCount) { |
1363 *reason = "Can't use multisample on dash effect."; | 1364 *reason = "Can't use multisample on dash effect."; |
1364 } else { | 1365 } else { |
1365 *reason = "Too many non dashed path effects."; | 1366 *reason = "Too many non dashed path effects."; |
1366 } | 1367 } |
1367 } else if ((fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairlin
eConcavePaths()) | 1368 } else if ((fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairlin
eConcavePaths()) |
1368 >= kNumAAConcavePaths) | 1369 >= kNumAAConcavePaths) |
1369 *reason = "Too many anti-aliased concave paths."; | 1370 *reason = "Too many anti-aliased concave paths."; |
1370 else | 1371 else |
1371 *reason = "Unknown reason for GPU unsuitability."; | 1372 *reason = "Unknown reason for GPU unsuitability."; |
1372 } | 1373 } |
1373 return ret; | 1374 return ret; |
1374 } | 1375 } |
1375 | 1376 |
1376 bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const ch
ar **reason, | 1377 bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const ch
ar **reason, |
1377 GrPixelConfig config, SkScal
ar dpi) const { | 1378 GrPixelConfig config, SkScal
ar dpi) const { |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 for (index = 0; index < fPictureCount; index++) | 1890 for (index = 0; index < fPictureCount; index++) |
1890 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1891 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
1891 "picture%p, ", fPictureRefs[index]); | 1892 "picture%p, ", fPictureRefs[index]); |
1892 if (fPictureCount > 0) | 1893 if (fPictureCount > 0) |
1893 SkDebugf("%s0};\n", pBuffer); | 1894 SkDebugf("%s0};\n", pBuffer); |
1894 | 1895 |
1895 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1896 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
1896 } | 1897 } |
1897 | 1898 |
1898 #endif | 1899 #endif |
OLD | NEW |