OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkMathPriv.h" | 10 #include "SkMathPriv.h" |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 | 549 |
550 SkPaint paint; | 550 SkPaint paint; |
551 paint.setFilterQuality(quality); | 551 paint.setFilterQuality(quality); |
552 | 552 |
553 canvas->translate(40, 100); | 553 canvas->translate(40, 100); |
554 canvas->rotate(30); | 554 canvas->rotate(30); |
555 canvas->scale(20, 30); | 555 canvas->scale(20, 30); |
556 canvas->translate(-SkScalarHalf(bm.width()), -SkScalarHalf(bm.height())); | 556 canvas->translate(-SkScalarHalf(bm.width()), -SkScalarHalf(bm.height())); |
557 canvas->drawBitmap(bm, 0, 0, &paint); | 557 canvas->drawBitmap(bm, 0, 0, &paint); |
558 | 558 |
559 SkAutoTUnref<SkImage> image(surf->newImageSnapshot()); | 559 return surf->makeImageSnapshot()->encode(); |
560 return image->encode(); | |
561 } | 560 } |
562 | 561 |
563 #include "SkStream.h" | 562 #include "SkStream.h" |
564 static void dump_to_file(const char name[], SkData* data) { | 563 static void dump_to_file(const char name[], SkData* data) { |
565 SkFILEWStream file(name); | 564 SkFILEWStream file(name); |
566 file.write(data->data(), data->size()); | 565 file.write(data->data(), data->size()); |
567 } | 566 } |
568 | 567 |
569 /* | 568 /* |
570 * Test two different ways to turn a subset of a bitmap into a texture | 569 * Test two different ways to turn a subset of a bitmap into a texture |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; | 616 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; |
618 | 617 |
619 REPORTER_ASSERT(reporter, dataA->equals(dataB)); | 618 REPORTER_ASSERT(reporter, dataA->equals(dataB)); |
620 if (false) { | 619 if (false) { |
621 dump_to_file("test_image_A.png", dataA); | 620 dump_to_file("test_image_A.png", dataA); |
622 dump_to_file("test_image_B.png", dataB); | 621 dump_to_file("test_image_B.png", dataB); |
623 } | 622 } |
624 } | 623 } |
625 } | 624 } |
626 #endif | 625 #endif |
OLD | NEW |