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

Unified Diff: src/effects/gradients/SkGradientShader.cpp

Issue 496833002: remember to init fOrigPos in legacy constructor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index c84e46a641f21ae16c41a29609db4546af096bd7..b14a3f7e4fb9ae6972b0f1ccc6c3be24b86d8264 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -216,7 +216,7 @@ SkGradientShaderBase::SkGradientShaderBase(SkReadBuffer& buffer) : INHERITED(buf
int colorCount = fColorCount = buffer.getArrayCount();
if (colorCount > kColorStorageCount) {
- size_t allocSize = (sizeof(SkColor) + sizeof(SkPMColor) + sizeof(Rec)) * colorCount;
+ size_t allocSize = (sizeof(SkColor) + sizeof(SkScalar) + sizeof(Rec)) * colorCount;
if (buffer.validateAvailable(allocSize)) {
fOrigColors = reinterpret_cast<SkColor*>(sk_malloc_throw(allocSize));
} else {
@@ -228,20 +228,26 @@ SkGradientShaderBase::SkGradientShaderBase(SkReadBuffer& buffer) : INHERITED(buf
}
buffer.readColorArray(fOrigColors, colorCount);
+ fOrigPos = (SkScalar*)(fOrigColors + colorCount);
+
{
uint32_t packed = buffer.readUInt();
fGradFlags = SkToU8(unpack_flags(packed));
fTileMode = unpack_mode(packed);
}
fTileProc = gTileProcs[fTileMode];
- fRecs = (Rec*)(fOrigColors + colorCount);
+ fRecs = (Rec*)(fOrigPos + colorCount);
if (colorCount > 2) {
Rec* recs = fRecs;
recs[0].fPos = 0;
+ fOrigPos[0] = 0;
for (int i = 1; i < colorCount; i++) {
recs[i].fPos = buffer.readInt();
recs[i].fScale = buffer.readUInt();
+ fOrigPos[i] = SkFixedToScalar(recs[i].fPos);
}
+ } else {
+ fOrigPos = NULL;
}
buffer.readMatrix(&fPtsToUnit);
this->initCommon();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698