Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: Source/platform/graphics/ImageBuffer.cpp

Issue 309933004: Fix imageSourceURL() for WebGL elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/gpu/DrawingBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/gpu/DrawingBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698