blob: 061ac1444c30a974960828b256cab8348f9918be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_UNACCELERATED_STATIC_BITMAP_IMAGE_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_UNACCELERATED_STATIC_BITMAP_IMAGE_H_
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
namespace blink {
class PLATFORM_EXPORT UnacceleratedStaticBitmapImage final
: public StaticBitmapImage {
public:
~UnacceleratedStaticBitmapImage() override;
// The ImageOrientation should be derived from the source of the image data.
static scoped_refptr<UnacceleratedStaticBitmapImage> Create(
sk_sp<SkImage>,
ImageOrientation orientation = ImageOrientationEnum::kDefault);
static scoped_refptr<UnacceleratedStaticBitmapImage> Create(
PaintImage,
ImageOrientation orientation = ImageOrientationEnum::kDefault);
bool CurrentFrameKnownToBeOpaque() override;
IntSize Size() const override;
bool IsPremultiplied() const override;
scoped_refptr<StaticBitmapImage> ConvertToColorSpace(sk_sp<SkColorSpace>,
SkColorType) override;
void Draw(cc::PaintCanvas*,
const cc::PaintFlags&,
const FloatRect& dst_rect,
const FloatRect& src_rect,
const SkSamplingOptions&,
RespectImageOrientationEnum,
ImageClampingMode,
ImageDecodingMode) override;
PaintImage PaintImageForCurrentFrame() override;
void Transfer() final;
private:
UnacceleratedStaticBitmapImage(sk_sp<SkImage>, ImageOrientation);
UnacceleratedStaticBitmapImage(PaintImage, ImageOrientation);
PaintImage paint_image_;
THREAD_CHECKER(thread_checker_);
sk_sp<SkImage> original_skia_image_;
scoped_refptr<base::SingleThreadTaskRunner> original_skia_image_task_runner_;
};
} // namespace blink
#endif
|