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

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

Issue 2196963002: Add a new class AcceleratedStaticBitmap : StaticBitmapImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + minor clean up Created 4 years, 4 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 #ifndef StaticBitmapImage_h 5 #ifndef StaticBitmapImage_h
6 #define StaticBitmapImage_h 6 #define StaticBitmapImage_h
7 7
8 #include "platform/graphics/Image.h" 8 #include "platform/graphics/Image.h"
9 #include "public/platform/WebExternalTextureMailbox.h"
10 #include "third_party/khronos/GLES2/gl2.h" 9 #include "third_party/khronos/GLES2/gl2.h"
11 10
12 namespace blink { 11 namespace blink {
13 12
14 class WebGraphicsContext3DProvider; 13 class WebGraphicsContext3DProvider;
15 14
16 class PLATFORM_EXPORT StaticBitmapImage final : public Image { 15 class PLATFORM_EXPORT StaticBitmapImage : public Image {
17 public: 16 public:
18 ~StaticBitmapImage() override; 17 ~StaticBitmapImage() override { };
19 18
20 bool currentFrameIsComplete() override { return true; } 19 bool currentFrameIsComplete() override { return true; }
21 20
22 static PassRefPtr<StaticBitmapImage> create(PassRefPtr<SkImage>); 21 static PassRefPtr<StaticBitmapImage> create(PassRefPtr<SkImage>);
23 static PassRefPtr<StaticBitmapImage> create(WebExternalTextureMailbox&); 22 void destroyDecodedData() override { }
24 virtual void destroyDecodedData() { } 23 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override ;
25 virtual bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata); 24 IntSize size() const override;
26 virtual IntSize size() const;
27 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; 25 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override;
28 26
29 PassRefPtr<SkImage> imageForCurrentFrame() override; 27 PassRefPtr<SkImage> imageForCurrentFrame() override;
30 28
31 bool originClean() const { return m_isOriginClean; } 29 bool originClean() const { return m_isOriginClean; }
32 void setOriginClean(bool flag) { m_isOriginClean = flag; } 30 void setOriginClean(bool flag) { m_isOriginClean = flag; }
33 bool isPremultiplied() const { return m_isPremultiplied; } 31 bool isPremultiplied() const { return m_isPremultiplied; }
34 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } 32 void setPremultiplied(bool flag) { m_isPremultiplied = flag; }
35 void copyToTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GLenum, bo ol);
36 bool isTextureBacked() override; 33 bool isTextureBacked() override;
37 bool hasMailbox() { return m_mailbox.textureSize.width != 0 && m_mailbox.tex tureSize.height != 0; } 34 virtual void copyToTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GL enum, bool) { NOTREACHED(); }
35 virtual bool hasMailbox() { return false; }
38 36
39 protected: 37 protected:
40 StaticBitmapImage(PassRefPtr<SkImage>); 38 StaticBitmapImage(PassRefPtr<SkImage>);
41 StaticBitmapImage(WebExternalTextureMailbox&); 39 StaticBitmapImage() { } // empty constructor for derived class.
40 RefPtr<SkImage> m_image;
42 41
43 private: 42 private:
44 GLuint switchStorageToSkImage(WebGraphicsContext3DProvider*);
45 bool switchStorageToMailbox(WebGraphicsContext3DProvider*);
46 GLuint switchStorageToSkImageForWebGL(WebGraphicsContext3DProvider*);
47
48 RefPtr<SkImage> m_image;
49 WebExternalTextureMailbox m_mailbox;
50 bool m_isOriginClean = true; 43 bool m_isOriginClean = true;
51 // The premultiply info is stored here because the SkImage API 44 // The premultiply info is stored here because the SkImage API
52 // doesn't expose this info. 45 // doesn't expose this info.
53 bool m_isPremultiplied = true; 46 bool m_isPremultiplied = true;
54 }; 47 };
55 48
56 } // namespace blink 49 } // namespace blink
57 50
58 #endif 51 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698