| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 static void draw_something(SkCanvas* canvas) { | 390 static void draw_something(SkCanvas* canvas) { |
| 391 SkPaint paint; | 391 SkPaint paint; |
| 392 SkBitmap bitmap; | 392 SkBitmap bitmap; |
| 393 make_checkerboard_bitmap(bitmap); | 393 make_checkerboard_bitmap(bitmap); |
| 394 | 394 |
| 395 canvas->save(); | 395 canvas->save(); |
| 396 canvas->scale(0.5f, 0.5f); | 396 canvas->scale(0.5f, 0.5f); |
| 397 canvas->drawBitmap(bitmap, 0, 0, NULL); | 397 canvas->drawBitmap(bitmap, 0, 0, NULL); |
| 398 canvas->restore(); | 398 canvas->restore(); |
| 399 | 399 |
| 400 const char beforeStr[] = "before circle"; | |
| 401 const char afterStr[] = "after circle"; | |
| 402 | |
| 403 paint.setAntiAlias(true); | 400 paint.setAntiAlias(true); |
| 404 | 401 |
| 405 paint.setColor(SK_ColorRED); | 402 paint.setColor(SK_ColorRED); |
| 406 canvas->drawData(beforeStr, sizeof(beforeStr)); | |
| 407 canvas->drawCircle(SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/2
), SkIntToScalar(kBitmapSize/3), paint); | 403 canvas->drawCircle(SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/2
), SkIntToScalar(kBitmapSize/3), paint); |
| 408 canvas->drawData(afterStr, sizeof(afterStr)); | |
| 409 paint.setColor(SK_ColorBLACK); | 404 paint.setColor(SK_ColorBLACK); |
| 410 paint.setTextSize(SkIntToScalar(kBitmapSize/3)); | 405 paint.setTextSize(SkIntToScalar(kBitmapSize/3)); |
| 411 canvas->drawText("Picture", 7, SkIntToScalar(kBitmapSize/2), SkIntToScalar(k
BitmapSize/4), paint); | 406 canvas->drawText("Picture", 7, SkIntToScalar(kBitmapSize/2), SkIntToScalar(k
BitmapSize/4), paint); |
| 412 } | 407 } |
| 413 | 408 |
| 414 DEF_TEST(Serialization, reporter) { | 409 DEF_TEST(Serialization, reporter) { |
| 415 // Test matrix serialization | 410 // Test matrix serialization |
| 416 { | 411 { |
| 417 SkMatrix matrix = SkMatrix::I(); | 412 SkMatrix matrix = SkMatrix::I(); |
| 418 TestObjectSerialization(&matrix, reporter); | 413 TestObjectSerialization(&matrix, reporter); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 517 |
| 523 // Deserialize picture | 518 // Deserialize picture |
| 524 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); | 519 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); |
| 525 SkAutoTUnref<SkPicture> readPict( | 520 SkAutoTUnref<SkPicture> readPict( |
| 526 SkPicture::CreateFromBuffer(reader)); | 521 SkPicture::CreateFromBuffer(reader)); |
| 527 REPORTER_ASSERT(reporter, readPict.get()); | 522 REPORTER_ASSERT(reporter, readPict.get()); |
| 528 } | 523 } |
| 529 | 524 |
| 530 TestPictureTypefaceSerialization(reporter); | 525 TestPictureTypefaceSerialization(reporter); |
| 531 } | 526 } |
| OLD | NEW |