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

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

Issue 313613004: Alter SkCanvas::drawPicture (devirtualize, take const SkPicture, take pointer) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add staging entry point for Chromium and Android 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
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 7
8 #include "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkTSearch.h" 9 #include "SkTSearch.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write ToMemory(NULL); 1404 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write ToMemory(NULL);
1405 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); 1405 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
1406 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by tesWritten()); 1406 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by tesWritten());
1407 this->addPaint(paint); 1407 this->addPaint(paint);
1408 this->addText(text, byteLength); 1408 this->addText(text, byteLength);
1409 this->addPath(path); 1409 this->addPath(path);
1410 this->addMatrix(m); 1410 this->addMatrix(m);
1411 this->validate(initialOffset, size); 1411 this->validate(initialOffset, size);
1412 } 1412 }
1413 1413
1414 void SkPictureRecord::drawPicture(SkPicture& picture) { 1414 void SkPictureRecord::onDrawPicture(const SkPicture* picture) {
1415 1415
1416 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1416 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1417 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1417 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1418 #endif 1418 #endif
1419 1419
1420 // op + picture index 1420 // op + picture index
1421 size_t size = 2 * kUInt32Size; 1421 size_t size = 2 * kUInt32Size;
1422 size_t initialOffset = this->addDraw(DRAW_PICTURE, &size); 1422 size_t initialOffset = this->addDraw(DRAW_PICTURE, &size);
1423 this->addPicture(picture); 1423 this->addPicture(picture);
1424 this->validate(initialOffset, size); 1424 this->validate(initialOffset, size);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 } 1611 }
1612 1612
1613 int SkPictureRecord::addPathToHeap(const SkPath& path) { 1613 int SkPictureRecord::addPathToHeap(const SkPath& path) {
1614 return fPicture->addPathToHeap(path); 1614 return fPicture->addPathToHeap(path);
1615 } 1615 }
1616 1616
1617 void SkPictureRecord::addPath(const SkPath& path) { 1617 void SkPictureRecord::addPath(const SkPath& path) {
1618 this->addInt(this->addPathToHeap(path)); 1618 this->addInt(this->addPathToHeap(path));
1619 } 1619 }
1620 1620
1621 void SkPictureRecord::addPicture(SkPicture& picture) { 1621 void SkPictureRecord::addPicture(const SkPicture* picture) {
1622 int index = fPictureRefs.find(&picture); 1622 int index = fPictureRefs.find(picture);
1623 if (index < 0) { // not found 1623 if (index < 0) { // not found
1624 index = fPictureRefs.count(); 1624 index = fPictureRefs.count();
1625 *fPictureRefs.append() = &picture; 1625 *fPictureRefs.append() = picture;
1626 picture.ref(); 1626 picture->ref();
1627 } 1627 }
1628 // follow the convention of recording a 1-based index 1628 // follow the convention of recording a 1-based index
1629 this->addInt(index + 1); 1629 this->addInt(index + 1);
1630 } 1630 }
1631 1631
1632 void SkPictureRecord::addPoint(const SkPoint& point) { 1632 void SkPictureRecord::addPoint(const SkPoint& point) {
1633 #ifdef SK_DEBUG_SIZE 1633 #ifdef SK_DEBUG_SIZE
1634 size_t start = fWriter.bytesWritten(); 1634 size_t start = fWriter.bytesWritten();
1635 #endif 1635 #endif
1636 fWriter.writePoint(point); 1636 fWriter.writePoint(point);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 void SkPictureRecord::validateRegions() const { 1826 void SkPictureRecord::validateRegions() const {
1827 int count = fRegions.count(); 1827 int count = fRegions.count();
1828 SkASSERT((unsigned) count < 0x1000); 1828 SkASSERT((unsigned) count < 0x1000);
1829 for (int index = 0; index < count; index++) { 1829 for (int index = 0; index < count; index++) {
1830 const SkFlatData* region = fRegions[index]; 1830 const SkFlatData* region = fRegions[index];
1831 SkASSERT(region); 1831 SkASSERT(region);
1832 // region->validate(); 1832 // region->validate();
1833 } 1833 }
1834 } 1834 }
1835 #endif 1835 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698