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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 size_t rowBytes, | 143 size_t rowBytes, |
| 144 int x, | 144 int x, |
| 145 int y) { | 145 int y) { |
| 146 return m_surface->writePixels(info, pixels, rowBytes, x, y); | 146 return m_surface->writePixels(info, pixels, rowBytes, x, y); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool ImageBuffer::isSurfaceValid() const { | 149 bool ImageBuffer::isSurfaceValid() const { |
| 150 return m_surface->isValid(); | 150 return m_surface->isValid(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool ImageBuffer::isDirty() { | 153 void ImageBuffer::finalizeFrame() { |
| 154 return m_client ? m_client->isDirty() : false; | 154 m_surface->finalizeFrame(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ImageBuffer::didFinalizeFrame() { | 157 void ImageBuffer::doPaintInvalidation(const FloatRect& dirtyRect) { |
| 158 if (m_client) | 158 m_surface->doPaintInvalidation(dirtyRect); |
| 159 m_client->didFinalizeFrame(); | |
| 160 } | |
| 161 | |
| 162 void ImageBuffer::finalizeFrame(const FloatRect& dirtyRect) { | |
| 163 m_surface->finalizeFrame(dirtyRect); | |
| 164 didFinalizeFrame(); | |
|
xlai (Olivia)
2017/02/08 17:58:40
Great works. The previous logic flow was a bit mes
Justin Novosad
2017/02/08 18:43:12
Exactly. I got rid of the zig-zag flow we had befo
| |
| 165 } | 159 } |
| 166 | 160 |
| 167 bool ImageBuffer::restoreSurface() const { | 161 bool ImageBuffer::restoreSurface() const { |
| 168 return m_surface->isValid() || m_surface->restore(); | 162 return m_surface->isValid() || m_surface->restore(); |
| 169 } | 163 } |
| 170 | 164 |
| 171 void ImageBuffer::notifySurfaceInvalid() { | 165 void ImageBuffer::notifySurfaceInvalid() { |
| 172 if (m_client) | 166 if (m_client) |
| 173 m_client->notifySurfaceInvalid(); | 167 m_client->notifySurfaceInvalid(); |
| 174 } | 168 } |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 597 DCHECK(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 591 DCHECK(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 598 | 592 |
| 599 Vector<unsigned char> result; | 593 Vector<unsigned char> result; |
| 600 if (!encodeImage(mimeType, quality, &result)) | 594 if (!encodeImage(mimeType, quality, &result)) |
| 601 return "data:,"; | 595 return "data:,"; |
| 602 | 596 |
| 603 return "data:" + mimeType + ";base64," + base64Encode(result); | 597 return "data:" + mimeType + ";base64," + base64Encode(result); |
| 604 } | 598 } |
| 605 | 599 |
| 606 } // namespace blink | 600 } // namespace blink |
| OLD | NEW |