OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 tmp.translate(5, -3); | 273 tmp.translate(5, -3); |
274 | 274 |
275 { | 275 { |
276 char buffer[1000]; | 276 char buffer[1000]; |
277 SkDEBUGCODE(size_t size = ) tmp.writeToMemory(NULL); | 277 SkDEBUGCODE(size_t size = ) tmp.writeToMemory(NULL); |
278 SkASSERT(size <= sizeof(buffer)); | 278 SkASSERT(size <= sizeof(buffer)); |
279 SkDEBUGCODE(size_t size2 = ) tmp.writeToMemory(buffer); | 279 SkDEBUGCODE(size_t size2 = ) tmp.writeToMemory(buffer); |
280 SkASSERT(size == size2); | 280 SkASSERT(size == size2); |
281 | 281 |
282 SkRegion tmp3; | 282 SkRegion tmp3; |
283 SkDEBUGCODE(size2 = ) tmp3.readFromMemory(buffer); | 283 SkDEBUGCODE(size2 = ) tmp3.readFromMemory(buffer, 1000); |
284 SkASSERT(size == size2); | 284 SkASSERT(size == size2); |
285 | 285 |
286 SkASSERT(tmp3 == tmp); | 286 SkASSERT(tmp3 == tmp); |
287 } | 287 } |
288 | 288 |
289 rgn.translate(20, 30, &tmp); | 289 rgn.translate(20, 30, &tmp); |
290 SkASSERT(rgn.isEmpty() || tmp != rgn); | 290 SkASSERT(rgn.isEmpty() || tmp != rgn); |
291 tmp.translate(-20, -30); | 291 tmp.translate(-20, -30); |
292 SkASSERT(tmp == rgn); | 292 SkASSERT(tmp == rgn); |
293 } | 293 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 private: | 409 private: |
410 SkIRect fBase, fRect; | 410 SkIRect fBase, fRect; |
411 | 411 |
412 typedef SampleView INHERITED; | 412 typedef SampleView INHERITED; |
413 }; | 413 }; |
414 | 414 |
415 ////////////////////////////////////////////////////////////////////////////// | 415 ////////////////////////////////////////////////////////////////////////////// |
416 | 416 |
417 static SkView* MyFactory() { return new RegionView; } | 417 static SkView* MyFactory() { return new RegionView; } |
418 static SkViewRegister reg(MyFactory); | 418 static SkViewRegister reg(MyFactory); |
OLD | NEW |