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

Side by Side Diff: dm/DMUtil.cpp

Issue 238273012: Staged removal of SkPicture-derived classes (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: have SkPicture only friend SkPictureRecorder once Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « dm/DMUtil.h ('k') | gm/distantclip.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 #include "DMUtil.h" 1 #include "DMUtil.h"
2 2
3 #include "SkPicture.h" 3 #include "SkPicture.h"
4 4
5 namespace DM { 5 namespace DM {
6 6
7 SkString UnderJoin(const char* a, const char* b) { 7 SkString UnderJoin(const char* a, const char* b) {
8 SkString s; 8 SkString s;
9 s.appendf("%s_%s", a, b); 9 s.appendf("%s_%s", a, b);
10 return s; 10 return s;
11 } 11 }
12 12
13 SkPicture* RecordPicture(skiagm::GM* gm, uint32_t recordFlags, SkPictureFactory* factory) { 13 SkPicture* RecordPicture(skiagm::GM* gm, uint32_t recordFlags, SkBBHFactory* fac tory) {
14 const SkISize size = gm->getISize(); 14 const SkISize size = gm->getISize();
15 SkPictureRecorder recorder(factory); 15 SkPictureRecorder recorder;
16 SkCanvas* canvas = recorder.beginRecording(size.width(), size.height(), reco rdFlags); 16 SkCanvas* canvas = recorder.beginRecording(size.width(), size.height(), fact ory, recordFlags);
17 canvas->concat(gm->getInitialTransform()); 17 canvas->concat(gm->getInitialTransform());
18 gm->draw(canvas); 18 gm->draw(canvas);
19 canvas->flush(); 19 canvas->flush();
20 return recorder.endRecording(); 20 return recorder.endRecording();
21 } 21 }
22 22
23 static void setup_bitmap(SkColorType ct, int width, int height, SkBitmap* bitmap ) { 23 static void setup_bitmap(SkColorType ct, int width, int height, SkBitmap* bitmap ) {
24 bitmap->allocPixels(SkImageInfo::Make(width, height, ct, kPremul_SkAlphaType )); 24 bitmap->allocPixels(SkImageInfo::Make(width, height, ct, kPremul_SkAlphaType ));
25 bitmap->eraseColor(0x00000000); 25 bitmap->eraseColor(0x00000000);
26 } 26 }
(...skipping 13 matching lines...) Expand all
40 canvas.drawPicture(*picture); 40 canvas.drawPicture(*picture);
41 canvas.flush(); 41 canvas.flush();
42 } 42 }
43 43
44 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { 44 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) {
45 const SkAutoLockPixels lockA(a), lockB(b); 45 const SkAutoLockPixels lockA(a), lockB(b);
46 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels( ), b.getSize()); 46 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels( ), b.getSize());
47 } 47 }
48 48
49 } // namespace DM 49 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMUtil.h ('k') | gm/distantclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698