| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 } | 483 } |
| 484 | 484 |
| 485 SkImageInfo info; | 485 SkImageInfo info; |
| 486 if (surface_->color_params().GetSkColorSpaceForSkSurfaces()) { | 486 if (surface_->color_params().GetSkColorSpaceForSkSurfaces()) { |
| 487 info = SkImageInfo::Make( | 487 info = SkImageInfo::Make( |
| 488 source_rect.Width(), source_rect.Height(), | 488 source_rect.Width(), source_rect.Height(), |
| 489 surface_->color_params().GetSkColorType(), alpha_type, | 489 surface_->color_params().GetSkColorType(), alpha_type, |
| 490 surface_->color_params().GetSkColorSpaceForSkSurfaces()); | 490 surface_->color_params().GetSkColorSpaceForSkSurfaces()); |
| 491 } else { | 491 } else { |
| 492 info = SkImageInfo::Make(source_rect.Width(), source_rect.Height(), | 492 info = SkImageInfo::Make(source_rect.Width(), source_rect.Height(), |
| 493 kRGBA_8888_SkColorType, alpha_type, | 493 kRGBA_8888_SkColorType, alpha_type); |
| 494 SkColorSpace::MakeSRGB()); | |
| 495 } | 494 } |
| 496 surface_->WritePixels(info, src_addr, src_bytes_per_row, dest_x, dest_y); | 495 surface_->WritePixels(info, src_addr, src_bytes_per_row, dest_x, dest_y); |
| 497 } | 496 } |
| 498 | 497 |
| 499 void ImageBuffer::UpdateGPUMemoryUsage() const { | 498 void ImageBuffer::UpdateGPUMemoryUsage() const { |
| 500 if (this->IsAccelerated()) { | 499 if (this->IsAccelerated()) { |
| 501 // If image buffer is accelerated, we should keep track of GPU memory usage. | 500 // If image buffer is accelerated, we should keep track of GPU memory usage. |
| 502 int gpu_buffer_count = 2; | 501 int gpu_buffer_count = 2; |
| 503 CheckedNumeric<intptr_t> checked_gpu_usage = | 502 CheckedNumeric<intptr_t> checked_gpu_usage = |
| 504 surface_->color_params().BytesPerPixel() * gpu_buffer_count; | 503 surface_->color_params().BytesPerPixel() * gpu_buffer_count; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 DCHECK(MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding(mime_type)); | 596 DCHECK(MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding(mime_type)); |
| 598 | 597 |
| 599 Vector<unsigned char> result; | 598 Vector<unsigned char> result; |
| 600 if (!EncodeImage(mime_type, quality, &result)) | 599 if (!EncodeImage(mime_type, quality, &result)) |
| 601 return "data:,"; | 600 return "data:,"; |
| 602 | 601 |
| 603 return "data:" + mime_type + ";base64," + Base64Encode(result); | 602 return "data:" + mime_type + ";base64," + Base64Encode(result); |
| 604 } | 603 } |
| 605 | 604 |
| 606 } // namespace blink | 605 } // namespace blink |
| OLD | NEW |