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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 success = true; | 114 success = true; |
115 } | 115 } |
116 | 116 |
117 ImageBuffer::~ImageBuffer() | 117 ImageBuffer::~ImageBuffer() |
118 { | 118 { |
119 // This is so that the SkGpuDevice destructor has the correct context. | 119 if (m_context && m_context->platformContext()) { |
120 m_context->platformContext()->makeGrContextCurrent(); | 120 // This is so that the SkGpuDevice destructor has the correct context. |
| 121 m_context->platformContext()->makeGrContextCurrent(); |
| 122 } |
121 } | 123 } |
122 | 124 |
123 GraphicsContext* ImageBuffer::context() const | 125 GraphicsContext* ImageBuffer::context() const |
124 { | 126 { |
125 return m_context.get(); | 127 return m_context.get(); |
126 } | 128 } |
127 | 129 |
128 size_t ImageBuffer::dataSize() const | 130 size_t ImageBuffer::dataSize() const |
129 { | 131 { |
130 return m_size.width() * m_size.height() * 4; | 132 return m_size.width() * m_size.height() * 4; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 SkDevice* device = context()->platformContext()->canvas()->getDevice(); | 405 SkDevice* device = context()->platformContext()->canvas()->getDevice(); |
404 return ImageToDataURL(device->accessBitmap(false), mimeType, quality); | 406 return ImageToDataURL(device->accessBitmap(false), mimeType, quality); |
405 } | 407 } |
406 | 408 |
407 String ImageDataToDataURL(const ImageData& source, const String& mimeType, const
double* quality) | 409 String ImageDataToDataURL(const ImageData& source, const String& mimeType, const
double* quality) |
408 { | 410 { |
409 return ImageToDataURL(source, mimeType, quality); | 411 return ImageToDataURL(source, mimeType, quality); |
410 } | 412 } |
411 | 413 |
412 } // namespace WebCore | 414 } // namespace WebCore |
OLD | NEW |