Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3126)

Unified Diff: cc/test/test_texture.cc

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/test_texture.h ('k') | cc/test/test_tile_priorities.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/test_texture.cc
diff --git a/cc/test/test_texture.cc b/cc/test/test_texture.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8addc7920f9789e6a012dc0e64f2a19a4b48aa50
--- /dev/null
+++ b/cc/test/test_texture.cc
@@ -0,0 +1,41 @@
+// 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 "gpu/GLES2/gl2extchromium.h"
+#include "third_party/khronos/GLES2/gl2ext.h"
+
+namespace cc {
+
+size_t TextureSizeBytes(const 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) {
+ // Initialize default parameter values.
+ params[GL_TEXTURE_MAG_FILTER] = GL_LINEAR;
+ params[GL_TEXTURE_MIN_FILTER] = GL_NEAREST_MIPMAP_LINEAR;
+ params[GL_TEXTURE_WRAP_S] = GL_REPEAT;
+ params[GL_TEXTURE_WRAP_T] = GL_REPEAT;
+ params[GL_TEXTURE_POOL_CHROMIUM] = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
+ params[GL_TEXTURE_USAGE_ANGLE] = GL_NONE;
+}
+
+TestTexture::~TestTexture() {}
+
+void TestTexture::Reallocate(const gfx::Size& size, ResourceFormat format) {
+ this->size = size;
+ this->format = format;
+ this->data.reset(new uint8_t[TextureSizeBytes(size, format)]);
+}
+
+bool TestTexture::IsValidParameter(GLenum pname) {
+ return params.find(pname) != params.end();
+}
+
+} // namespace cc
« no previous file with comments | « cc/test/test_texture.h ('k') | cc/test/test_tile_priorities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698