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

Side by Side Diff: tests/ReadPixelsTest.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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
« no previous file with comments | « tests/PictureTest.cpp ('k') | tests/RecordDrawTest.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 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
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
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
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | tests/RecordDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698