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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 { | 212 { |
213 ASSERT(dst); | 213 ASSERT(dst); |
214 return (src == dst); | 214 return (src == dst); |
215 } | 215 } |
216 | 216 |
217 Platform3DObject ImageBuffer::getBackingTexture() | 217 Platform3DObject ImageBuffer::getBackingTexture() |
218 { | 218 { |
219 return m_surface->getBackingTexture(); | 219 return m_surface->getBackingTexture(); |
220 } | 220 } |
221 | 221 |
222 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer) | 222 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, bool fromFrontBuffer) |
223 { | 223 { |
224 if (!drawingBuffer) | 224 if (!drawingBuffer) |
225 return false; | 225 return false; |
226 OwnPtr<blink::WebGraphicsContext3DProvider> provider = adoptPtr(blink::Platf
orm::current()->createSharedOffscreenGraphicsContext3DProvider()); | 226 OwnPtr<blink::WebGraphicsContext3DProvider> provider = adoptPtr(blink::Platf
orm::current()->createSharedOffscreenGraphicsContext3DProvider()); |
227 if (!provider) | 227 if (!provider) |
228 return false; | 228 return false; |
229 blink::WebGraphicsContext3D* context3D = provider->context3d(); | 229 blink::WebGraphicsContext3D* context3D = provider->context3d(); |
230 Platform3DObject tex = m_surface->getBackingTexture(); | 230 Platform3DObject tex = m_surface->getBackingTexture(); |
231 if (!context3D || !tex) | 231 if (!context3D || !tex) |
232 return false; | 232 return false; |
| 233 |
233 m_surface->invalidateCachedBitmap(); | 234 m_surface->invalidateCachedBitmap(); |
234 return drawingBuffer->copyToPlatformTexture(context3D, tex, GL_RGBA, | 235 return drawingBuffer->copyToPlatformTexture(context3D, tex, GL_RGBA, |
235 GL_UNSIGNED_BYTE, 0, true, false); | 236 GL_UNSIGNED_BYTE, 0, true, false, fromFrontBuffer); |
236 } | 237 } |
237 | 238 |
238 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons
t FloatRect* srcPtr, CompositeOperator op) | 239 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons
t FloatRect* srcPtr, CompositeOperator op) |
239 { | 240 { |
240 if (!isSurfaceValid()) | 241 if (!isSurfaceValid()) |
241 return; | 242 return; |
242 | 243 |
243 FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); | 244 FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); |
244 SkBitmap bitmap = m_surface->bitmap(); | 245 SkBitmap bitmap = m_surface->bitmap(); |
245 // For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap f
or CPU side usage | 246 // For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap f
or CPU side usage |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 426 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) |
426 return "data:,"; | 427 return "data:,"; |
427 | 428 |
428 Vector<char> base64Data; | 429 Vector<char> base64Data; |
429 base64Encode(encodedImage, base64Data); | 430 base64Encode(encodedImage, base64Data); |
430 | 431 |
431 return "data:" + mimeType + ";base64," + base64Data; | 432 return "data:" + mimeType + ";base64," + base64Data; |
432 } | 433 } |
433 | 434 |
434 } // namespace WebCore | 435 } // namespace WebCore |
OLD | NEW |