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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
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 bool SkSurface::readPixels(SkBitmap* dst, const SkIRect* srcRect) { | |
179 SkIRect storage; | |
180 if (NULL == srcRect) { | |
181 storage.set(0, 0, this->width(), this->height()); | |
182 srcRect = &storage; | |
183 } | |
184 return this->getCanvas()->readPixels(*srcRect, dst); | |
185 } | |
186 | |
187 ////////////////////////////////////////////////////////////////////////////////
////// | 178 ////////////////////////////////////////////////////////////////////////////////
////// |
188 #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE | 179 #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE |
189 | 180 |
190 static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) { | 181 static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) { |
191 uint32_t propsFlags = 0; | 182 uint32_t propsFlags = 0; |
192 if (SkSurface::kDistanceField_TextRenderMode == trm) { | 183 if (SkSurface::kDistanceField_TextRenderMode == trm) { |
193 propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag; | 184 propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag; |
194 } | 185 } |
195 return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType); | 186 return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType); |
196 } | 187 } |
(...skipping 26 matching lines...) Expand all Loading... |
223 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const
SkSurfaceProps*) { | 214 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const
SkSurfaceProps*) { |
224 return NULL; | 215 return NULL; |
225 } | 216 } |
226 | 217 |
227 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int
sampleCount, | 218 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int
sampleCount, |
228 const SkSurfaceProps*) { | 219 const SkSurfaceProps*) { |
229 return NULL; | 220 return NULL; |
230 } | 221 } |
231 | 222 |
232 #endif | 223 #endif |
OLD | NEW |