#include "base/mac/scoped_nsautorelease_pool.h"
#endif
-#if defined(TOOLKIT_GTK)
-#include "ui/gfx/gtk_util.h"
-#endif
-
namespace content {
-using WebKit::WebGLId;
-using WebKit::WebGraphicsContext3D;
+using blink::WebGLId;
+using blink::WebGraphicsContext3D;
content::GLHelper::ScalerQuality kQualities[] = {
content::GLHelper::SCALER_QUALITY_BEST,
protected:
virtual void SetUp() {
WebGraphicsContext3D::Attributes attributes;
+ bool lose_context_when_out_of_memory = false;
context_ = webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl::
- CreateOffscreenContext(attributes);
+ CreateOffscreenContext(attributes, lose_context_when_out_of_memory);
context_->makeContextCurrent();
helper_.reset(
- new content::GLHelper(context_.get(), context_->GetContextSupport()));
+ new content::GLHelper(context_->GetGLInterface(),
+ context_->GetContextSupport()));
helper_scaling_.reset(new content::GLHelperScaling(
- context_.get(),
+ context_->GetGLInterface(),
helper_.get()));
}
std::vector<gfx::PNGCodec::Comment>(),
&compressed));
ASSERT_TRUE(compressed.size());
- FILE* f = file_util::OpenFile(filename, "wb");
+ FILE* f = base::OpenFile(filename, "wb");
ASSERT_TRUE(f);
ASSERT_EQ(fwrite(&*compressed.begin(), 1, compressed.size(), f),
compressed.size());
- file_util::CloseFile(f);
+ base::CloseFile(f);
}
scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
const gfx::Size dst_size(output_sizes[outsize],
output_sizes[outsize + 1]);
SkBitmap input;
- input.setConfig(SkBitmap::kARGB_8888_Config,
- src_size.width(),
- src_size.height());
- input.allocPixels();
- SkAutoLockPixels lock(input);
+ input.allocN32Pixels(src_size.width(), src_size.height());
SkBitmap output_pixels;
- input.setConfig(SkBitmap::kARGB_8888_Config,
- dst_size.width(),
- dst_size.height());
- output_pixels.allocPixels();
- SkAutoLockPixels output_lock(output_pixels);
+ output_pixels.allocN32Pixels(dst_size.width(), dst_size.height());
context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
context_->bindTexture(GL_TEXTURE_2D, dst_texture);
kQualities[q]);
SkBitmap output_pixels;
- input.setConfig(SkBitmap::kARGB_8888_Config,
- dst_size.width(),
- dst_size.height());
- output_pixels.allocPixels();
- SkAutoLockPixels lock(output_pixels);
+ output_pixels.allocN32Pixels(dst_size.width(), dst_size.height());
helper_->ReadbackTextureSync(
dst_texture,
gfx::Rect(0, 0,
dst_size.width(),
dst_size.height()),
- static_cast<unsigned char *>(output_pixels.getPixels()));
+ static_cast<unsigned char *>(output_pixels.getPixels()),
+ kN32_SkColorType);
context_->deleteTexture(dst_texture);
std::string filename = base::StringPrintf("testoutput_%s_%d.ppm",
kQualityNames[q],
percents[p]);
- LOG(INFO) << "Writing " << filename;
+ VLOG(0) << "Writing " << filename;
SaveToFile(&output_pixels, base::FilePath::FromUTF8Unsafe(filename));
}
}
// These tests needs to run against a proper GL environment, so we
// need to set it up before we can run the tests.
int main(int argc, char** argv) {
- CommandLine::Init(argc, argv);
+ base::CommandLine::Init(argc, argv);
base::TestSuite* suite = new content::ContentTestSuite(argc, argv);
#if defined(OS_MACOSX)
base::mac::ScopedNSAutoreleasePool pool;
#endif
-#if defined(TOOLKIT_GTK)
- gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess());
-#endif
gfx::GLSurface::InitializeOneOff();
return content::UnitTestTestSuite(suite).Run();