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

Side by Side Diff: dm/DMSrcSink.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 | « bench/SkLinearBitmapPipelineBench.cpp ('k') | example/HelloWorld.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 2015 Google Inc. 2 * Copyright 2015 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 "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SkAndroidCodec.h" 9 #include "SkAndroidCodec.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 SkASSERT(false); 811 SkASSERT(false);
812 return "Invalid image generator mode"; 812 return "Invalid image generator mode";
813 } 813 }
814 814
815 // Test deferred decoding path on GPU 815 // Test deferred decoding path on GPU
816 if (fIsGpu) { 816 if (fIsGpu) {
817 // FIXME: The gpu backend does not draw kGray sources correctly. (skbug. com/4822) 817 // FIXME: The gpu backend does not draw kGray sources correctly. (skbug. com/4822)
818 // We have disabled these tests in DM.cpp. 818 // We have disabled these tests in DM.cpp.
819 SkASSERT(kGray_8_SkColorType != gen->getInfo().colorType()); 819 SkASSERT(kGray_8_SkColorType != gen->getInfo().colorType());
820 820
821 SkAutoTDelete<SkImage> image(SkImage::NewFromGenerator(gen.release(), nu llptr)); 821 sk_sp<SkImage> image(SkImage::MakeFromGenerator(gen.release(), nullptr)) ;
822 if (!image) { 822 if (!image) {
823 return "Could not create image from codec image generator."; 823 return "Could not create image from codec image generator.";
824 } 824 }
825 canvas->drawImage(image, 0, 0); 825 canvas->drawImage(image, 0, 0);
826 return ""; 826 return "";
827 } 827 }
828 828
829 // Test various color and alpha types on CPU 829 // Test various color and alpha types on CPU
830 SkImageInfo decodeInfo = gen->getInfo().makeAlphaType(fDstAlphaType); 830 SkImageInfo decodeInfo = gen->getInfo().makeAlphaType(fDstAlphaType);
831 831
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 surfaces.push(s); 1308 surfaces.push(s);
1309 SkCanvas* c = s->getCanvas(); 1309 SkCanvas* c = s->getCanvas();
1310 c->translate(SkIntToScalar(-i * fW), 1310 c->translate(SkIntToScalar(-i * fW),
1311 SkIntToScalar(-j * fH)); // Line up the canvas wit h this tile. 1311 SkIntToScalar(-j * fH)); // Line up the canvas wit h this tile.
1312 mpd.add(c, pic); 1312 mpd.add(c, pic);
1313 } 1313 }
1314 } 1314 }
1315 mpd.draw(); 1315 mpd.draw();
1316 for (int j = 0; j < yTiles; j++) { 1316 for (int j = 0; j < yTiles; j++) {
1317 for (int i = 0; i < xTiles; i++) { 1317 for (int i = 0; i < xTiles; i++) {
1318 SkAutoTUnref<SkImage> image(surfaces[i+xTiles*j]->newImageSnapsh ot()); 1318 sk_sp<SkImage> image(surfaces[i+xTiles*j]->makeImageSnapshot());
1319 canvas->drawImage(image, SkIntToScalar(i*fW), SkIntToScalar(j*fH )); 1319 canvas->drawImage(image, SkIntToScalar(i*fW), SkIntToScalar(j*fH ));
1320 } 1320 }
1321 } 1321 }
1322 surfaces.unrefAll(); 1322 surfaces.unrefAll();
1323 return ""; 1323 return "";
1324 }); 1324 });
1325 } 1325 }
1326 1326
1327 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 1327 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1328 1328
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 skr.visit<void>(i, drawsAsSingletonPictures); 1495 skr.visit<void>(i, drawsAsSingletonPictures);
1496 } 1496 }
1497 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1497 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1498 1498
1499 canvas->drawPicture(macroPic); 1499 canvas->drawPicture(macroPic);
1500 return check_against_reference(bitmap, src, fSink); 1500 return check_against_reference(bitmap, src, fSink);
1501 }); 1501 });
1502 } 1502 }
1503 1503
1504 } // namespace DM 1504 } // namespace DM
OLDNEW
« no previous file with comments | « bench/SkLinearBitmapPipelineBench.cpp ('k') | example/HelloWorld.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698