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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp

Issue 2300633004: Allow canvases to be GPU-accelerated in Workers (Closed)
Patch Set: test expectation 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "platform/graphics/StaticBitmapImage.h" 5 #include "platform/graphics/StaticBitmapImage.h"
6 6
7 #include "platform/graphics/AcceleratedStaticBitmapImage.h" 7 #include "platform/graphics/AcceleratedStaticBitmapImage.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/ImageObserver.h" 9 #include "platform/graphics/ImageObserver.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkImage.h" 11 #include "third_party/skia/include/core/SkImage.h"
12 #include "third_party/skia/include/core/SkPaint.h" 12 #include "third_party/skia/include/core/SkPaint.h"
13 #include "wtf/PtrUtil.h" 13 #include "wtf/PtrUtil.h"
14 #include <memory> 14 #include <memory>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(sk_sp<SkImage> image) 18 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(sk_sp<SkImage> image)
19 { 19 {
20 if (!image) 20 if (!image)
21 return nullptr; 21 return nullptr;
22 if (image->isTextureBacked()) 22 if (image->isTextureBacked())
23 return AcceleratedStaticBitmapImage::create(std::move(image)); 23 return AcceleratedStaticBitmapImage::createFromSharedContextImage(std::m ove(image));
24 return adoptRef(new StaticBitmapImage(std::move(image))); 24 return adoptRef(new StaticBitmapImage(std::move(image)));
25 } 25 }
26 26
27 StaticBitmapImage::StaticBitmapImage(sk_sp<SkImage> image) : m_image(std::move(i mage)) 27 StaticBitmapImage::StaticBitmapImage(sk_sp<SkImage> image) : m_image(std::move(i mage))
28 { 28 {
29 ASSERT(m_image); 29 ASSERT(m_image);
30 } 30 }
31 31
32 IntSize StaticBitmapImage::size() const 32 IntSize StaticBitmapImage::size() const
33 { 33 {
(...skipping 25 matching lines...) Expand all
59 if (ImageObserver* observer = getImageObserver()) 59 if (ImageObserver* observer = getImageObserver())
60 observer->didDraw(this); 60 observer->didDraw(this);
61 } 61 }
62 62
63 sk_sp<SkImage> StaticBitmapImage::imageForCurrentFrame() 63 sk_sp<SkImage> StaticBitmapImage::imageForCurrentFrame()
64 { 64 {
65 return m_image; 65 return m_image;
66 } 66 }
67 67
68 } // namespace blink 68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698