OLD | NEW |
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 #include "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 169 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
170 return this->getCanvas()->peekPixels(info, rowBytes); | 170 return this->getCanvas()->peekPixels(info, rowBytes); |
171 } | 171 } |
172 | 172 |
173 bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t d
stRowBytes, | 173 bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t d
stRowBytes, |
174 int srcX, int srcY) { | 174 int srcX, int srcY) { |
175 return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX,
srcY); | 175 return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX,
srcY); |
176 } | 176 } |
177 | 177 |
178 ////////////////////////////////////////////////////////////////////////////////
////// | 178 ////////////////////////////////////////////////////////////////////////////////
////// |
179 #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE | |
180 | |
181 static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) { | |
182 uint32_t propsFlags = 0; | |
183 if (SkSurface::kDistanceField_TextRenderMode == trm) { | |
184 propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag; | |
185 } | |
186 return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType); | |
187 } | |
188 | |
189 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, TextRenderMo
de trm) { | |
190 SkSurfaceProps props = make_props(trm); | |
191 return NewRenderTargetDirect(target, &props); | |
192 } | |
193 | |
194 SkSurface* SkSurface::NewRenderTarget(GrContext* gr, const SkImageInfo& info, in
t sampleCount, | |
195 TextRenderMode trm) { | |
196 SkSurfaceProps props = make_props(trm); | |
197 return NewRenderTarget(gr, info, sampleCount, &props); | |
198 } | |
199 | |
200 SkSurface* SkSurface::NewScratchRenderTarget(GrContext* gr, const SkImageInfo& i
nfo, int sampleCount, | |
201 TextRenderMode trm) { | |
202 SkSurfaceProps props = make_props(trm); | |
203 return NewScratchRenderTarget(gr, info, sampleCount, &props); | |
204 } | |
205 | |
206 #endif | |
207 | 179 |
208 #if !SK_SUPPORT_GPU | 180 #if !SK_SUPPORT_GPU |
209 | 181 |
210 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProp
s*) { | 182 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProp
s*) { |
211 return NULL; | 183 return NULL; |
212 } | 184 } |
213 | 185 |
214 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const
SkSurfaceProps*) { | 186 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const
SkSurfaceProps*) { |
215 return NULL; | 187 return NULL; |
216 } | 188 } |
217 | 189 |
218 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int
sampleCount, | 190 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int
sampleCount, |
219 const SkSurfaceProps*) { | 191 const SkSurfaceProps*) { |
220 return NULL; | 192 return NULL; |
221 } | 193 } |
222 | 194 |
223 #endif | 195 #endif |
OLD | NEW |