Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 if (!isSurfaceValid()) | 153 if (!isSurfaceValid()) |
| 154 return nullptr; | 154 return nullptr; |
| 155 return m_surface->newImageSnapshot(hint); | 155 return m_surface->newImageSnapshot(hint); |
| 156 } | 156 } |
| 157 | 157 |
| 158 PassRefPtr<Image> ImageBuffer::newImageSnapshot(AccelerationHint hint) const | 158 PassRefPtr<Image> ImageBuffer::newImageSnapshot(AccelerationHint hint) const |
| 159 { | 159 { |
| 160 RefPtr<SkImage> snapshot = newSkImageSnapshot(hint); | 160 RefPtr<SkImage> snapshot = newSkImageSnapshot(hint); |
| 161 if (!snapshot) | 161 if (!snapshot) |
| 162 return nullptr; | 162 return nullptr; |
| 163 return StaticBitmapImage::create(snapshot); | 163 return StaticBitmapImage::create(snapshot, true); |
|
Justin Novosad
2016/01/07 17:12:01
Really? An image buffer may be associated with a c
xidachen
2016/01/08 18:07:55
Acknowledged.
| |
| 164 } | 164 } |
| 165 | 165 |
| 166 void ImageBuffer::didDraw(const FloatRect& rect) const | 166 void ImageBuffer::didDraw(const FloatRect& rect) const |
| 167 { | 167 { |
| 168 if (m_snapshotState == DidAcquireSnapshot) | 168 if (m_snapshotState == DidAcquireSnapshot) |
| 169 m_snapshotState = DrawnToAfterSnapshot; | 169 m_snapshotState = DrawnToAfterSnapshot; |
| 170 m_surface->didDraw(rect); | 170 m_surface->didDraw(rect); |
| 171 } | 171 } |
| 172 | 172 |
| 173 WebLayer* ImageBuffer::platformLayer() const | 173 WebLayer* ImageBuffer::platformLayer() const |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 397 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 398 | 398 |
| 399 Vector<unsigned char> result; | 399 Vector<unsigned char> result; |
| 400 if (!encodeImage(mimeType, quality, &result)) | 400 if (!encodeImage(mimeType, quality, &result)) |
| 401 return "data:,"; | 401 return "data:,"; |
| 402 | 402 |
| 403 return "data:" + mimeType + ";base64," + base64Encode(result); | 403 return "data:" + mimeType + ";base64," + base64Encode(result); |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace blink | 406 } // namespace blink |
| OLD | NEW |