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

Side by Side Diff: src/image/SkSurface.cpp

Issue 1784563002: unify peekPixels around pixmap parameter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update GrUploadPixmapToTexture to know about the new desc if readPixels was called Created 4 years, 9 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 | « src/image/SkImage_Raster.cpp ('k') | tests/CanvasTest.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 /* 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
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
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
OLDNEW
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698