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

Side by Side Diff: site/user/api/canvas.md

Issue 1734043002: Revert of Move Budgeted enum out of SkSurface, use in GrTextureProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « include/gpu/GrTextureProvider.h ('k') | src/core/SkCanvas.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 Creating SkCanvas Objects 1 Creating SkCanvas Objects
2 ========================= 2 =========================
3 3
4 First, read about [the SkCanvas API](skcanvas). 4 First, read about [the SkCanvas API](skcanvas).
5 5
6 Skia has multiple backends which receive SkCanvas drawing commands, 6 Skia has multiple backends which receive SkCanvas drawing commands,
7 including: 7 including:
8 8
9 - [Raster](#raster) - CPU-only. 9 - [Raster](#raster) - CPU-only.
10 - [Ganesh](#ganesh) - Skia's GPU-accelerated backend. 10 - [Ganesh](#ganesh) - Skia's GPU-accelerated backend.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 #include "SkImage.h" 83 #include "SkImage.h"
84 #include "SkStream.h" 84 #include "SkStream.h"
85 #include "SkSurface.h" 85 #include "SkSurface.h"
86 void ganesh(int width, int height, 86 void ganesh(int width, int height,
87 void(*draw)(SkCanvas*), 87 void(*draw)(SkCanvas*),
88 const char* path) { 88 const char* path) {
89 GrContextFactory grFactory; 89 GrContextFactory grFactory;
90 GrContext* context = grFactory.get(GrContextFactory::kNative_GLContextTy pe); 90 GrContext* context = grFactory.get(GrContextFactory::kNative_GLContextTy pe);
91 SkImageInfo info = SkImageInfo:: MakeN32Premul(width, height); 91 SkImageInfo info = SkImageInfo:: MakeN32Premul(width, height);
92 SkAutoTUnref<SkSurface> gpuSurface( 92 SkAutoTUnref<SkSurface> gpuSurface(
93 SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info)); 93 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, inf o));
94 if (!gpuSurface) { 94 if (!gpuSurface) {
95 SkDebugf("SkSurface::NewRenderTarget returned null\n"); 95 SkDebugf("SkSurface::NewRenderTarget returned null\n");
96 return; 96 return;
97 } 97 }
98 SkCanvas* gpuCanvas = gpuSurface->getCanvas(); 98 SkCanvas* gpuCanvas = gpuSurface->getCanvas();
99 draw(gpuCanvas); 99 draw(gpuCanvas);
100 SkAutoTUnref<SkImage> img(s->newImageSnapshot()); 100 SkAutoTUnref<SkImage> img(s->newImageSnapshot());
101 if (!img) { return; } 101 if (!img) { return; }
102 SkAutoTUnref<SkData> png(img->encode()); 102 SkAutoTUnref<SkData> png(img->encode());
103 if (!png) { return; } 103 if (!png) { return; }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 canvas->clear(SK_ColorWHITE); 241 canvas->clear(SK_ColorWHITE);
242 canvas->translate(0.5f * scale, 0.5f * scale); 242 canvas->translate(0.5f * scale, 0.5f * scale);
243 canvas->drawPath(path, p); 243 canvas->drawPath(path, p);
244 } 244 }
245 DEF_TEST(FourBackends, r) { 245 DEF_TEST(FourBackends, r) {
246 raster( 256, 256, example, "out_raster.png" ); 246 raster( 256, 256, example, "out_raster.png" );
247 ganesh( 256, 256, example, "out_ganesh.png" ); 247 ganesh( 256, 256, example, "out_ganesh.png" );
248 skpdf( 256, 256, example, "out_skpdf.pdf" ); 248 skpdf( 256, 256, example, "out_skpdf.pdf" );
249 picture(256, 256, example, "out_picture.skp"); 249 picture(256, 256, example, "out_picture.skp");
250 } 250 }
OLDNEW
« no previous file with comments | « include/gpu/GrTextureProvider.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698