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

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

Issue 1631353002: Correct a small mistake in ImageBitmap::copyBitmapData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | 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 "core/frame/ImageBitmap.h" 5 #include "core/frame/ImageBitmap.h"
6 6
7 #include "core/html/HTMLCanvasElement.h" 7 #include "core/html/HTMLCanvasElement.h"
8 #include "core/html/HTMLVideoElement.h" 8 #include "core/html/HTMLVideoElement.h"
9 #include "core/html/ImageData.h" 9 #include "core/html/ImageData.h"
10 #include "third_party/skia/include/core/SkSurface.h" 10 #include "third_party/skia/include/core/SkSurface.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapI mage> image) 165 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(PassRefPtr<StaticBitmapI mage> image)
166 { 166 {
167 return adoptRefWillBeNoop(new ImageBitmap(image)); 167 return adoptRefWillBeNoop(new ImageBitmap(image));
168 } 168 }
169 169
170 PassOwnPtr<uint8_t[]> ImageBitmap::copyBitmapData() 170 PassOwnPtr<uint8_t[]> ImageBitmap::copyBitmapData()
171 { 171 {
172 SkImageInfo info = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorTy pe, kUnpremul_SkAlphaType); 172 SkImageInfo info = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorTy pe, kUnpremul_SkAlphaType);
173 OwnPtr<uint8_t[]> dstPixels = adoptArrayPtr(new uint8_t[width() * height() * info.bytesPerPixel()]); 173 OwnPtr<uint8_t[]> dstPixels = adoptArrayPtr(new uint8_t[width() * height() * info.bytesPerPixel()]);
174 size_t dstRowBytes = 4 * width(); 174 size_t dstRowBytes = info.bytesPerPixel() * width();
175 m_image->imageForCurrentFrame()->readPixels(info, dstPixels.get(), dstRowByt es, 0, 0); 175 m_image->imageForCurrentFrame()->readPixels(info, dstPixels.get(), dstRowByt es, 0, 0);
176 return dstPixels.release(); 176 return dstPixels.release();
177 } 177 }
178 178
179 unsigned long ImageBitmap::width() const 179 unsigned long ImageBitmap::width() const
180 { 180 {
181 if (!m_image) 181 if (!m_image)
182 return 0; 182 return 0;
183 ASSERT(m_image->width() > 0); 183 ASSERT(m_image->width() > 0);
184 return m_image->width(); 184 return m_image->width();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 { 227 {
228 return FloatSize(width(), height()); 228 return FloatSize(width(), height());
229 } 229 }
230 230
231 DEFINE_TRACE(ImageBitmap) 231 DEFINE_TRACE(ImageBitmap)
232 { 232 {
233 ImageLoaderClient::trace(visitor); 233 ImageLoaderClient::trace(visitor);
234 } 234 }
235 235
236 } // namespace blink 236 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698