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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 SkSurface* SkSurface::newSurface(const SkImageInfo& info) { | 176 SkSurface* SkSurface::newSurface(const SkImageInfo& info) { |
177 return asSB(this)->onNewSurface(info); | 177 return asSB(this)->onNewSurface(info); |
178 } | 178 } |
179 | 179 |
180 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, | 180 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, |
181 const SkPaint* paint) { | 181 const SkPaint* paint) { |
182 return asSB(this)->onDraw(canvas, x, y, paint); | 182 return asSB(this)->onDraw(canvas, x, y, paint); |
183 } | 183 } |
184 | 184 |
| 185 bool SkSurface::peekPixels(SkPixmap* pmap) { |
| 186 return this->getCanvas()->peekPixels(pmap); |
| 187 } |
| 188 |
| 189 #ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS |
185 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 190 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
186 return this->getCanvas()->peekPixels(info, rowBytes); | 191 SkPixmap pm; |
| 192 if (this->peekPixels(&pm)) { |
| 193 if (info) { |
| 194 *info = pm.info(); |
| 195 } |
| 196 if (rowBytes) { |
| 197 *rowBytes = pm.rowBytes(); |
| 198 } |
| 199 return pm.addr(); |
| 200 } |
| 201 return nullptr; |
187 } | 202 } |
| 203 #endif |
188 | 204 |
189 bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t d
stRowBytes, | 205 bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t d
stRowBytes, |
190 int srcX, int srcY) { | 206 int srcX, int srcY) { |
191 return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX,
srcY); | 207 return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX,
srcY); |
192 } | 208 } |
193 | 209 |
194 GrBackendObject SkSurface::getTextureHandle(BackendHandleAccess access) { | 210 GrBackendObject SkSurface::getTextureHandle(BackendHandleAccess access) { |
195 return asSB(this)->onGetTextureHandle(access); | 211 return asSB(this)->onGetTextureHandle(access); |
196 } | 212 } |
197 | 213 |
(...skipping 27 matching lines...) Expand all Loading... |
225 const SkSurfaceProps*) { | 241 const SkSurfaceProps*) { |
226 return nullptr; | 242 return nullptr; |
227 } | 243 } |
228 | 244 |
229 SkSurface* NewFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTextur
eDesc&, | 245 SkSurface* NewFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTextur
eDesc&, |
230 const SkSurfaceProps*) { | 246 const SkSurfaceProps*) { |
231 return nullptr; | 247 return nullptr; |
232 } | 248 } |
233 | 249 |
234 #endif | 250 #endif |
OLD | NEW |