OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrContext.h" | 8 #include "GrContext.h" |
9 #include "GrContextOptions.h" | 9 #include "GrContextOptions.h" |
10 #include "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } else { | 237 } else { |
238 fDrawingManager->flush(); | 238 fDrawingManager->flush(); |
239 } | 239 } |
240 fResourceCache->notifyFlushOccurred(); | 240 fResourceCache->notifyFlushOccurred(); |
241 fFlushToReduceCacheSize = false; | 241 fFlushToReduceCacheSize = false; |
242 } | 242 } |
243 | 243 |
244 bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t
inRowBytes, | 244 bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t
inRowBytes, |
245 const void* inPixels, size_t outRowBytes, void* outPix
els) { | 245 const void* inPixels, size_t outRowBytes, void* outPix
els) { |
246 SkSrcPixelInfo srcPI; | 246 SkSrcPixelInfo srcPI; |
247 if (!GrPixelConfigToColorAndColorSpace(srcConfig, &srcPI.fColorType, nullptr
)) { | 247 if (!GrPixelConfig2ColorAndProfileType(srcConfig, &srcPI.fColorType, nullptr
)) { |
248 return false; | 248 return false; |
249 } | 249 } |
250 srcPI.fAlphaType = kUnpremul_SkAlphaType; | 250 srcPI.fAlphaType = kUnpremul_SkAlphaType; |
251 srcPI.fPixels = inPixels; | 251 srcPI.fPixels = inPixels; |
252 srcPI.fRowBytes = inRowBytes; | 252 srcPI.fRowBytes = inRowBytes; |
253 | 253 |
254 SkDstPixelInfo dstPI; | 254 SkDstPixelInfo dstPI; |
255 dstPI.fColorType = srcPI.fColorType; | 255 dstPI.fColorType = srcPI.fColorType; |
256 dstPI.fAlphaType = kPremul_SkAlphaType; | 256 dstPI.fAlphaType = kPremul_SkAlphaType; |
257 dstPI.fPixels = outPixels; | 257 dstPI.fPixels = outPixels; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 configToRead = tempDrawInfo.fReadConfig; | 504 configToRead = tempDrawInfo.fReadConfig; |
505 } | 505 } |
506 if (!fGpu->readPixels(surfaceToRead, left, top, width, height, configToRead,
buffer, | 506 if (!fGpu->readPixels(surfaceToRead, left, top, width, height, configToRead,
buffer, |
507 rowBytes)) { | 507 rowBytes)) { |
508 return false; | 508 return false; |
509 } | 509 } |
510 | 510 |
511 // Perform umpremul conversion if we weren't able to perform it as a draw. | 511 // Perform umpremul conversion if we weren't able to perform it as a draw. |
512 if (unpremul) { | 512 if (unpremul) { |
513 SkDstPixelInfo dstPI; | 513 SkDstPixelInfo dstPI; |
514 if (!GrPixelConfigToColorAndColorSpace(dstConfig, &dstPI.fColorType, nul
lptr)) { | 514 if (!GrPixelConfig2ColorAndProfileType(dstConfig, &dstPI.fColorType, nul
lptr)) { |
515 return false; | 515 return false; |
516 } | 516 } |
517 dstPI.fAlphaType = kUnpremul_SkAlphaType; | 517 dstPI.fAlphaType = kUnpremul_SkAlphaType; |
518 dstPI.fPixels = buffer; | 518 dstPI.fPixels = buffer; |
519 dstPI.fRowBytes = rowBytes; | 519 dstPI.fRowBytes = rowBytes; |
520 | 520 |
521 SkSrcPixelInfo srcPI; | 521 SkSrcPixelInfo srcPI; |
522 srcPI.fColorType = dstPI.fColorType; | 522 srcPI.fColorType = dstPI.fColorType; |
523 srcPI.fAlphaType = kPremul_SkAlphaType; | 523 srcPI.fAlphaType = kPremul_SkAlphaType; |
524 srcPI.fPixels = buffer; | 524 srcPI.fPixels = buffer; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 ASSERT_SINGLE_OWNER | 764 ASSERT_SINGLE_OWNER |
765 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 765 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
766 } | 766 } |
767 | 767 |
768 ////////////////////////////////////////////////////////////////////////////// | 768 ////////////////////////////////////////////////////////////////////////////// |
769 | 769 |
770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
771 ASSERT_SINGLE_OWNER | 771 ASSERT_SINGLE_OWNER |
772 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 772 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
773 } | 773 } |
OLD | NEW |