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

Side by Side Diff: src/core/SkPicturePlayback.cpp

Issue 334053005: Remove dashing from gpu veto (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change to use wall timer Created 6 years, 6 months 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/SkPicturePlayback.h ('k') | src/core/SkPictureRecord.cpp » ('j') | 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 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 "SkPicturePlayback.h" 9 #include "SkPicturePlayback.h"
10 #include "SkPictureRecord.h" 10 #include "SkPictureRecord.h"
11 #include "SkPictureStateTree.h" 11 #include "SkPictureStateTree.h"
12 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
13 #include "SkTypeface.h" 13 #include "SkTypeface.h"
14 #include "SkTSort.h" 14 #include "SkTSort.h"
15 #include "SkWriteBuffer.h" 15 #include "SkWriteBuffer.h"
16 16
17 #if SK_SUPPORT_GPU
18 #include "GrContext.h"
19 #endif
20
17 template <typename T> int SafeCount(const T* obj) { 21 template <typename T> int SafeCount(const T* obj) {
18 return obj ? obj->count() : 0; 22 return obj ? obj->count() : 0;
19 } 23 }
20 24
21 /* Define this to spew out a debug statement whenever we skip the remainder of 25 /* Define this to spew out a debug statement whenever we skip the remainder of
22 a save/restore block because a clip... command returned false (empty). 26 a save/restore block because a clip... command returned false (empty).
23 */ 27 */
24 #define SPEW_CLIP_SKIPPINGx 28 #define SPEW_CLIP_SKIPPINGx
25 29
26 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* 30 SkPicturePlayback::PlaybackReplacements::ReplacementInfo*
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 size * 100 / reader.offset(), skipRect.fCount, skipRRect.fCount, 1332 size * 100 / reader.offset(), skipRect.fCount, skipRRect.fCount,
1329 skipPath.fCount, skipRegion.fCount, skipCull.fCount); 1333 skipPath.fCount, skipRegion.fCount, skipCull.fCount);
1330 SkDebugf("--- Total ops: %d\n", opCount); 1334 SkDebugf("--- Total ops: %d\n", opCount);
1331 } 1335 }
1332 #endif 1336 #endif
1333 // this->dumpSize(); 1337 // this->dumpSize();
1334 } 1338 }
1335 1339
1336 1340
1337 #if SK_SUPPORT_GPU 1341 #if SK_SUPPORT_GPU
1338 bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const ch ar **reason) const { 1342 bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const ch ar **reason,
1343 int sampleCount) const {
1339 // TODO: the heuristic used here needs to be refined 1344 // TODO: the heuristic used here needs to be refined
1340 static const int kNumPaintWithPathEffectUsesTol = 1; 1345 static const int kNumPaintWithPathEffectUsesTol = 1;
1341 static const int kNumAAConcavePaths = 5; 1346 static const int kNumAAConcavePaths = 5;
1342 1347
1343 SkASSERT(fContentInfo.numAAHairlineConcavePaths() <= fContentInfo.numAAConca vePaths()); 1348 SkASSERT(fContentInfo.numAAHairlineConcavePaths() <= fContentInfo.numAAConca vePaths());
1344 1349
1345 bool ret = fContentInfo.numPaintWithPathEffectUses() < kNumPaintWithPathEffe ctUsesTol && 1350 int numNonDashedPathEffects = fContentInfo.numPaintWithPathEffectUses() -
1351 fContentInfo.numFastPathDashEffects();
1352
1353 bool suitableForDash = (0 == fContentInfo.numPaintWithPathEffectUses()) ||
1354 (numNonDashedPathEffects < kNumPaintWithPathEffectUse sTol
1355 && 0 == sampleCount);
1356
1357 bool ret = suitableForDash &&
1346 (fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairli neConcavePaths()) 1358 (fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairli neConcavePaths())
1347 < kNumAAConcavePaths; 1359 < kNumAAConcavePaths;
1348 if (!ret && NULL != reason) { 1360 if (!ret && NULL != reason) {
1349 if (fContentInfo.numPaintWithPathEffectUses() >= kNumPaintWithPathEffect UsesTol) 1361 if (!suitableForDash) {
1350 *reason = "Too many path effects."; 1362 if (0 != sampleCount) {
1351 else if ((fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairlineC oncavePaths()) 1363 *reason = "Can't use multisample on dash effect.";
1352 >= kNumAAConcavePaths) 1364 } else {
1365 *reason = "Too many non dashed path effects.";
1366 }
1367 } else if ((fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairlin eConcavePaths())
1368 >= kNumAAConcavePaths)
1353 *reason = "Too many anti-aliased concave paths."; 1369 *reason = "Too many anti-aliased concave paths.";
1354 else 1370 else
1355 *reason = "Unknown reason for GPU unsuitability."; 1371 *reason = "Unknown reason for GPU unsuitability.";
1356 } 1372 }
1357 return ret; 1373 return ret;
1358 } 1374 }
1375
1376 bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const ch ar **reason,
1377 GrPixelConfig config, SkScal ar dpi) const {
1378
1379 if (context != NULL) {
1380 return this->suitableForGpuRasterization(context, reason,
1381 context->getRecommendedSampleCo unt(config, dpi));
1382 } else {
1383 return this->suitableForGpuRasterization(NULL, reason);
1384 }
1385 }
1386
1359 #endif 1387 #endif
1360 /////////////////////////////////////////////////////////////////////////////// 1388 ///////////////////////////////////////////////////////////////////////////////
1361 1389
1362 #ifdef SK_DEBUG_SIZE 1390 #ifdef SK_DEBUG_SIZE
1363 int SkPicturePlayback::size(size_t* sizePtr) { 1391 int SkPicturePlayback::size(size_t* sizePtr) {
1364 int objects = bitmaps(sizePtr); 1392 int objects = bitmaps(sizePtr);
1365 objects += paints(sizePtr); 1393 objects += paints(sizePtr);
1366 objects += paths(sizePtr); 1394 objects += paths(sizePtr);
1367 objects += pictures(sizePtr); 1395 objects += pictures(sizePtr);
1368 objects += regions(sizePtr); 1396 objects += regions(sizePtr);
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 for (index = 0; index < fPictureCount; index++) 1889 for (index = 0; index < fPictureCount; index++)
1862 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ), 1890 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ),
1863 "picture%p, ", fPictureRefs[index]); 1891 "picture%p, ", fPictureRefs[index]);
1864 if (fPictureCount > 0) 1892 if (fPictureCount > 0)
1865 SkDebugf("%s0};\n", pBuffer); 1893 SkDebugf("%s0};\n", pBuffer);
1866 1894
1867 const_cast<SkPicturePlayback*>(this)->dumpStream(); 1895 const_cast<SkPicturePlayback*>(this)->dumpStream();
1868 } 1896 }
1869 1897
1870 #endif 1898 #endif
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698