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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 791823003: Add sRGB texture support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add in changes for copy_to_new_texture_pixelref Created 6 years 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 fDrawBuffer->reset(); 1215 fDrawBuffer->reset();
1216 } else { 1216 } else {
1217 fDrawBuffer->flush(); 1217 fDrawBuffer->flush();
1218 } 1218 }
1219 fFlushToReduceCacheSize = false; 1219 fFlushToReduceCacheSize = false;
1220 } 1220 }
1221 1221
1222 bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes, 1222 bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes,
1223 const void* inPixels, size_t outRowBytes, void* outPix els) { 1223 const void* inPixels, size_t outRowBytes, void* outPix els) {
1224 SkSrcPixelInfo srcPI; 1224 SkSrcPixelInfo srcPI;
1225 if (!GrPixelConfig2ColorType(srcConfig, &srcPI.fColorType)) { 1225 if (!GrPixelConfig2ColorAndProfileType(srcConfig, &srcPI.fColorType, NULL)) {
1226 return false; 1226 return false;
1227 } 1227 }
1228 srcPI.fAlphaType = kUnpremul_SkAlphaType; 1228 srcPI.fAlphaType = kUnpremul_SkAlphaType;
1229 srcPI.fPixels = inPixels; 1229 srcPI.fPixels = inPixels;
1230 srcPI.fRowBytes = inRowBytes; 1230 srcPI.fRowBytes = inRowBytes;
1231 1231
1232 SkDstPixelInfo dstPI; 1232 SkDstPixelInfo dstPI;
1233 dstPI.fColorType = srcPI.fColorType; 1233 dstPI.fColorType = srcPI.fColorType;
1234 dstPI.fAlphaType = kPremul_SkAlphaType; 1234 dstPI.fAlphaType = kPremul_SkAlphaType;
1235 dstPI.fPixels = outPixels; 1235 dstPI.fPixels = outPixels;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 } 1476 }
1477 1477
1478 if (!fGpu->readPixels(target, 1478 if (!fGpu->readPixels(target,
1479 left, top, width, height, 1479 left, top, width, height,
1480 readConfig, buffer, rowBytes)) { 1480 readConfig, buffer, rowBytes)) {
1481 return false; 1481 return false;
1482 } 1482 }
1483 // Perform any conversions we weren't able to perform using a scratch textur e. 1483 // Perform any conversions we weren't able to perform using a scratch textur e.
1484 if (unpremul || swapRAndB) { 1484 if (unpremul || swapRAndB) {
1485 SkDstPixelInfo dstPI; 1485 SkDstPixelInfo dstPI;
1486 if (!GrPixelConfig2ColorType(dstConfig, &dstPI.fColorType)) { 1486 if (!GrPixelConfig2ColorAndProfileType(dstConfig, &dstPI.fColorType, NUL L)) {
1487 return false; 1487 return false;
1488 } 1488 }
1489 dstPI.fAlphaType = kUnpremul_SkAlphaType; 1489 dstPI.fAlphaType = kUnpremul_SkAlphaType;
1490 dstPI.fPixels = buffer; 1490 dstPI.fPixels = buffer;
1491 dstPI.fRowBytes = rowBytes; 1491 dstPI.fRowBytes = rowBytes;
1492 1492
1493 SkSrcPixelInfo srcPI; 1493 SkSrcPixelInfo srcPI;
1494 srcPI.fColorType = swapRAndB ? toggle_colortype32(dstPI.fColorType) : ds tPI.fColorType; 1494 srcPI.fColorType = swapRAndB ? toggle_colortype32(dstPI.fColorType) : ds tPI.fColorType;
1495 srcPI.fAlphaType = kPremul_SkAlphaType; 1495 srcPI.fAlphaType = kPremul_SkAlphaType;
1496 srcPI.fPixels = buffer; 1496 srcPI.fPixels = buffer;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 fResourceCache2->printStats(); 1736 fResourceCache2->printStats();
1737 } 1737 }
1738 #endif 1738 #endif
1739 1739
1740 #if GR_GPU_STATS 1740 #if GR_GPU_STATS
1741 const GrContext::GPUStats* GrContext::gpuStats() const { 1741 const GrContext::GPUStats* GrContext::gpuStats() const {
1742 return fGpu->gpuStats(); 1742 return fGpu->gpuStats();
1743 } 1743 }
1744 #endif 1744 #endif
1745 1745
OLDNEW
« include/core/SkPixelRef.h ('K') | « src/core/SkBitmap.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698