| 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 25 matching lines...) Expand all Loading... |
| 36 #include "platform/MIMETypeRegistry.h" | 36 #include "platform/MIMETypeRegistry.h" |
| 37 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
| 38 #include "platform/geometry/IntRect.h" | 38 #include "platform/geometry/IntRect.h" |
| 39 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 39 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 40 #include "platform/graphics/GraphicsContext.h" | 40 #include "platform/graphics/GraphicsContext.h" |
| 41 #include "platform/graphics/ImageBufferClient.h" | 41 #include "platform/graphics/ImageBufferClient.h" |
| 42 #include "platform/graphics/RecordingImageBufferSurface.h" | 42 #include "platform/graphics/RecordingImageBufferSurface.h" |
| 43 #include "platform/graphics/StaticBitmapImage.h" | 43 #include "platform/graphics/StaticBitmapImage.h" |
| 44 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 44 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 45 #include "platform/graphics/gpu/DrawingBuffer.h" | 45 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 46 #include "platform/graphics/gpu/Extensions3DUtil.h" | |
| 47 #include "platform/graphics/skia/SkiaUtils.h" | 46 #include "platform/graphics/skia/SkiaUtils.h" |
| 48 #include "platform/image-encoders/JPEGImageEncoder.h" | 47 #include "platform/image-encoders/JPEGImageEncoder.h" |
| 49 #include "platform/image-encoders/PNGImageEncoder.h" | 48 #include "platform/image-encoders/PNGImageEncoder.h" |
| 50 #include "platform/image-encoders/WEBPImageEncoder.h" | 49 #include "platform/image-encoders/WEBPImageEncoder.h" |
| 51 #include "public/platform/Platform.h" | 50 #include "public/platform/Platform.h" |
| 52 #include "public/platform/WebExternalTextureMailbox.h" | 51 #include "public/platform/WebExternalTextureMailbox.h" |
| 53 #include "public/platform/WebGraphicsContext3DProvider.h" | 52 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 54 #include "skia/ext/texture_handle.h" | 53 #include "skia/ext/texture_handle.h" |
| 55 #include "third_party/skia/include/core/SkPicture.h" | 54 #include "third_party/skia/include/core/SkPicture.h" |
| 56 #include "third_party/skia/include/gpu/GrContext.h" | 55 #include "third_party/skia/include/gpu/GrContext.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 m_surface->didDraw(rect); | 193 m_surface->didDraw(rect); |
| 195 } | 194 } |
| 196 | 195 |
| 197 WebLayer* ImageBuffer::platformLayer() const | 196 WebLayer* ImageBuffer::platformLayer() const |
| 198 { | 197 { |
| 199 return m_surface->layer(); | 198 return m_surface->layer(); |
| 200 } | 199 } |
| 201 | 200 |
| 202 bool ImageBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, GLuint t
exture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlp
ha, bool flipY) | 201 bool ImageBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, GLuint t
exture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlp
ha, bool flipY) |
| 203 { | 202 { |
| 204 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalForm
at, destType, level)) | |
| 205 return false; | |
| 206 | |
| 207 if (!isSurfaceValid()) | 203 if (!isSurfaceValid()) |
| 208 return false; | 204 return false; |
| 209 | 205 |
| 210 RefPtr<const SkImage> textureImage = m_surface->newImageSnapshot(PreferAccel
eration, SnapshotReasonCopyToWebGLTexture); | 206 RefPtr<const SkImage> textureImage = m_surface->newImageSnapshot(PreferAccel
eration, SnapshotReasonCopyToWebGLTexture); |
| 211 if (!textureImage) | 207 if (!textureImage) |
| 212 return false; | 208 return false; |
| 213 | 209 |
| 214 if (!m_surface->isAccelerated()) | 210 if (!m_surface->isAccelerated()) |
| 215 return false; | 211 return false; |
| 216 | 212 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 460 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 465 | 461 |
| 466 Vector<unsigned char> result; | 462 Vector<unsigned char> result; |
| 467 if (!encodeImage(mimeType, quality, &result)) | 463 if (!encodeImage(mimeType, quality, &result)) |
| 468 return "data:,"; | 464 return "data:,"; |
| 469 | 465 |
| 470 return "data:" + mimeType + ";base64," + base64Encode(result); | 466 return "data:" + mimeType + ";base64," + base64Encode(result); |
| 471 } | 467 } |
| 472 | 468 |
| 473 } // namespace blink | 469 } // namespace blink |
| OLD | NEW |