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 27 matching lines...) Expand all Loading... |
38 #include "platform/MIMETypeRegistry.h" | 38 #include "platform/MIMETypeRegistry.h" |
39 #include "platform/RuntimeEnabledFeatures.h" | 39 #include "platform/RuntimeEnabledFeatures.h" |
40 #include "platform/geometry/IntRect.h" | 40 #include "platform/geometry/IntRect.h" |
41 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 41 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
42 #include "platform/graphics/GraphicsContext.h" | 42 #include "platform/graphics/GraphicsContext.h" |
43 #include "platform/graphics/ImageBufferClient.h" | 43 #include "platform/graphics/ImageBufferClient.h" |
44 #include "platform/graphics/RecordingImageBufferSurface.h" | 44 #include "platform/graphics/RecordingImageBufferSurface.h" |
45 #include "platform/graphics/StaticBitmapImage.h" | 45 #include "platform/graphics/StaticBitmapImage.h" |
46 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 46 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
47 #include "platform/graphics/gpu/DrawingBuffer.h" | 47 #include "platform/graphics/gpu/DrawingBuffer.h" |
48 #include "platform/graphics/gpu/Extensions3DUtil.h" | |
49 #include "platform/graphics/skia/SkiaUtils.h" | 48 #include "platform/graphics/skia/SkiaUtils.h" |
50 #include "platform/image-encoders/JPEGImageEncoder.h" | 49 #include "platform/image-encoders/JPEGImageEncoder.h" |
51 #include "platform/image-encoders/PNGImageEncoder.h" | 50 #include "platform/image-encoders/PNGImageEncoder.h" |
52 #include "platform/image-encoders/WEBPImageEncoder.h" | 51 #include "platform/image-encoders/WEBPImageEncoder.h" |
53 #include "public/platform/Platform.h" | 52 #include "public/platform/Platform.h" |
54 #include "public/platform/WebGraphicsContext3DProvider.h" | 53 #include "public/platform/WebGraphicsContext3DProvider.h" |
55 #include "skia/ext/texture_handle.h" | 54 #include "skia/ext/texture_handle.h" |
56 #include "third_party/skia/include/core/SkPicture.h" | 55 #include "third_party/skia/include/core/SkPicture.h" |
57 #include "third_party/skia/include/gpu/GrContext.h" | 56 #include "third_party/skia/include/gpu/GrContext.h" |
58 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" | 57 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return m_surface->layer(); | 205 return m_surface->layer(); |
207 } | 206 } |
208 | 207 |
209 bool ImageBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, | 208 bool ImageBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, |
210 GLuint texture, | 209 GLuint texture, |
211 GLenum internalFormat, | 210 GLenum internalFormat, |
212 GLenum destType, | 211 GLenum destType, |
213 GLint level, | 212 GLint level, |
214 bool premultiplyAlpha, | 213 bool premultiplyAlpha, |
215 bool flipY) { | 214 bool flipY) { |
216 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM( | |
217 GL_TEXTURE_2D, internalFormat, destType, level)) | |
218 return false; | |
219 | |
220 if (!isSurfaceValid()) | 215 if (!isSurfaceValid()) |
221 return false; | 216 return false; |
222 | 217 |
223 sk_sp<const SkImage> textureImage = m_surface->newImageSnapshot( | 218 sk_sp<const SkImage> textureImage = m_surface->newImageSnapshot( |
224 PreferAcceleration, SnapshotReasonCopyToWebGLTexture); | 219 PreferAcceleration, SnapshotReasonCopyToWebGLTexture); |
225 if (!textureImage) | 220 if (!textureImage) |
226 return false; | 221 return false; |
227 | 222 |
228 if (!m_surface->isAccelerated()) | 223 if (!m_surface->isAccelerated()) |
229 return false; | 224 return false; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 510 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
516 | 511 |
517 Vector<unsigned char> result; | 512 Vector<unsigned char> result; |
518 if (!encodeImage(mimeType, quality, &result)) | 513 if (!encodeImage(mimeType, quality, &result)) |
519 return "data:,"; | 514 return "data:,"; |
520 | 515 |
521 return "data:" + mimeType + ";base64," + base64Encode(result); | 516 return "data:" + mimeType + ";base64," + base64Encode(result); |
522 } | 517 } |
523 | 518 |
524 } // namespace blink | 519 } // namespace blink |
OLD | NEW |