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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h

Issue 2455983005: Refactor AcceleratedStaticBitmapImage (Closed)
Patch Set: Keep a unique_ptr<WebGraphicsContext3DProvider>, otherwise crashes Created 4 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SkiaTextureHolder_h
6 #define SkiaTextureHolder_h
7
8 #include "platform/PlatformExport.h"
9 #include "platform/graphics/TextureHolder.h"
10
11 namespace blink {
12
13 class PLATFORM_EXPORT SkiaTextureHolder final : public TextureHolder {
14 public:
15 ~SkiaTextureHolder() override;
16
17 bool isSkiaTextureHolder() final { return true; }
18 bool isMailboxTextureHolder() final { return false; }
19 unsigned sharedContextId() final;
20 IntSize size() const final {
21 return IntSize(m_image->width(), m_image->height());
22 }
23 bool currentFrameKnownToBeOpaque(Image::MetadataMode) final {
24 return m_image->isOpaque();
25 }
26
27 sk_sp<SkImage> skImage() final { return m_image; }
28 void setSharedContextId(unsigned contextId) final {
29 m_sharedContextId = contextId;
30 }
31
32 // When creating a AcceleratedStaticBitmap from a texture-backed SkImage, this
33 // function will be called to create a TextureHolder object.
34 SkiaTextureHolder(sk_sp<SkImage>);
35 // This function consumes the mailbox in the input parameter and turn it into
36 // a texture-backed SkImage.
37 SkiaTextureHolder(std::unique_ptr<TextureHolder>);
38
39 private:
40 void releaseImageThreadSafe();
41
42 // The m_image should always be texture-backed
43 sk_sp<SkImage> m_image;
44 // Id of the shared context where m_image was created
45 unsigned m_sharedContextId = 0;
46 };
47
48 } // namespace blink
49
50 #endif // SkiaTextureHolder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698