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/core/SkCanvas.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 8 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
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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1327
1328 SkImageInfo SkCanvas::imageInfo() const { 1328 SkImageInfo SkCanvas::imageInfo() const {
1329 SkBaseDevice* dev = this->getDevice(); 1329 SkBaseDevice* dev = this->getDevice();
1330 if (dev) { 1330 if (dev) {
1331 return dev->imageInfo(); 1331 return dev->imageInfo();
1332 } else { 1332 } else {
1333 return SkImageInfo::MakeUnknown(0, 0); 1333 return SkImageInfo::MakeUnknown(0, 0);
1334 } 1334 }
1335 } 1335 }
1336 1336
1337 bool SkCanvas::getProps(SkSurfaceProps* props) const {
1338 SkBaseDevice* dev = this->getDevice();
1339 if (dev) {
1340 if (props) {
1341 *props = fProps;
1342 }
1343 return true;
1344 } else {
1345 return false;
1346 }
1347 }
1348
1337 #ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS 1349 #ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS
1338 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { 1350 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) {
1339 SkPixmap pmap; 1351 SkPixmap pmap;
1340 if (this->peekPixels(&pmap)) { 1352 if (this->peekPixels(&pmap)) {
1341 if (info) { 1353 if (info) {
1342 *info = pmap.info(); 1354 *info = pmap.info();
1343 } 1355 }
1344 if (rowBytes) { 1356 if (rowBytes) {
1345 *rowBytes = pmap.rowBytes(); 1357 *rowBytes = pmap.rowBytes();
1346 } 1358 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 if (filter && !dstDev->canHandleImageFilter(filter)) { 1411 if (filter && !dstDev->canHandleImageFilter(filter)) {
1400 SkImageFilter::DeviceProxy proxy(dstDev); 1412 SkImageFilter::DeviceProxy proxy(dstDev);
1401 SkIPoint offset = SkIPoint::Make(0, 0); 1413 SkIPoint offset = SkIPoint::Make(0, 0);
1402 const SkBitmap& srcBM = srcDev->accessBitmap(false); 1414 const SkBitmap& srcBM = srcDev->accessBitmap(false);
1403 SkMatrix matrix = *iter.fMatrix; 1415 SkMatrix matrix = *iter.fMatrix;
1404 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() )); 1416 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1405 const SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x (), -pos.y()); 1417 const SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x (), -pos.y());
1406 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache ()); 1418 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache ());
1407 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 1419 SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
1408 1420
1409 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, srcBM)); 1421 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, srcBM,
1422 &dstDev ->surfaceProps()));
1410 if (!srcImg) { 1423 if (!srcImg) {
1411 continue; // something disastrous happened 1424 continue; // something disastrous happened
1412 } 1425 }
1413 1426
1414 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ct x, &offset)); 1427 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ct x, &offset));
1415 if (resultImg) { 1428 if (resultImg) {
1416 SkPaint tmpUnfiltered(*paint); 1429 SkPaint tmpUnfiltered(*paint);
1417 tmpUnfiltered.setImageFilter(nullptr); 1430 tmpUnfiltered.setImageFilter(nullptr);
1418 SkBitmap resultBM; 1431 SkBitmap resultBM;
1419 if (resultImg->internal_getBM(&resultBM)) { 1432 if (resultImg->internal_getBM(&resultBM)) {
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 3053
3041 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3054 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3042 fCanvas->restoreToCount(fSaveCount); 3055 fCanvas->restoreToCount(fSaveCount);
3043 } 3056 }
3044 3057
3045 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3058 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3046 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3059 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3047 return this->makeSurface(info, props).release(); 3060 return this->makeSurface(info, props).release();
3048 } 3061 }
3049 #endif 3062 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/core/SkDevice.cpp » ('j') | src/effects/SkImageSource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698