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