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

Side by Side Diff: tests/TileGridTest.cpp

Issue 239703006: Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public API (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/PictureTest.cpp ('k') | tools/PictureRenderer.cpp » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkTileGrid.h" 10 #include "SkTileGrid.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SkTileGridPicture::TileGridInfo info; 55 SkTileGridPicture::TileGridInfo info;
56 info.fMargin.setEmpty(); 56 info.fMargin.setEmpty();
57 info.fOffset.setZero(); 57 info.fOffset.setZero();
58 info.fTileInterval.set(10, 10); 58 info.fTileInterval.set(10, 10);
59 SkRect rect1 = SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0), 59 SkRect rect1 = SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0),
60 SkIntToScalar(8), SkIntToScalar(8)); 60 SkIntToScalar(8), SkIntToScalar(8));
61 SkRect rect2 = SkRect::MakeXYWH(SkIntToScalar(11), SkIntToScalar(11), 61 SkRect rect2 = SkRect::MakeXYWH(SkIntToScalar(11), SkIntToScalar(11),
62 SkIntToScalar(1), SkIntToScalar(1)); 62 SkIntToScalar(1), SkIntToScalar(1));
63 SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (info))); 63 SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (info)));
64 SkPictureRecorder recorder(factory); 64 SkPictureRecorder recorder(factory);
65 SkCanvas* canvas = recorder.beginRecording(20, 20, SkPicture::kOptimizeForCl ippedPlayback_RecordingFlag); 65 SkCanvas* canvas = recorder.beginRecording(20, 20);
66 SkPaint paint; 66 SkPaint paint;
67 canvas->drawRect(rect1, paint); 67 canvas->drawRect(rect1, paint);
68 canvas->drawRect(rect2, paint); 68 canvas->drawRect(rect2, paint);
69 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 69 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
70 70
71 SkBitmap store; 71 SkBitmap store;
72 store.allocN32Pixels(1, 1); 72 store.allocN32Pixels(1, 1);
73 73
74 // Test parts of top-left tile 74 // Test parts of top-left tile
75 { 75 {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 SkRect rect1 = SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0), 144 SkRect rect1 = SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0),
145 SkIntToScalar(1), SkIntToScalar(1)); 145 SkIntToScalar(1), SkIntToScalar(1));
146 // rect landing entirely in center tile 146 // rect landing entirely in center tile
147 SkRect rect2 = SkRect::MakeXYWH(SkIntToScalar(12), SkIntToScalar(12), 147 SkRect rect2 = SkRect::MakeXYWH(SkIntToScalar(12), SkIntToScalar(12),
148 SkIntToScalar(1), SkIntToScalar(1)); 148 SkIntToScalar(1), SkIntToScalar(1));
149 // rect landing entirely in bottomright tile 149 // rect landing entirely in bottomright tile
150 SkRect rect3 = SkRect::MakeXYWH(SkIntToScalar(19), SkIntToScalar(19), 150 SkRect rect3 = SkRect::MakeXYWH(SkIntToScalar(19), SkIntToScalar(19),
151 SkIntToScalar(1), SkIntToScalar(1)); 151 SkIntToScalar(1), SkIntToScalar(1));
152 SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (info))); 152 SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory, (info)));
153 SkPictureRecorder recorder(factory); 153 SkPictureRecorder recorder(factory);
154 SkCanvas* canvas = recorder.beginRecording(20, 20, SkPicture::kOptimizeForCl ippedPlayback_RecordingFlag); 154 SkCanvas* canvas = recorder.beginRecording(20, 20);
155 SkPaint paint; 155 SkPaint paint;
156 canvas->drawRect(rect1, paint); 156 canvas->drawRect(rect1, paint);
157 canvas->drawRect(rect2, paint); 157 canvas->drawRect(rect2, paint);
158 canvas->drawRect(rect3, paint); 158 canvas->drawRect(rect3, paint);
159 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 159 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
160 160
161 SkBitmap tileBitmap; 161 SkBitmap tileBitmap;
162 tileBitmap.allocN32Pixels(10, 10); 162 tileBitmap.allocN32Pixels(10, 10);
163 SkBitmap moreThanATileBitmap; 163 SkBitmap moreThanATileBitmap;
164 moreThanATileBitmap.allocN32Pixels(11, 11); 164 moreThanATileBitmap.allocN32Pixels(11, 11);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 verifyTileHits(reporter, SkIRect::MakeXYWH(10, 10, 1, 1), kBottomRight_Tile , 1); 243 verifyTileHits(reporter, SkIRect::MakeXYWH(10, 10, 1, 1), kBottomRight_Tile , 1);
244 verifyTileHits(reporter, SkIRect::MakeXYWH(17, 17, 1, 1), kBottomRight_Tile , 1); 244 verifyTileHits(reporter, SkIRect::MakeXYWH(17, 17, 1, 1), kBottomRight_Tile , 1);
245 245
246 // BBoxes that overlap tiles 246 // BBoxes that overlap tiles
247 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 1), kTopLeft_Tile | kT opRight_Tile); 247 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 1), kTopLeft_Tile | kT opRight_Tile);
248 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 1, 10), kTopLeft_Tile | 248 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 1, 10), kTopLeft_Tile |
249 kBottomLeft_Tile); 249 kBottomLeft_Tile);
250 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 10), kAll_Tile); 250 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 10), kAll_Tile);
251 verifyTileHits(reporter, SkIRect::MakeXYWH(-10, -10, 40, 40), kAll_Tile); 251 verifyTileHits(reporter, SkIRect::MakeXYWH(-10, -10, 40, 40), kAll_Tile);
252 } 252 }
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | tools/PictureRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698