summaryrefslogtreecommitdiffstats
path: root/cc/layer_texture_sub_image.h
blob: 6d84427af5770a4f92d88eafcc421d70c0a4727d (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
// Copyright 2011 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 LayerTextureSubImage_h
#define LayerTextureSubImage_h

#include "base/memory/scoped_ptr.h"
#include "GraphicsTypes3D.h"
#include "IntRect.h"
#include "IntSize.h"

namespace WebKit {
class WebGraphicsContext3D;
}

namespace cc {

class LayerTextureSubImage {
public:
    explicit LayerTextureSubImage(bool useMapSubForUpload);
    ~LayerTextureSubImage();

    void upload(const uint8_t* image, const IntRect& imageRect,
                const IntRect& sourceRect, const IntSize& destOffset,
                GC3Denum format, WebKit::WebGraphicsContext3D*);

private:
    void uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect,
                               const IntRect& sourceRect, const IntSize& destOffset,
                               GC3Denum format, WebKit::WebGraphicsContext3D*);
    void uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect,
                                  const IntRect& sourceRect, const IntSize& destOffset,
                                  GC3Denum format, WebKit::WebGraphicsContext3D*);

    bool m_useMapTexSubImage;
    size_t m_subImageSize;
    scoped_array<uint8_t> m_subImage;
};

} // namespace cc

#endif // LayerTextureSubImage_h