| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 return SkData::NewWithCopy(buffer->data(), buffer->size()); | 61 return SkData::NewWithCopy(buffer->data(), buffer->size()); |
| 62 return 0; | 62 return 0; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool DecodingImageGenerator::onGetInfo(SkImageInfo* info) | 65 bool DecodingImageGenerator::onGetInfo(SkImageInfo* info) |
| 66 { | 66 { |
| 67 *info = m_imageInfo; | 67 *info = m_imageInfo; |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 SkImageGenerator::Result DecodingImageGenerator::onGetPixelsEnum(const SkImageIn
fo& info, | 71 SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo&
info, |
| 72 void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount) | 72 void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount) |
| 73 { | 73 { |
| 74 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c
ast<int>(m_frameIndex)); | 74 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c
ast<int>(m_frameIndex)); |
| 75 | 75 |
| 76 // Implementation doesn't support scaling yet so make sure we're not given a
different size. | 76 // Implementation doesn't support scaling yet so make sure we're not given a
different size. |
| 77 if (info.width() != m_imageInfo.width() || info.height() != m_imageInfo.heig
ht()) { | 77 if (info.width() != m_imageInfo.width() || info.height() != m_imageInfo.heig
ht()) { |
| 78 return kInvalidScale; | 78 return kInvalidScale; |
| 79 } | 79 } |
| 80 if (info.colorType() != m_imageInfo.colorType()) { | 80 if (info.colorType() != m_imageInfo.colorType()) { |
| 81 // ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaTyp
e after sniffing the encoded data, so if we see a request | 81 // ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaTyp
e after sniffing the encoded data, so if we see a request |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak
e(size.width(), size.height()), buffer, true, false); | 126 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak
e(size.width(), size.height()), buffer, true, false); |
| 127 if (!frame) | 127 if (!frame) |
| 128 return 0; | 128 return 0; |
| 129 | 129 |
| 130 return new DecodingImageGenerator(frame, info, 0); | 130 return new DecodingImageGenerator(frame, info, 0); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace blink | 133 } // namespace blink |
| 134 | 134 |
| OLD | NEW |