OLD | NEW |
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 "gpu/command_buffer/common/mailbox.h" | 8 #include "gpu/command_buffer/common/mailbox.h" |
9 #include "gpu/command_buffer/common/sync_token.h" | 9 #include "gpu/command_buffer/common/sync_token.h" |
| 10 #include "platform/CrossThreadCopier.h" |
10 #include "platform/graphics/Image.h" | 11 #include "platform/graphics/Image.h" |
11 #include "third_party/khronos/GLES2/gl2.h" | 12 #include "third_party/khronos/GLES2/gl2.h" |
12 #include "third_party/skia/include/core/SkRefCnt.h" | 13 #include "third_party/skia/include/core/SkRefCnt.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class WebGraphicsContext3DProvider; | 17 class WebGraphicsContext3DProvider; |
17 | 18 |
18 class PLATFORM_EXPORT StaticBitmapImage : public Image { | 19 class PLATFORM_EXPORT StaticBitmapImage : public Image { |
19 public: | 20 public: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const PaintImage&); | 76 const PaintImage&); |
76 | 77 |
77 // These two properties are here because the SkImage API doesn't expose the | 78 // These two properties are here because the SkImage API doesn't expose the |
78 // info. They applied to both UnacceleratedStaticBitmapImage and | 79 // info. They applied to both UnacceleratedStaticBitmapImage and |
79 // AcceleratedStaticBitmapImage. To change these two properties, the call | 80 // AcceleratedStaticBitmapImage. To change these two properties, the call |
80 // site would have to call the API setOriginClean() and setPremultiplied(). | 81 // site would have to call the API setOriginClean() and setPremultiplied(). |
81 bool is_origin_clean_ = true; | 82 bool is_origin_clean_ = true; |
82 bool is_premultiplied_ = true; | 83 bool is_premultiplied_ = true; |
83 }; | 84 }; |
84 | 85 |
| 86 template <> |
| 87 struct CrossThreadCopier<RefPtr<StaticBitmapImage>> { |
| 88 typedef RefPtr<StaticBitmapImage> Type; |
| 89 static Type Copy(RefPtr<StaticBitmapImage> image) { |
| 90 if (image) { |
| 91 CHECK(image->HasOneRef()); |
| 92 image->Transfer(); |
| 93 } |
| 94 return image; |
| 95 } |
| 96 }; |
| 97 |
85 } // namespace blink | 98 } // namespace blink |
86 | 99 |
87 #endif | 100 #endif |
OLD | NEW |