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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2267653005: Resolving drawImage issue with canvases that contain bitmap images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
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 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1094
1095 if (!m_context) { 1095 if (!m_context) {
1096 *status = NormalSourceImageStatus; 1096 *status = NormalSourceImageStatus;
1097 return createTransparentImage(size()); 1097 return createTransparentImage(size());
1098 } 1098 }
1099 1099
1100 if (m_context->is3d()) { 1100 if (m_context->is3d()) {
1101 m_context->paintRenderingResultsToCanvas(BackBuffer); 1101 m_context->paintRenderingResultsToCanvas(BackBuffer);
1102 } 1102 }
1103 1103
1104 RefPtr<SkImage> image = buffer()->newSkImageSnapshot(hint, reason); 1104 RefPtr<SkImage> skImage;
1105 if (image) { 1105 RefPtr<blink::Image> image = renderingContext()->getImage();
1106 if (image)
1107 skImage = image->imageForCurrentFrame();
1108 else
1109 skImage = buffer()->newSkImageSnapshot(hint, reason);
Justin Novosad 2016/08/22 20:03:02 Just realized this code may inadvertently allocate
zakerinasab 2016/08/22 20:19:09 createTransparentImage(size()) returns PassRefPtr<
1110
1111 if (skImage) {
1106 *status = NormalSourceImageStatus; 1112 *status = NormalSourceImageStatus;
1107 return StaticBitmapImage::create(image.release()); 1113 return StaticBitmapImage::create(skImage.release());
1108 } 1114 }
1109 1115
1110 *status = InvalidSourceImageStatus; 1116 *status = InvalidSourceImageStatus;
1111 return nullptr; 1117 return nullptr;
1112 } 1118 }
1113 1119
1114 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const 1120 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const
1115 { 1121 {
1116 return !originClean(); 1122 return !originClean();
1117 } 1123 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 1222
1217 bool HTMLCanvasElement::createSurfaceLayer() 1223 bool HTMLCanvasElement::createSurfaceLayer()
1218 { 1224 {
1219 DCHECK(!m_surfaceLayerBridge); 1225 DCHECK(!m_surfaceLayerBridge);
1220 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); 1226 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl());
1221 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); 1227 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient)));
1222 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); 1228 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( ));
1223 } 1229 }
1224 1230
1225 } // namespace blink 1231 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698