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