Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/core/platform/graphics/ImageBuffer.cpp

Issue 54653004: Break dependency of platform/graphics on html/ImageData.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move struct into ImageBuffer.h Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 #include "config.h" 33 #include "config.h"
34 #include "core/platform/graphics/ImageBuffer.h" 34 #include "core/platform/graphics/ImageBuffer.h"
35 35
36 #include "core/html/ImageData.h"
37 #include "core/platform/MIMETypeRegistry.h" 36 #include "core/platform/MIMETypeRegistry.h"
38 #include "core/platform/graphics/BitmapImage.h" 37 #include "core/platform/graphics/BitmapImage.h"
39 #include "core/platform/graphics/Extensions3D.h" 38 #include "core/platform/graphics/Extensions3D.h"
40 #include "core/platform/graphics/GraphicsContext.h" 39 #include "core/platform/graphics/GraphicsContext.h"
41 #include "core/platform/graphics/GraphicsContext3D.h" 40 #include "core/platform/graphics/GraphicsContext3D.h"
42 #include "core/platform/graphics/chromium/Canvas2DLayerBridge.h" 41 #include "core/platform/graphics/chromium/Canvas2DLayerBridge.h"
43 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h" 42 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h"
44 #include "core/platform/graphics/skia/NativeImageSkia.h" 43 #include "core/platform/graphics/skia/NativeImageSkia.h"
45 #include "core/platform/graphics/skia/SkiaUtils.h" 44 #include "core/platform/graphics/skia/SkiaUtils.h"
46 #include "core/platform/image-encoders/skia/JPEGImageEncoder.h" 45 #include "core/platform/image-encoders/skia/JPEGImageEncoder.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 476
478 Vector<char> encodedImage; 477 Vector<char> encodedImage;
479 if (!isValid() || !encodeImage(*context()->bitmap(), mimeType, quality, &enc odedImage)) 478 if (!isValid() || !encodeImage(*context()->bitmap(), mimeType, quality, &enc odedImage))
480 return "data:,"; 479 return "data:,";
481 Vector<char> base64Data; 480 Vector<char> base64Data;
482 base64Encode(encodedImage, base64Data); 481 base64Encode(encodedImage, base64Data);
483 482
484 return "data:" + mimeType + ";base64," + base64Data; 483 return "data:" + mimeType + ";base64," + base64Data;
485 } 484 }
486 485
487 String ImageDataToDataURL(const ImageData& imageData, const String& mimeType, co nst double* quality) 486 String ImageDataToDataURL(const ImageDataBuffer& imageData, const String& mimeTy pe, const double* quality)
488 { 487 {
489 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 488 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
490 489
491 Vector<char> encodedImage; 490 Vector<char> encodedImage;
492 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) 491 if (!encodeImage(imageData, mimeType, quality, &encodedImage))
493 return "data:,"; 492 return "data:,";
494 493
495 Vector<char> base64Data; 494 Vector<char> base64Data;
496 base64Encode(encodedImage, base64Data); 495 base64Encode(encodedImage, base64Data);
497 496
498 return "data:" + mimeType + ";base64," + base64Data; 497 return "data:" + mimeType + ";base64," + base64Data;
499 } 498 }
500 499
501 } // namespace WebCore 500 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/ImageBuffer.h ('k') | Source/core/platform/image-encoders/skia/JPEGImageEncoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698