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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 #include "BitmapImage.h" | 36 #include "BitmapImage.h" |
37 #include "Canvas2DLayerBridge.h" | 37 #include "Canvas2DLayerBridge.h" |
38 #include "Extensions3D.h" | 38 #include "Extensions3D.h" |
39 #include "GrContext.h" | 39 #include "GrContext.h" |
40 #include "GraphicsContext.h" | 40 #include "GraphicsContext.h" |
41 #include "GraphicsContext3D.h" | 41 #include "GraphicsContext3D.h" |
42 #include "ImageData.h" | 42 #include "ImageData.h" |
43 #include "JPEGImageEncoder.h" | 43 #include "JPEGImageEncoder.h" |
44 #include "MIMETypeRegistry.h" | 44 #include "MIMETypeRegistry.h" |
45 #include "MemoryInstrumentationSkia.h" | |
46 #include "NativeImageSkia.h" | 45 #include "NativeImageSkia.h" |
47 #include "PNGImageEncoder.h" | 46 #include "PNGImageEncoder.h" |
48 #include "PlatformContextSkia.h" | 47 #include "PlatformContextSkia.h" |
49 #include "SharedGraphicsContext3D.h" | 48 #include "SharedGraphicsContext3D.h" |
50 #include "SkColorPriv.h" | 49 #include "SkColorPriv.h" |
51 #include "SkGpuDevice.h" | 50 #include "SkGpuDevice.h" |
52 #include "SkiaUtils.h" | 51 #include "SkiaUtils.h" |
53 #include "WEBPImageEncoder.h" | 52 #include "WEBPImageEncoder.h" |
54 #include <public/Platform.h> | 53 #include <public/Platform.h> |
55 | 54 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 Vector<char> encodedImage; | 414 Vector<char> encodedImage; |
416 if (!encodeImage(*context()->platformContext()->bitmap(), mimeType, quality,
&encodedImage)) | 415 if (!encodeImage(*context()->platformContext()->bitmap(), mimeType, quality,
&encodedImage)) |
417 return "data:,"; | 416 return "data:,"; |
418 | 417 |
419 Vector<char> base64Data; | 418 Vector<char> base64Data; |
420 base64Encode(encodedImage, base64Data); | 419 base64Encode(encodedImage, base64Data); |
421 | 420 |
422 return "data:" + mimeType + ";base64," + base64Data; | 421 return "data:" + mimeType + ";base64," + base64Data; |
423 } | 422 } |
424 | 423 |
425 void ImageBufferData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) cons
t | |
426 { | |
427 MemoryClassInfo info(memoryObjectInfo, this); | |
428 info.addMember(m_canvas, "canvas"); | |
429 info.addMember(m_platformContext, "platformContext"); | |
430 info.addMember(m_layerBridge, "layerBridge"); | |
431 } | |
432 | |
433 String ImageDataToDataURL(const ImageData& imageData, const String& mimeType, co
nst double* quality) | 424 String ImageDataToDataURL(const ImageData& imageData, const String& mimeType, co
nst double* quality) |
434 { | 425 { |
435 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 426 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
436 | 427 |
437 Vector<char> encodedImage; | 428 Vector<char> encodedImage; |
438 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 429 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) |
439 return "data:,"; | 430 return "data:,"; |
440 | 431 |
441 Vector<char> base64Data; | 432 Vector<char> base64Data; |
442 base64Encode(encodedImage, base64Data); | 433 base64Encode(encodedImage, base64Data); |
443 | 434 |
444 return "data:" + mimeType + ";base64," + base64Data; | 435 return "data:" + mimeType + ";base64," + base64Data; |
445 } | 436 } |
446 | 437 |
447 } // namespace WebCore | 438 } // namespace WebCore |
OLD | NEW |