C++程序  |  41行  |  1.05 KB

// Copyright 2013 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 CC_TEST_TEST_TEXTURE_H_
#define CC_TEST_TEST_TEXTURE_H_

#include "base/containers/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/resources/resource_format.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "ui/gfx/size.h"

namespace cc {

size_t TextureSizeBytes(gfx::Size size, ResourceFormat format);

struct TestTexture : public base::RefCounted<TestTexture> {
  TestTexture();

  void Reallocate(gfx::Size size, ResourceFormat format);
  bool IsValidParameter(blink::WGC3Denum pname);

  gfx::Size size;
  ResourceFormat format;
  scoped_ptr<uint8_t[]> data;

  typedef base::hash_map<blink::WGC3Denum, blink::WGC3Dint>
      TextureParametersMap;
  TextureParametersMap params;

 private:
  friend class base::RefCounted<TestTexture>;
  ~TestTexture();
};

}  // namespace cc

#endif  // CC_TEST_TEST_TEXTURE_H_