Fix TSAN error for shadow cache
Change-Id: I84b94a19c724e2152d1eac269f425f7f0f2286f5 Reviewed-on: https://skia-review.googlesource.com/17706 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
564ad05f06
commit
eb63eb757e
@ -25,20 +25,13 @@ static constexpr int kH = 800;
|
||||
void draw_paths(SkCanvas* canvas, bool hideOccluders) {
|
||||
SkTArray<SkPath> paths;
|
||||
paths.push_back().addRoundRect(SkRect::MakeWH(50, 50), 10, 10);
|
||||
// disable cache for now until we can figure out how to make it more stable
|
||||
paths.back().setIsVolatile(true);
|
||||
SkRRect oddRRect;
|
||||
oddRRect.setNinePatch(SkRect::MakeWH(50, 50), 9, 13, 6, 16);
|
||||
paths.push_back().addRRect(oddRRect);
|
||||
paths.back().setIsVolatile(true);
|
||||
paths.push_back().addRect(SkRect::MakeWH(50, 50));
|
||||
paths.back().setIsVolatile(true);
|
||||
paths.push_back().addCircle(25, 25, 25);
|
||||
paths.back().setIsVolatile(true);
|
||||
paths.push_back().cubicTo(100, 50, 20, 100, 0, 0);
|
||||
paths.back().setIsVolatile(true);
|
||||
paths.push_back().addOval(SkRect::MakeWH(20, 60));
|
||||
paths.back().setIsVolatile(true);
|
||||
|
||||
static constexpr SkScalar kPad = 15.f;
|
||||
static constexpr SkScalar kLightR = 100.f;
|
||||
|
@ -255,7 +255,7 @@ struct SpotVerticesFactory {
|
||||
/**
|
||||
* This manages a set of tessellations for a given shape in the cache. Because SkResourceCache
|
||||
* records are immutable this is not itself a Rec. When we need to update it we return this on
|
||||
* the FindVisitor and let the cache destory the Rec. We'll update the tessellations and then add
|
||||
* the FindVisitor and let the cache destroy the Rec. We'll update the tessellations and then add
|
||||
* a new Rec with an adjusted size for any deletions/additions.
|
||||
*/
|
||||
class CachedTessellations : public SkRefCnt {
|
||||
@ -319,7 +319,7 @@ private:
|
||||
if (fCount < MAX_ENTRIES) {
|
||||
i = fCount++;
|
||||
} else {
|
||||
i = gRandom.nextULessThan(MAX_ENTRIES);
|
||||
i = fRandom.nextULessThan(MAX_ENTRIES);
|
||||
fSize -= fEntries[i].fVertices->approximateSize();
|
||||
}
|
||||
fEntries[i].fFactory = factory;
|
||||
@ -338,16 +338,13 @@ private:
|
||||
Entry fEntries[MAX_ENTRIES];
|
||||
int fCount = 0;
|
||||
size_t fSize = 0;
|
||||
SkRandom fRandom;
|
||||
};
|
||||
|
||||
Set<AmbientVerticesFactory, 4> fAmbientSet;
|
||||
Set<SpotVerticesFactory, 4> fSpotSet;
|
||||
|
||||
static SkRandom gRandom;
|
||||
};
|
||||
|
||||
SkRandom CachedTessellations::gRandom;
|
||||
|
||||
/**
|
||||
* A record of shadow vertices stored in SkResourceCache of CachedTessellations for a particular
|
||||
* path. The key represents the path's geometry and not any shadow params.
|
||||
|
Loading…
Reference in New Issue
Block a user