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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "platform/graphics/gpu/DrawingBuffer.h" | 43 #include "platform/graphics/gpu/DrawingBuffer.h" |
44 #include "platform/graphics/gpu/Extensions3DUtil.h" | 44 #include "platform/graphics/gpu/Extensions3DUtil.h" |
45 #include "platform/graphics/skia/SkiaUtils.h" | 45 #include "platform/graphics/skia/SkiaUtils.h" |
46 #include "platform/image-encoders/skia/JPEGImageEncoder.h" | 46 #include "platform/image-encoders/skia/JPEGImageEncoder.h" |
47 #include "platform/image-encoders/skia/PNGImageEncoder.h" | 47 #include "platform/image-encoders/skia/PNGImageEncoder.h" |
48 #include "platform/image-encoders/skia/WEBPImageEncoder.h" | 48 #include "platform/image-encoders/skia/WEBPImageEncoder.h" |
49 #include "public/platform/Platform.h" | 49 #include "public/platform/Platform.h" |
50 #include "public/platform/WebExternalTextureMailbox.h" | 50 #include "public/platform/WebExternalTextureMailbox.h" |
51 #include "public/platform/WebGraphicsContext3D.h" | 51 #include "public/platform/WebGraphicsContext3D.h" |
52 #include "public/platform/WebGraphicsContext3DProvider.h" | 52 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 53 #include "skia/ext/texture_handle.h" |
53 #include "third_party/skia/include/core/SkPicture.h" | 54 #include "third_party/skia/include/core/SkPicture.h" |
| 55 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
54 #include "wtf/ArrayBufferContents.h" | 56 #include "wtf/ArrayBufferContents.h" |
55 #include "wtf/MathExtras.h" | 57 #include "wtf/MathExtras.h" |
56 #include "wtf/Vector.h" | 58 #include "wtf/Vector.h" |
57 #include "wtf/text/Base64.h" | 59 #include "wtf/text/Base64.h" |
58 #include "wtf/text/WTFString.h" | 60 #include "wtf/text/WTFString.h" |
59 | 61 |
60 namespace blink { | 62 namespace blink { |
61 | 63 |
62 PassOwnPtr<ImageBuffer> ImageBuffer::create(PassOwnPtr<ImageBufferSurface> surfa
ce) | 64 PassOwnPtr<ImageBuffer> ImageBuffer::create(PassOwnPtr<ImageBufferSurface> surfa
ce) |
63 { | 65 { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 RefPtr<const SkImage> textureImage = m_surface->newImageSnapshot(PreferAccel
eration, SnapshotReasonCopyToWebGLTexture); | 188 RefPtr<const SkImage> textureImage = m_surface->newImageSnapshot(PreferAccel
eration, SnapshotReasonCopyToWebGLTexture); |
187 if (!textureImage) | 189 if (!textureImage) |
188 return false; | 190 return false; |
189 | 191 |
190 if (!m_surface->isAccelerated()) | 192 if (!m_surface->isAccelerated()) |
191 return false; | 193 return false; |
192 | 194 |
193 | 195 |
194 ASSERT(textureImage->isTextureBacked()); // isAccelerated() check above shou
ld guarantee this | 196 ASSERT(textureImage->isTextureBacked()); // isAccelerated() check above shou
ld guarantee this |
195 // Get the texture ID, flushing pending operations if needed. | 197 // Get the texture ID, flushing pending operations if needed. |
196 Platform3DObject textureId = textureImage->getTextureHandle(true); | 198 Platform3DObject textureId = skia::GrBackendObjectToGrGLTextureInfo(textureI
mage->getTextureHandle(true))->fID; |
197 if (!textureId) | 199 if (!textureId) |
198 return false; | 200 return false; |
199 | 201 |
200 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); | 202 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); |
201 if (!provider) | 203 if (!provider) |
202 return false; | 204 return false; |
203 WebGraphicsContext3D* sharedContext = provider->context3d(); | 205 WebGraphicsContext3D* sharedContext = provider->context3d(); |
204 if (!sharedContext) | 206 if (!sharedContext) |
205 return false; | 207 return false; |
206 | 208 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 399 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
398 | 400 |
399 Vector<unsigned char> result; | 401 Vector<unsigned char> result; |
400 if (!encodeImage(mimeType, quality, &result)) | 402 if (!encodeImage(mimeType, quality, &result)) |
401 return "data:,"; | 403 return "data:,"; |
402 | 404 |
403 return "data:" + mimeType + ";base64," + base64Encode(result); | 405 return "data:" + mimeType + ";base64," + base64Encode(result); |
404 } | 406 } |
405 | 407 |
406 } // namespace blink | 408 } // namespace blink |
OLD | NEW |