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

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

Issue 1504313005: fix a couple flaky nonnull attribute ubsan warnings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « include/core/SkTypes.h ('k') | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 "SkLayerInfo.h" 8 #include "SkLayerInfo.h"
9 #include "SkRecordDraw.h" 9 #include "SkRecordDraw.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 dst.fPaint = new SkPaint(*src.fPaint); 686 dst.fPaint = new SkPaint(*src.fPaint);
687 } 687 }
688 dst.fSaveLayerOpID = src.fSaveLayerOpID; 688 dst.fSaveLayerOpID = src.fSaveLayerOpID;
689 dst.fRestoreOpID = src.fRestoreOpID; 689 dst.fRestoreOpID = src.fRestoreOpID;
690 dst.fHasNestedLayers = src.fHasNestedLayers; 690 dst.fHasNestedLayers = src.fHasNestedLayers;
691 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; 691 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested;
692 692
693 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops from sub-picture' 693 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops from sub-picture'
694 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1; 694 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1;
695 dst.fKey = new int[dst.fKeySize]; 695 dst.fKey = new int[dst.fKeySize];
696 memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count( ) * sizeof(int)); 696 sk_careful_memcpy(dst.fKey, fSaveLayerOpStack.begin(),
697 fSaveLayerOpStack.count() * sizeof(int));
697 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp(); 698 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp();
698 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz e * sizeof(int)); 699 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz e * sizeof(int));
699 } 700 }
700 } 701 }
701 702
702 void trackSaveLayers(const DrawPicture& dp) { 703 void trackSaveLayers(const DrawPicture& dp) {
703 this->trackSaveLayersForPicture(dp.picture, dp.paint); 704 this->trackSaveLayersForPicture(dp.picture, dp.paint);
704 } 705 }
705 706
706 void trackSaveLayers(const DrawDrawable& dp) { 707 void trackSaveLayers(const DrawDrawable& dp) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec t bounds[], 801 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec t bounds[],
801 const SkBigPicture::SnapshotArray* pictList, SkLayerI nfo* data) { 802 const SkBigPicture::SnapshotArray* pictList, SkLayerI nfo* data) {
802 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); 803 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data);
803 for (int curOp = 0; curOp < record.count(); curOp++) { 804 for (int curOp = 0; curOp < record.count(); curOp++) {
804 visitor.setCurrentOp(curOp); 805 visitor.setCurrentOp(curOp);
805 record.visit<void>(curOp, visitor); 806 record.visit<void>(curOp, visitor);
806 } 807 }
807 visitor.cleanUp(); 808 visitor.cleanUp();
808 } 809 }
809 810
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698