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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 Platform3DObject ImageBuffer::getBackingTexture() | 235 Platform3DObject ImageBuffer::getBackingTexture() |
236 { | 236 { |
237 return m_surface->getBackingTexture(); | 237 return m_surface->getBackingTexture(); |
238 } | 238 } |
239 | 239 |
240 void ImageBuffer::didModifyBackingTexture() | 240 void ImageBuffer::didModifyBackingTexture() |
241 { | 241 { |
242 m_surface->didModifyBackingTexture(); | 242 m_surface->didModifyBackingTexture(); |
243 } | 243 } |
244 | 244 |
245 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, bool fromFrontBuffer) | 245 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, SourceDrawingBuffer sourceBuffer) |
246 { | 246 { |
247 if (!drawingBuffer) | 247 if (!drawingBuffer) |
248 return false; | 248 return false; |
249 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); | 249 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); |
250 if (!provider) | 250 if (!provider) |
251 return false; | 251 return false; |
252 WebGraphicsContext3D* context3D = provider->context3d(); | 252 WebGraphicsContext3D* context3D = provider->context3d(); |
253 Platform3DObject tex = m_surface->getBackingTexture(); | 253 Platform3DObject tex = m_surface->getBackingTexture(); |
254 if (!context3D || !tex) | 254 if (!context3D || !tex) |
255 return false; | 255 return false; |
256 | 256 |
257 m_surface->invalidateCachedBitmap(); | 257 m_surface->invalidateCachedBitmap(); |
258 bool result = drawingBuffer->copyToPlatformTexture(context3D, tex, GL_RGBA, | 258 bool result = drawingBuffer->copyToPlatformTexture(context3D, tex, GL_RGBA, |
259 GL_UNSIGNED_BYTE, 0, true, false, fromFrontBuffer ? DrawingBuffer::Front
: DrawingBuffer::Back); | 259 GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer); |
260 | 260 |
261 if (result) { | 261 if (result) { |
262 m_surface->didModifyBackingTexture(); | 262 m_surface->didModifyBackingTexture(); |
263 } | 263 } |
264 | 264 |
265 return result; | 265 return result; |
266 } | 266 } |
267 | 267 |
268 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons
t FloatRect* srcPtr, CompositeOperator op, WebBlendMode blendMode) | 268 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons
t FloatRect* srcPtr, CompositeOperator op, WebBlendMode blendMode) |
269 { | 269 { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 447 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
448 | 448 |
449 Vector<char> encodedImage; | 449 Vector<char> encodedImage; |
450 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 450 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) |
451 return "data:,"; | 451 return "data:,"; |
452 | 452 |
453 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 453 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
454 } | 454 } |
455 | 455 |
456 } // namespace blink | 456 } // namespace blink |
OLD | NEW |