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

Side by Side Diff: cc/test/test_web_graphics_context_3d.cc

Issue 16190002: cc: Add new RasterWorkerPool interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « cc/test/test_web_graphics_context_3d.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/test_web_graphics_context_3d.h" 5 #include "cc/test/test_web_graphics_context_3d.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 21 matching lines...) Expand all
32 static const WebGLId kShaderId = 4; 32 static const WebGLId kShaderId = 4;
33 33
34 static unsigned s_context_id = 1; 34 static unsigned s_context_id = 1;
35 35
36 const WebGLId TestWebGraphicsContext3D::kExternalTextureId = 1337; 36 const WebGLId TestWebGraphicsContext3D::kExternalTextureId = 1337;
37 37
38 TestWebGraphicsContext3D::TestWebGraphicsContext3D() 38 TestWebGraphicsContext3D::TestWebGraphicsContext3D()
39 : FakeWebGraphicsContext3D(), 39 : FakeWebGraphicsContext3D(),
40 context_id_(s_context_id++), 40 context_id_(s_context_id++),
41 next_buffer_id_(1), 41 next_buffer_id_(1),
42 next_image_id_(1),
42 next_texture_id_(1), 43 next_texture_id_(1),
43 have_extension_io_surface_(false), 44 have_extension_io_surface_(false),
44 have_extension_egl_image_(false), 45 have_extension_egl_image_(false),
45 times_make_current_succeeds_(-1), 46 times_make_current_succeeds_(-1),
46 times_bind_texture_succeeds_(-1), 47 times_bind_texture_succeeds_(-1),
47 times_end_query_succeeds_(-1), 48 times_end_query_succeeds_(-1),
48 context_lost_(false), 49 context_lost_(false),
49 context_lost_callback_(NULL), 50 context_lost_callback_(NULL),
50 swap_buffers_callback_(NULL), 51 swap_buffers_callback_(NULL),
51 max_texture_size_(1024), 52 max_texture_size_(1024),
52 width_(0), 53 width_(0),
53 height_(0), 54 height_(0),
54 bound_buffer_(0), 55 bound_buffer_(0),
55 weak_ptr_factory_(this) { 56 weak_ptr_factory_(this) {
56 } 57 }
57 58
58 TestWebGraphicsContext3D::TestWebGraphicsContext3D( 59 TestWebGraphicsContext3D::TestWebGraphicsContext3D(
59 const WebGraphicsContext3D::Attributes& attributes) 60 const WebGraphicsContext3D::Attributes& attributes)
60 : FakeWebGraphicsContext3D(), 61 : FakeWebGraphicsContext3D(),
61 context_id_(s_context_id++), 62 context_id_(s_context_id++),
62 next_buffer_id_(1), 63 next_buffer_id_(1),
64 next_image_id_(1),
63 next_texture_id_(1), 65 next_texture_id_(1),
64 attributes_(attributes), 66 attributes_(attributes),
65 have_extension_io_surface_(false), 67 have_extension_io_surface_(false),
66 have_extension_egl_image_(false), 68 have_extension_egl_image_(false),
67 times_make_current_succeeds_(-1), 69 times_make_current_succeeds_(-1),
68 times_bind_texture_succeeds_(-1), 70 times_bind_texture_succeeds_(-1),
69 times_end_query_succeeds_(-1), 71 times_end_query_succeeds_(-1),
70 context_lost_(false), 72 context_lost_(false),
71 context_lost_callback_(NULL), 73 context_lost_callback_(NULL),
72 swap_buffers_callback_(NULL), 74 swap_buffers_callback_(NULL),
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 437 }
436 438
437 WebKit::WGC3Dboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM( 439 WebKit::WGC3Dboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM(
438 WebKit::WGC3Denum target) { 440 WebKit::WGC3Denum target) {
439 DCHECK_GT(buffers_.count(bound_buffer_), 0u); 441 DCHECK_GT(buffers_.count(bound_buffer_), 0u);
440 DCHECK_EQ(target, buffers_.get(bound_buffer_)->target); 442 DCHECK_EQ(target, buffers_.get(bound_buffer_)->target);
441 buffers_.get(bound_buffer_)->pixels.reset(); 443 buffers_.get(bound_buffer_)->pixels.reset();
442 return true; 444 return true;
443 } 445 }
444 446
447 void TestWebGraphicsContext3D::bindTexImage2DCHROMIUM(
448 WebKit::WGC3Denum target,
449 WebKit::WGC3Dint image_id) {
450 DCHECK_GT(images_.count(image_id), 0u);
451 }
452
453 WebKit::WGC3Duint TestWebGraphicsContext3D::createImageCHROMIUM(
454 WebKit::WGC3Dsizei width, WebKit::WGC3Dsizei height,
455 WebKit::WGC3Denum internalformat) {
456 DCHECK_EQ(GL_RGBA8_OES, static_cast<int>(internalformat));
457 WebKit::WGC3Duint image_id = NextImageId();
458 images_.set(image_id, make_scoped_ptr(new Image).Pass());
459 images_.get(image_id)->pixels.reset(new uint8[width * height * 4]);
460 return image_id;
461 }
462
463 void TestWebGraphicsContext3D::destroyImageCHROMIUM(
464 WebKit::WGC3Duint id) {
465 unsigned context_id = id >> 17;
466 unsigned image_id = id & 0x1ffff;
467 DCHECK(image_id && image_id < next_image_id_);
468 DCHECK_EQ(context_id, context_id_);
469 }
470
471 void TestWebGraphicsContext3D::getImageParameterivCHROMIUM(
472 WebKit::WGC3Duint image_id,
473 WebKit::WGC3Denum pname,
474 WebKit::WGC3Dint* params) {
475 DCHECK_GT(images_.count(image_id), 0u);
476 DCHECK_EQ(GL_IMAGE_ROWBYTES_CHROMIUM, static_cast<int>(pname));
477 *params = 0;
478 }
479
480 void* TestWebGraphicsContext3D::mapImageCHROMIUM(WebKit::WGC3Duint image_id,
481 WebKit::WGC3Denum access) {
482 DCHECK_GT(images_.count(image_id), 0u);
483 return images_.get(image_id)->pixels.get();
484 }
485
486 void TestWebGraphicsContext3D::unmapImageCHROMIUM(
487 WebKit::WGC3Duint image_id) {
488 DCHECK_GT(images_.count(image_id), 0u);
489 }
490
445 WebGLId TestWebGraphicsContext3D::NextTextureId() { 491 WebGLId TestWebGraphicsContext3D::NextTextureId() {
446 WebGLId texture_id = next_texture_id_++; 492 WebGLId texture_id = next_texture_id_++;
447 DCHECK(texture_id < (1 << 16)); 493 DCHECK(texture_id < (1 << 16));
448 texture_id |= context_id_ << 16; 494 texture_id |= context_id_ << 16;
449 return texture_id; 495 return texture_id;
450 } 496 }
451 497
452 WebGLId TestWebGraphicsContext3D::NextBufferId() { 498 WebGLId TestWebGraphicsContext3D::NextBufferId() {
453 WebGLId buffer_id = next_buffer_id_++; 499 WebGLId buffer_id = next_buffer_id_++;
454 DCHECK(buffer_id < (1 << 17)); 500 DCHECK(buffer_id < (1 << 17));
455 buffer_id |= context_id_ << 17; 501 buffer_id |= context_id_ << 17;
456 return buffer_id; 502 return buffer_id;
457 } 503 }
458 504
505 WebKit::WGC3Duint TestWebGraphicsContext3D::NextImageId() {
506 WebKit::WGC3Duint image_id = next_image_id_++;
507 DCHECK(image_id < (1 << 17));
508 image_id |= context_id_ << 17;
509 return image_id;
510 }
511
459 TestWebGraphicsContext3D::Buffer::Buffer() : target(0) {} 512 TestWebGraphicsContext3D::Buffer::Buffer() : target(0) {}
460 513
461 TestWebGraphicsContext3D::Buffer::~Buffer() {} 514 TestWebGraphicsContext3D::Buffer::~Buffer() {}
462 515
516 TestWebGraphicsContext3D::Image::Image() {}
517
518 TestWebGraphicsContext3D::Image::~Image() {}
519
463 } // namespace cc 520 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698