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

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

Issue 2146073003: Creating framework for drawShadowedPicture (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Fixed 'const sk_sp<SkLights>', also fixed some crumbs from merging Created 4 years, 5 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 "SkImage_Base.h" 9 #include "SkImage_Base.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); 665 const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
666 size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint 666 size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint
667 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); 667 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size);
668 this->addPaintPtr(paint); 668 this->addPaintPtr(paint);
669 this->addMatrix(m); 669 this->addMatrix(m);
670 this->addPicture(picture); 670 this->addPicture(picture);
671 } 671 }
672 this->validate(initialOffset, size); 672 this->validate(initialOffset, size);
673 } 673 }
674 674
675 void SkPictureRecord::onDrawShadowedPicture(const SkPicture* picture, sk_sp<SkLi ghts> lights) {
676 // op + picture index
677 size_t size = 2 * kUInt32Size;
678 size_t initialOffset;
679
680 initialOffset = this->addDraw(DRAW_PICTURE, &size);
681 this->addPicture(picture);
682
683 this->validate(initialOffset, size);
684 }
685
675 void SkPictureRecord::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matri x) { 686 void SkPictureRecord::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matri x) {
676 // op + drawable index 687 // op + drawable index
677 size_t size = 2 * kUInt32Size; 688 size_t size = 2 * kUInt32Size;
678 size_t initialOffset; 689 size_t initialOffset;
679 690
680 if (nullptr == matrix) { 691 if (nullptr == matrix) {
681 initialOffset = this->addDraw(DRAW_DRAWABLE, &size); 692 initialOffset = this->addDraw(DRAW_DRAWABLE, &size);
682 this->addDrawable(drawable); 693 this->addDrawable(drawable);
683 } else { 694 } else {
684 size += matrix->writeToMemory(nullptr); // matrix 695 size += matrix->writeToMemory(nullptr); // matrix
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 1041
1031 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1042 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1032 int index = fTextBlobRefs.count(); 1043 int index = fTextBlobRefs.count();
1033 *fTextBlobRefs.append() = blob; 1044 *fTextBlobRefs.append() = blob;
1034 blob->ref(); 1045 blob->ref();
1035 // follow the convention of recording a 1-based index 1046 // follow the convention of recording a 1-based index
1036 this->addInt(index + 1); 1047 this->addInt(index + 1);
1037 } 1048 }
1038 1049
1039 /////////////////////////////////////////////////////////////////////////////// 1050 ///////////////////////////////////////////////////////////////////////////////
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698