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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return false; | 231 return false; |
232 WebGraphicsContext3D* context3D = provider->context3d(); | 232 WebGraphicsContext3D* context3D = provider->context3d(); |
233 if (!context3D) | 233 if (!context3D) |
234 return false; | 234 return false; |
235 Platform3DObject textureId = m_surface->getBackingTextureHandleForOverwrite(
); | 235 Platform3DObject textureId = m_surface->getBackingTextureHandleForOverwrite(
); |
236 if (!textureId) | 236 if (!textureId) |
237 return false; | 237 return false; |
238 | 238 |
239 context3D->flush(); | 239 context3D->flush(); |
240 | 240 |
241 bool result = drawingBuffer->copyToPlatformTexture(context3D, textureId, GL_
RGBA, | 241 return drawingBuffer->copyToPlatformTexture(context3D, textureId, GL_RGBA, |
242 GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer); | 242 GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer); |
243 | |
244 if (result) { | |
245 m_surface->didModifyBackingTexture(); | |
246 } | |
247 | |
248 return result; | |
249 } | 243 } |
250 | 244 |
251 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons
t FloatRect* srcPtr, SkXfermode::Mode op) | 245 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons
t FloatRect* srcPtr, SkXfermode::Mode op) |
252 { | 246 { |
253 if (!isSurfaceValid()) | 247 if (!isSurfaceValid()) |
254 return; | 248 return; |
255 | 249 |
256 FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); | 250 FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); |
257 m_surface->draw(context, destRect, srcRect, op); | 251 m_surface->draw(context, destRect, srcRect, op); |
258 } | 252 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 368 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
375 | 369 |
376 Vector<char> encodedImage; | 370 Vector<char> encodedImage; |
377 if (!encodeImage(*this, mimeType, quality, &encodedImage)) | 371 if (!encodeImage(*this, mimeType, quality, &encodedImage)) |
378 return "data:,"; | 372 return "data:,"; |
379 | 373 |
380 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 374 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
381 } | 375 } |
382 | 376 |
383 } // namespace blink | 377 } // namespace blink |
OLD | NEW |