| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (!surface->isValid()) | 66 if (!surface->isValid()) |
| 67 return nullptr; | 67 return nullptr; |
| 68 return adoptPtr(new ImageBuffer(std::move(surface))); | 68 return adoptPtr(new ImageBuffer(std::move(surface))); |
| 69 } | 69 } |
| 70 | 70 |
| 71 PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opa
cityMode, ImageInitializationMode initializationMode) | 71 PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opa
cityMode, ImageInitializationMode initializationMode) |
| 72 { | 72 { |
| 73 OwnPtr<ImageBufferSurface> surface(adoptPtr(new UnacceleratedImageBufferSurf
ace(size, opacityMode, initializationMode))); | 73 OwnPtr<ImageBufferSurface> surface(adoptPtr(new UnacceleratedImageBufferSurf
ace(size, opacityMode, initializationMode))); |
| 74 if (!surface->isValid()) | 74 if (!surface->isValid()) |
| 75 return nullptr; | 75 return nullptr; |
| 76 return adoptPtr(new ImageBuffer(surface.release())); | 76 return adoptPtr(new ImageBuffer(std::move(surface))); |
| 77 } | 77 } |
| 78 | 78 |
| 79 ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface) | 79 ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface) |
| 80 : m_snapshotState(InitialSnapshotState) | 80 : m_snapshotState(InitialSnapshotState) |
| 81 , m_surface(std::move(surface)) | 81 , m_surface(std::move(surface)) |
| 82 , m_client(0) | 82 , m_client(0) |
| 83 , m_gpuMemoryUsage(0) | 83 , m_gpuMemoryUsage(0) |
| 84 { | 84 { |
| 85 m_surface->setImageBuffer(this); | 85 m_surface->setImageBuffer(this); |
| 86 updateGPUMemoryUsage(); | 86 updateGPUMemoryUsage(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 400 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 401 | 401 |
| 402 Vector<unsigned char> result; | 402 Vector<unsigned char> result; |
| 403 if (!encodeImage(mimeType, quality, &result)) | 403 if (!encodeImage(mimeType, quality, &result)) |
| 404 return "data:,"; | 404 return "data:,"; |
| 405 | 405 |
| 406 return "data:" + mimeType + ";base64," + base64Encode(result); | 406 return "data:" + mimeType + ";base64," + base64Encode(result); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace blink | 409 } // namespace blink |
| OLD | NEW |