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

Side by Side Diff: experimental/nanomsg/picture_demo.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again Created 6 years, 3 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 | « dm/DMUtil.cpp ('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 "nanomsg/src/nn.h" 1 #include "nanomsg/src/nn.h"
2 #include "nanomsg/src/pipeline.h" 2 #include "nanomsg/src/pipeline.h"
3 #include "nanomsg/src/reqrep.h" 3 #include "nanomsg/src/reqrep.h"
4 4
5 #include "SkCanvas.h" 5 #include "SkCanvas.h"
6 #include "SkCommandLineFlags.h" 6 #include "SkCommandLineFlags.h"
7 #include "SkData.h" 7 #include "SkData.h"
8 #include "SkForceLinking.h" 8 #include "SkForceLinking.h"
9 #include "SkGraphics.h" 9 #include "SkGraphics.h"
10 #include "SkImageEncoder.h" 10 #include "SkImageEncoder.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Read the .skp. 75 // Read the .skp.
76 SkAutoTUnref<const SkData> skp(SkData::NewFromFileName(skpPath)); 76 SkAutoTUnref<const SkData> skp(SkData::NewFromFileName(skpPath));
77 if (!skp) { 77 if (!skp) {
78 SkDebugf("Couldn't read %s\n", skpPath); 78 SkDebugf("Couldn't read %s\n", skpPath);
79 exit(1); 79 exit(1);
80 } 80 }
81 SkMemoryStream stream(skp->data(), skp->size()); 81 SkMemoryStream stream(skp->data(), skp->size());
82 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&stream)); 82 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&stream));
83 83
84 PictureHeader header; 84 PictureHeader header;
85 SkRandom rand(picture->width() * picture->height()); 85 SkRandom rand(picture->cullRect().width() * picture->cullRect().height());
86 SkScalar r = rand.nextRangeScalar(0, picture->width()), 86 SkScalar r = rand.nextRangeScalar(0, picture->cullRect().width()),
87 b = rand.nextRangeScalar(0, picture->height()), 87 b = rand.nextRangeScalar(0, picture->cullRect().height()),
88 l = rand.nextRangeScalar(0, r), 88 l = rand.nextRangeScalar(0, r),
89 t = rand.nextRangeScalar(0, b); 89 t = rand.nextRangeScalar(0, b);
90 header.clip.setLTRB(l,t,r,b); 90 header.clip.setLTRB(l,t,r,b);
91 header.matrix.setTranslate(-l, -t); 91 header.matrix.setTranslate(-l, -t);
92 header.matrix.postRotate(rand.nextRangeScalar(-25, 25)); 92 header.matrix.postRotate(rand.nextRangeScalar(-25, 25));
93 header.alpha = 0x7F; 93 header.alpha = 0x7F;
94 94
95 //Clients use NN_REQ (request) type sockets. 95 //Clients use NN_REQ (request) type sockets.
96 int socket = nn_socket(AF_SP, NN_REQ); 96 int socket = nn_socket(AF_SP, NN_REQ);
97 97
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 server(FLAGS_data[0], FLAGS_control[0], &canvas); 199 server(FLAGS_data[0], FLAGS_control[0], &canvas);
200 canvas.flush(); 200 canvas.flush();
201 201
202 SkImageEncoder::EncodeFile(FLAGS_png[0], bitmap, SkImageEncoder::kPNG_Ty pe, 100); 202 SkImageEncoder::EncodeFile(FLAGS_png[0], bitmap, SkImageEncoder::kPNG_Ty pe, 100);
203 SkDebugf("Wrote %s.\n", FLAGS_png[0]); 203 SkDebugf("Wrote %s.\n", FLAGS_png[0]);
204 } 204 }
205 205
206 return 0; 206 return 0;
207 } 207 }
OLDNEW
« no previous file with comments | « dm/DMUtil.cpp ('k') | gm/distantclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698