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

Side by Side Diff: tools/skhello.cpp

Issue 784223007: Remove canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkResourceCacheTest.cpp ('k') | no next file » | 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 "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 15 matching lines...) Expand all
26 canvas->getClipBounds(&bounds); 26 canvas->getClipBounds(&bounds);
27 27
28 canvas->drawColor(SK_ColorWHITE); 28 canvas->drawColor(SK_ColorWHITE);
29 canvas->drawText(text, strlen(text), 29 canvas->drawText(text, strlen(text),
30 bounds.centerX(), bounds.centerY(), 30 bounds.centerX(), bounds.centerY(),
31 paint); 31 paint);
32 } 32 }
33 33
34 static bool do_surface(int w, int h, const char path[], const char text[], 34 static bool do_surface(int w, int h, const char path[], const char text[],
35 const SkPaint& paint) { 35 const SkPaint& paint) {
36 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(w, h)); 36 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(w, h));
37 doDraw(surface->getCanvas(), paint, text); 37 doDraw(surface->getCanvas(), paint, text);
38 38
39 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); 39 SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
40 SkAutoDataUnref data(image->encode()); 40 SkAutoDataUnref data(image->encode());
41 if (NULL == data.get()) { 41 if (NULL == data.get()) {
42 return false; 42 return false;
43 } 43 }
44 SkFILEWStream stream(path); 44 SkFILEWStream stream(path);
45 return stream.write(data->data(), data->size()); 45 return stream.write(data->data(), data->size());
46 } 46 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 } 102 }
103 return 0; 103 return 0;
104 } 104 }
105 105
106 #if !defined SK_BUILD_FOR_IOS 106 #if !defined SK_BUILD_FOR_IOS
107 int main(int argc, char * const argv[]) { 107 int main(int argc, char * const argv[]) {
108 return tool_main(argc, (char**) argv); 108 return tool_main(argc, (char**) argv);
109 } 109 }
110 #endif 110 #endif
OLDNEW
« no previous file with comments | « tests/SkResourceCacheTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698