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

Side by Side Diff: include/core/SkSurface.h

Issue 261783004: Add flag for SkGpuSurface creation to enable distance fields. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 | « no previous file | include/gpu/SkGpuDevice.h » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 #ifndef SkSurface_DEFINED 8 #ifndef SkSurface_DEFINED
9 #define SkSurface_DEFINED 9 #define SkSurface_DEFINED
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 /** 49 /**
50 * Helper version of NewRaster. It creates a SkImageInfo with the 50 * Helper version of NewRaster. It creates a SkImageInfo with the
51 * specified width and height, and populates the rest of info to match 51 * specified width and height, and populates the rest of info to match
52 * pixels in SkPMColor format. 52 * pixels in SkPMColor format.
53 */ 53 */
54 static SkSurface* NewRasterPMColor(int width, int height) { 54 static SkSurface* NewRasterPMColor(int width, int height) {
55 return NewRaster(SkImageInfo::MakeN32Premul(width, height)); 55 return NewRaster(SkImageInfo::MakeN32Premul(width, height));
56 } 56 }
57 57
58 /** 58 /**
59 * Text rendering modes that can be passed to NewRenderTarget*
60 */
61 enum TextRenderMode {
62 /**
63 * This will use the standard text rendering method
64 */
65 kStandard_TextRenderMode,
66 /**
67 * This will use signed distance fields for text rendering when possibl e
68 */
69 kDistanceField_TextRenderMode,
70 };
71
72 /**
59 * Return a new surface using the specified render target. 73 * Return a new surface using the specified render target.
60 */ 74 */
61 static SkSurface* NewRenderTargetDirect(GrRenderTarget*); 75 static SkSurface* NewRenderTargetDirect(GrRenderTarget*,
76 TextRenderMode trm = kStandard_TextR enderMode);
62 77
63 /** 78 /**
64 * Return a new surface whose contents will be drawn to an offscreen 79 * Return a new surface whose contents will be drawn to an offscreen
65 * render target, allocated by the surface. 80 * render target, allocated by the surface.
66 */ 81 */
67 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample Count = 0); 82 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample Count = 0,
83 TextRenderMode trm = kStandard_TextRenderM ode);
68 84
69 /** 85 /**
70 * Return a new surface whose contents will be drawn to an offscreen 86 * Return a new surface whose contents will be drawn to an offscreen
71 * render target, allocated by the surface from the scratch texture pool 87 * render target, allocated by the surface from the scratch texture pool
72 * managed by the GrContext. The scratch texture pool serves the purpose 88 * managed by the GrContext. The scratch texture pool serves the purpose
73 * of retaining textures after they are no longer in use in order to 89 * of retaining textures after they are no longer in use in order to
74 * re-use them later without having to re-allocate. Scratch textures 90 * re-use them later without having to re-allocate. Scratch textures
75 * should be used in cases where high turnover is expected. This allows, 91 * should be used in cases where high turnover is expected. This allows,
76 * for example, the copy on write to recycle a texture from a recently 92 * for example, the copy on write to recycle a texture from a recently
77 * released SkImage snapshot of the surface. 93 * released SkImage snapshot of the surface.
78 * Note: Scratch textures count against the GrContext's cached resource 94 * Note: Scratch textures count against the GrContext's cached resource
79 * budget. 95 * budget.
80 */ 96 */
81 static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount = 0); 97 static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount = 0,
98 TextRenderMode trm = kStandard_Text RenderMode);
82 99
83 int width() const { return fWidth; } 100 int width() const { return fWidth; }
84 int height() const { return fHeight; } 101 int height() const { return fHeight; }
85 102
86 /** 103 /**
87 * Returns a unique non-zero, unique value identifying the content of this 104 * Returns a unique non-zero, unique value identifying the content of this
88 * surface. Each time the content is changed changed, either by drawing 105 * surface. Each time the content is changed changed, either by drawing
89 * into this surface, or explicitly calling notifyContentChanged()) this 106 * into this surface, or explicitly calling notifyContentChanged()) this
90 * method will return a new value. 107 * method will return a new value.
91 * 108 *
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 195
179 private: 196 private:
180 const int fWidth; 197 const int fWidth;
181 const int fHeight; 198 const int fHeight;
182 uint32_t fGenerationID; 199 uint32_t fGenerationID;
183 200
184 typedef SkRefCnt INHERITED; 201 typedef SkRefCnt INHERITED;
185 }; 202 };
186 203
187 #endif 204 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698