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

Side by Side Diff: src/core/SkCanvas.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 | « include/core/SkSurface.h ('k') | src/core/SkSpecialImage.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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 1328
1329 SkImageInfo SkCanvas::imageInfo() const { 1329 SkImageInfo SkCanvas::imageInfo() const {
1330 SkBaseDevice* dev = this->getDevice(); 1330 SkBaseDevice* dev = this->getDevice();
1331 if (dev) { 1331 if (dev) {
1332 return dev->imageInfo(); 1332 return dev->imageInfo();
1333 } else { 1333 } else {
1334 return SkImageInfo::MakeUnknown(0, 0); 1334 return SkImageInfo::MakeUnknown(0, 0);
1335 } 1335 }
1336 } 1336 }
1337 1337
1338 #ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS
1338 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { 1339 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) {
1339 SkPixmap pmap; 1340 SkPixmap pmap;
1340 if (!this->onPeekPixels(&pmap)) { 1341 if (this->peekPixels(&pmap)) {
1341 return nullptr; 1342 if (info) {
1343 *info = pmap.info();
1344 }
1345 if (rowBytes) {
1346 *rowBytes = pmap.rowBytes();
1347 }
1348 return pmap.addr();
1342 } 1349 }
1343 if (info) { 1350 return nullptr;
1344 *info = pmap.info(); 1351 }
1345 } 1352 #endif
1346 if (rowBytes) { 1353
1347 *rowBytes = pmap.rowBytes(); 1354 bool SkCanvas::peekPixels(SkPixmap* pmap) {
1348 } 1355 return this->onPeekPixels(pmap);
1349 return pmap.addr();
1350 } 1356 }
1351 1357
1352 bool SkCanvas::onPeekPixels(SkPixmap* pmap) { 1358 bool SkCanvas::onPeekPixels(SkPixmap* pmap) {
1353 SkBaseDevice* dev = this->getDevice(); 1359 SkBaseDevice* dev = this->getDevice();
1354 return dev && dev->peekPixels(pmap); 1360 return dev && dev->peekPixels(pmap);
1355 } 1361 }
1356 1362
1357 void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoi nt* origin) { 1363 void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoi nt* origin) {
1358 SkPixmap pmap; 1364 SkPixmap pmap;
1359 if (!this->onAccessTopLayerPixels(&pmap)) { 1365 if (!this->onAccessTopLayerPixels(&pmap)) {
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
3029 } 3035 }
3030 3036
3031 if (matrix) { 3037 if (matrix) {
3032 canvas->concat(*matrix); 3038 canvas->concat(*matrix);
3033 } 3039 }
3034 } 3040 }
3035 3041
3036 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3042 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3037 fCanvas->restoreToCount(fSaveCount); 3043 fCanvas->restoreToCount(fSaveCount);
3038 } 3044 }
OLDNEW
« no previous file with comments | « include/core/SkSurface.h ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698