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

Side by Side Diff: tools/skhello.cpp

Issue 24130009: promote SkImage::AlphaType to SkAlphaType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tests/SurfaceTest.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 12 matching lines...) Expand all
23 canvas->getClipBounds(&bounds); 23 canvas->getClipBounds(&bounds);
24 24
25 canvas->drawColor(SK_ColorWHITE); 25 canvas->drawColor(SK_ColorWHITE);
26 canvas->drawText(text, strlen(text), 26 canvas->drawText(text, strlen(text),
27 bounds.centerX(), bounds.centerY(), 27 bounds.centerX(), bounds.centerY(),
28 paint); 28 paint);
29 } 29 }
30 30
31 static bool do_surface(int w, int h, const char path[], const char text[], 31 static bool do_surface(int w, int h, const char path[], const char text[],
32 const SkPaint& paint) { 32 const SkPaint& paint) {
33 SkImage::Info info = { 33 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(w, h));
34 w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType
35 };
36 SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
37 doDraw(surface->getCanvas(), paint, text); 34 doDraw(surface->getCanvas(), paint, text);
38 35
39 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); 36 SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
40 SkAutoDataUnref data(image->encode()); 37 SkAutoDataUnref data(image->encode());
41 if (NULL == data.get()) { 38 if (NULL == data.get()) {
42 return false; 39 return false;
43 } 40 }
44 SkFILEWStream stream(path); 41 SkFILEWStream stream(path);
45 return stream.write(data->data(), data->size()); 42 return stream.write(data->data(), data->size());
46 } 43 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 98 }
102 } 99 }
103 return 0; 100 return 0;
104 } 101 }
105 102
106 #if !defined SK_BUILD_FOR_IOS 103 #if !defined SK_BUILD_FOR_IOS
107 int main(int argc, char * const argv[]) { 104 int main(int argc, char * const argv[]) {
108 return tool_main(argc, (char**) argv); 105 return tool_main(argc, (char**) argv);
109 } 106 }
110 #endif 107 #endif
OLDNEW
« no previous file with comments | « tests/SurfaceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698