diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-31 06:54:59 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-31 06:54:59 +0000 |
commit | c2610b9fb4b118315423456cc7e55eb9da40cb93 (patch) | |
tree | 86a4d6cd421b785f6b762c7d7084d9af0f425566 /cc/test/test_texture.cc | |
parent | 0249a653b7e5076f331848a11034059000b644da (diff) | |
download | chromium_src-c2610b9fb4b118315423456cc7e55eb9da40cb93.zip chromium_src-c2610b9fb4b118315423456cc7e55eb9da40cb93.tar.gz chromium_src-c2610b9fb4b118315423456cc7e55eb9da40cb93.tar.bz2 |
Move test-only stuff from cc/debug/ to cc/test
This moves the test/fake context implementations from cc/debug/ to cc/test
and stops linking them into production targets. Test targets elsewhere in
the tree can link against cc_test_support to use these.
R=danakj,piman
Review URL: https://codereview.chromium.org/50303007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/test_texture.cc')
-rw-r--r-- | cc/test/test_texture.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cc/test/test_texture.cc b/cc/test/test_texture.cc new file mode 100644 index 0000000..f68f5a6 --- /dev/null +++ b/cc/test/test_texture.cc @@ -0,0 +1,29 @@ +// 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. + +#include "cc/test/test_texture.h" + +#include "third_party/khronos/GLES2/gl2.h" + +namespace cc { + +size_t TextureSizeBytes(gfx::Size size, ResourceFormat format) { + unsigned int components_per_pixel = 4; + unsigned int bytes_per_component = 1; + return size.width() * size.height() * components_per_pixel * + bytes_per_component; +} + +TestTexture::TestTexture() + : format(RGBA_8888), filter(GL_NEAREST_MIPMAP_LINEAR) {} + +TestTexture::~TestTexture() {} + +void TestTexture::Reallocate(gfx::Size size, ResourceFormat format) { + this->size = size; + this->format = format; + this->data.reset(new uint8_t[TextureSizeBytes(size, format)]); +} + +} // namespace cc |