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

Side by Side Diff: include/core/SkPicture.h

Issue 251533004: First pass at GPU veto (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add counting of AA hairline stroked concave paths Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkPicture.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 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
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 9
10 #ifndef SkPicture_DEFINED 10 #ifndef SkPicture_DEFINED
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 #endif 357 #endif
358 358
359 SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint3 2_t recordFlags); 359 SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint3 2_t recordFlags);
360 360
361 private: 361 private:
362 friend class SkPictureRecord; 362 friend class SkPictureRecord;
363 friend class SkPictureTester; // for unit testing 363 friend class SkPictureTester; // for unit testing
364 364
365 SkAutoTUnref<SkPathHeap> fPathHeap; // reference counted 365 SkAutoTUnref<SkPathHeap> fPathHeap; // reference counted
366 366
367 // ContentInfo is not serialized! It is intended solely for use
368 // with suitableForGpuRasterization.
369 class ContentInfo {
370 public:
371 ContentInfo() { this->reset(); }
372
373 ContentInfo(const ContentInfo& src) { this->set(src); }
374
375 void set(const ContentInfo& src) {
376 fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses;
377 fNumAAConcavePaths = src.fNumAAConcavePaths;
378 fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths;
379 }
380
381 void reset() {
382 fNumPaintWithPathEffectUses = 0;
383 fNumAAConcavePaths = 0;
384 fNumAAHairlineConcavePaths = 0;
385 }
386
387 void swap(ContentInfo* other) {
388 SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectU ses);
389 SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths);
390 SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePath s);
391 }
392
393 // This field is incremented every time a paint with a path effect is
394 // used (i.e., it is not a de-duplicated count)
395 int fNumPaintWithPathEffectUses;
396 // This field is incremented every time an anti-aliased drawPath call is
397 // issued with a concave path
398 int fNumAAConcavePaths;
399 // This field is incremented every time a drawPath call is
400 // issued for a hairline stroked concave path.
401 int fNumAAHairlineConcavePaths;
402 };
403
404 ContentInfo fContentInfo;
405
406 void incPaintWithPathEffectUses() {
407 ++fContentInfo.fNumPaintWithPathEffectUses;
408 }
409 int numPaintWithPathEffectUses() const {
410 return fContentInfo.fNumPaintWithPathEffectUses;
411 }
412
413 void incAAConcavePaths() {
414 ++fContentInfo.fNumAAConcavePaths;
415 }
416 int numAAConcavePaths() const {
417 return fContentInfo.fNumAAConcavePaths;
418 }
419
420 void incAAHairlineConcavePaths() {
421 ++fContentInfo.fNumAAHairlineConcavePaths;
422 SkASSERT(fContentInfo.fNumAAHairlineConcavePaths <= fContentInfo.fNumAAC oncavePaths);
423 }
424 int numAAHairlineConcavePaths() const {
425 return fContentInfo.fNumAAHairlineConcavePaths;
426 }
427
367 const SkPath& getPath(int index) const; 428 const SkPath& getPath(int index) const;
368 int addPathToHeap(const SkPath& path); 429 int addPathToHeap(const SkPath& path);
369 430
370 void flattenToBuffer(SkWriteBuffer& buffer) const; 431 void flattenToBuffer(SkWriteBuffer& buffer) const;
371 bool parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t size); 432 bool parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t size);
372 433
373 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); 434 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size);
374 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); 435 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size);
375 436
376 void initForPlayback() const; 437 void initForPlayback() const;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 typedef SkRefCnt INHERITED; 513 typedef SkRefCnt INHERITED;
453 }; 514 };
454 515
455 #endif 516 #endif
456 517
457 #ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS 518 #ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
458 #include "SkPictureRecorder.h" 519 #include "SkPictureRecorder.h"
459 #endif 520 #endif
460 521
461 #endif 522 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698