File tree Expand file tree Collapse file tree 3 files changed +24
-13
lines changed
tests/HwAccelerationTest/src/com/android/test/hwui Expand file tree Collapse file tree 3 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -462,6 +462,7 @@ class DisplayListRenderer: public OpenGLRenderer {
462462 SkPath* pathCopy = mPathMap .valueFor (path);
463463 if (pathCopy == NULL || pathCopy->getGenerationID () != path->getGenerationID ()) {
464464 pathCopy = new SkPath (*path);
465+ pathCopy->setSourcePath (path);
465466 // replaceValueFor() performs an add if the entry doesn't exist
466467 mPathMap .replaceValueFor (path, pathCopy);
467468 mPaths .add (pathCopy);
Original file line number Diff line number Diff line change @@ -83,6 +83,11 @@ void PathCache::clearGarbage() {
8383}
8484
8585PathTexture* PathCache::get (SkPath* path, SkPaint* paint) {
86+ const SkPath* sourcePath = path->getSourcePath ();
87+ if (sourcePath && sourcePath->getGenerationID () == path->getGenerationID ()) {
88+ path = const_cast <SkPath*>(sourcePath);
89+ }
90+
8691 PathCacheEntry entry (path, paint);
8792 PathTexture* texture = mCache .get (entry);
8893
Original file line number Diff line number Diff line change @@ -92,19 +92,24 @@ protected void onDraw(Canvas canvas) {
9292
9393 canvas .restore ();
9494
95- // Path path = makePath();
96- // int r = mRandom.nextInt(10);
97- // if (r == 5 || r == 3) {
98- // mPathList.add(path);
99- // } else if (r == 9) {
100- // mPathList.clear();
101- // }
102- //
103- // canvas.save();
104- // canvas.translate(550.0f + mRandom.nextInt(50), 60.0f + mRandom.nextInt(50));
105- // canvas.drawPath(path, mMediumPaint);
106- // canvas.restore();
107- //
95+ for (int i = 0 ; i < mRandom .nextInt (20 ); i ++) {
96+ Path path = makePath ();
97+ int r = mRandom .nextInt (10 );
98+ if (r == 5 || r == 3 ) {
99+ mPathList .add (path );
100+ }
101+
102+ canvas .save ();
103+ canvas .translate (450.0f + mRandom .nextInt (200 ), mRandom .nextInt (200 ));
104+ canvas .drawPath (path , mMediumPaint );
105+ canvas .restore ();
106+ }
107+
108+ int r = mRandom .nextInt (100 );
109+ if (r == 50 ) {
110+ mPathList .clear ();
111+ }
112+
108113 invalidate ();
109114 }
110115 }
You can’t perform that action at this time.
0 commit comments