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

Side by Side Diff: Source/core/frame/ImageBitmap.cpp

Issue 776293002: Window.createImageBitmap(HTMLCanvasElement) should copy the front buffer of WebGL, not back buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « LayoutTests/fast/canvas/canvas-createImageBitmap-webgl-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/frame/ImageBitmap.h" 6 #include "core/frame/ImageBitmap.h"
7 7
8 #include "core/html/HTMLCanvasElement.h" 8 #include "core/html/HTMLCanvasElement.h"
9 #include "core/html/HTMLVideoElement.h" 9 #include "core/html/HTMLVideoElement.h"
10 #include "core/html/ImageData.h" 10 #include "core/html/ImageData.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect) 77 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect)
78 : m_imageElement(nullptr) 78 : m_imageElement(nullptr)
79 , m_cropRect(cropRect) 79 , m_cropRect(cropRect)
80 , m_bitmapOffset(IntPoint()) 80 , m_bitmapOffset(IntPoint())
81 { 81 {
82 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size()) ); 82 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size()) );
83 m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cro pRect.y())), srcRect.size()); 83 m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cro pRect.y())), srcRect.size());
84 ASSERT(canvas->isPaintable()); 84 ASSERT(canvas->isPaintable());
85 m_bitmap = cropImage(canvas->copiedImage(BackBuffer).get(), cropRect); 85 m_bitmap = cropImage(canvas->copiedImage(FrontBuffer).get(), cropRect);
86 } 86 }
87 87
88 ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect) 88 ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect)
89 : m_imageElement(nullptr) 89 : m_imageElement(nullptr)
90 , m_cropRect(cropRect) 90 , m_cropRect(cropRect)
91 , m_bitmapOffset(IntPoint()) 91 , m_bitmapOffset(IntPoint())
92 { 92 {
93 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size())); 93 IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size()));
94 94
95 OwnPtr<ImageBuffer> buf = ImageBuffer::create(data->size()); 95 OwnPtr<ImageBuffer> buf = ImageBuffer::create(data->size());
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return FloatSize(width(), height()); 213 return FloatSize(width(), height());
214 } 214 }
215 215
216 void ImageBitmap::trace(Visitor* visitor) 216 void ImageBitmap::trace(Visitor* visitor)
217 { 217 {
218 visitor->trace(m_imageElement); 218 visitor->trace(m_imageElement);
219 ImageLoaderClient::trace(visitor); 219 ImageLoaderClient::trace(visitor);
220 } 220 }
221 221
222 } // namespace blink 222 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/canvas-createImageBitmap-webgl-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698