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

Side by Side Diff: tests/RecordReplaceDrawTest.cpp

Issue 753253002: Use variable length key (rather than accumulated matrix) as save layer hoisting key (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 6 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
« src/gpu/GrLayerCache.h ('K') | « tests/PictureTest.cpp ('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 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "Test.h" 10 #include "Test.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 SkAutoTDelete<SkPaint> paint(SkNEW(SkPaint)); 109 SkAutoTDelete<SkPaint> paint(SkNEW(SkPaint));
110 canvas->saveLayer(NULL, paint); 110 canvas->saveLayer(NULL, paint);
111 canvas->clear(SK_ColorRED); 111 canvas->clear(SK_ColorRED);
112 canvas->restore(); 112 canvas->restore();
113 canvas->drawRect(SkRect::MakeWH(SkIntToScalar(kWidth / 2), SkIntToScalar (kHeight / 2)), 113 canvas->drawRect(SkRect::MakeWH(SkIntToScalar(kWidth / 2), SkIntToScalar (kHeight / 2)),
114 SkPaint()); 114 SkPaint());
115 pic.reset(recorder.endRecording()); 115 pic.reset(recorder.endRecording());
116 } 116 }
117 117
118 int key[1] = { 0 };
119
118 GrReplacements replacements; 120 GrReplacements replacements;
119 GrReplacements::ReplacementInfo* ri = replacements.newReplacement(pic->uniqu eID(), 121 GrReplacements::ReplacementInfo* ri = replacements.newReplacement(pic->uniqu eID(),
120 0, SkMatri x::I()); 122 SkMatrix:: I(), key, 1);
121 ri->fStop = 2; 123 ri->fStop = 2;
122 ri->fPos.set(0, 0); 124 ri->fPos.set(0, 0);
123 ri->fImage = make_image(SK_ColorRED); 125 ri->fImage = make_image(SK_ColorRED);
124 ri->fPaint = SkNEW(SkPaint); 126 ri->fPaint = SkNEW(SkPaint);
125 ri->fSrcRect = SkIRect::MakeWH(kWidth, kHeight); 127 ri->fSrcRect = SkIRect::MakeWH(kWidth, kHeight);
126 128
127 SkAutoTUnref<SkBBoxHierarchy> bbh; 129 SkAutoTUnref<SkBBoxHierarchy> bbh;
128 130
129 SkRecord rerecord; 131 SkRecord rerecord;
130 SkRecorder canvas(&rerecord, kWidth, kHeight); 132 SkRecorder canvas(&rerecord, kWidth, kHeight);
131 GrRecordReplaceDraw(pic, &canvas, &replacements, SkMatrix::I(), NULL/*callba ck*/); 133 GrRecordReplaceDraw(pic, &canvas, &replacements, SkMatrix::I(), NULL/*callba ck*/);
132 134
133 REPORTER_ASSERT(r, 7 == rerecord.count()); 135 REPORTER_ASSERT(r, 7 == rerecord.count());
134 assert_type<SkRecords::Save>(r, rerecord, 0); 136 assert_type<SkRecords::Save>(r, rerecord, 0);
135 assert_type<SkRecords::Save>(r, rerecord, 1); 137 assert_type<SkRecords::Save>(r, rerecord, 1);
136 assert_type<SkRecords::SetMatrix>(r, rerecord, 2); 138 assert_type<SkRecords::SetMatrix>(r, rerecord, 2);
137 assert_type<SkRecords::DrawImageRect>(r, rerecord, 3); 139 assert_type<SkRecords::DrawImageRect>(r, rerecord, 3);
138 assert_type<SkRecords::Restore>(r, rerecord, 4); 140 assert_type<SkRecords::Restore>(r, rerecord, 4);
139 assert_type<SkRecords::DrawRect>(r, rerecord, 5); 141 assert_type<SkRecords::DrawRect>(r, rerecord, 5);
140 assert_type<SkRecords::Restore>(r, rerecord, 6); 142 assert_type<SkRecords::Restore>(r, rerecord, 6);
141 } 143 }
142 144
143 DEF_TEST(RecordReplaceDraw_Replace, r) { test_replacements(r, false); } 145 DEF_TEST(RecordReplaceDraw_Replace, r) { test_replacements(r, false); }
144 DEF_TEST(RecordReplaceDraw_ReplaceWithBBH, r) { test_replacements(r, true); } 146 DEF_TEST(RecordReplaceDraw_ReplaceWithBBH, r) { test_replacements(r, true); }
145 147
146 #endif 148 #endif
OLDNEW
« src/gpu/GrLayerCache.h ('K') | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698