diff options
-rw-r--r-- | webkit/support/webkit_support.cc | 12 | ||||
-rw-r--r-- | webkit/support/webkit_support.gypi | 2 | ||||
-rw-r--r-- | webkit/support/webkit_support.h | 9 | ||||
-rw-r--r-- | webkit/support/webkit_support_gfx.h | 41 |
4 files changed, 45 insertions, 19 deletions
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 2a9a00b..66d2c66 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -212,10 +212,6 @@ static void SetUpTestEnvironmentImpl(bool unit_test_mode) { } } -void SetUpTestEnvironment(bool unit_test_mode) { - SetUpTestEnvironment(); -} - void SetUpTestEnvironment() { SetUpTestEnvironmentImpl(false); } @@ -354,14 +350,6 @@ WebDevToolsAgentClient::WebKitClientMessageLoop* CreateDevToolsMessageLoop() { return new WebKitClientMessageLoopImpl(); } -void PostTaskFromHere(Task* task) { - MessageLoop::current()->PostTask(FROM_HERE, task); -} - -void PostDelayedTaskFromHere(Task* task, int64 delay_ms) { - MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay_ms); -} - void PostDelayedTask(void (*func)(void*), void* context, int64 delay_ms) { MessageLoop::current()->PostDelayedTask( FROM_HERE, NewRunnableFunction(func, context), delay_ms); diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index 63cf05a..d052566 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -11,6 +11,7 @@ 'target_name': 'webkit_support', 'type': 'static_library', 'dependencies': [ + '<(DEPTH)/gfx/gfx.gyp:gfx', '<(DEPTH)/media/media.gyp:media', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/testing/gtest.gyp:gtest', @@ -36,6 +37,7 @@ 'test_webplugin_page_delegate.h', 'webkit_support.cc', 'webkit_support.h', + 'webkit_support_gfx.h', 'webkit_support_glue.cc', 'weburl_loader_mock.cc', 'weburl_loader_mock.h', diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h index 6c17de2..c8b7978 100644 --- a/webkit/support/webkit_support.h +++ b/webkit/support/webkit_support.h @@ -6,12 +6,13 @@ #define WEBKIT_SUPPORT_WEBIT_SUPPORT_H_ #include <string> +#include <vector> #include "app/keyboard_codes.h" #include "base/basictypes.h" +#include "base/string16.h" #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgentClient.h" -class Task; class WebURLLoaderMockFactory; namespace WebKit { class WebApplicationCacheHost; @@ -50,10 +51,6 @@ namespace webkit_support { // initialized (as it is already done by the TestSuite). void SetUpTestEnvironment(); void SetUpTestEnvironmentForUnitTests(); -// TODO(jcivelli): the method below is deprecated and should be removed when -// DumpRenderTree has been modified to use the version with no -// parameter. -void SetUpTestEnvironment(bool unit_test_mode); void TearDownTestEnvironment(); // Returns a pointer to a WebKitClient implementation for DumpRenderTree. @@ -103,8 +100,6 @@ void RunAllPendingMessages(); void DispatchMessageLoop(); WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* CreateDevToolsMessageLoop(); -void PostTaskFromHere(Task* task); // TODO(tkent): Eliminate Task. -void PostDelayedTaskFromHere(Task* task, int64 delay_ms); // ditto. void PostDelayedTask(void (*func)(void*), void* context, int64 delay_ms); // -------- File path and PathService diff --git a/webkit/support/webkit_support_gfx.h b/webkit/support/webkit_support_gfx.h new file mode 100644 index 0000000..4a00204 --- /dev/null +++ b/webkit/support/webkit_support_gfx.h @@ -0,0 +1,41 @@ +// Copyright (c) 2010 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 WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ +#define WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ + +#include <vector> + +#include "gfx/codec/png_codec.h" + +namespace webkit_support { + +// Decode a PNG into an RGBA pixel array. +inline bool DecodePNG(const unsigned char* input, size_t input_size, + std::vector<unsigned char>* output, + int* width, int* height) { + return gfx::PNGCodec::Decode(input, input_size, gfx::PNGCodec::FORMAT_RGBA, + output, width, height); +} + +// Encode an RGBA pixel array into a PNG. +inline bool EncodeRGBAPNG(const unsigned char* input, int width, int height, + int row_byte_width, + std::vector<unsigned char>* output) { + return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_RGBA, width, + height, row_byte_width, false, output); +} + +// Encode an BGRA pixel array into a PNG. +inline bool EncodeBGRAPNG(const unsigned char* input, int width, int height, + int row_byte_width, bool discard_transparency, + std::vector<unsigned char>* output) { + return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA, width, + height, row_byte_width, discard_transparency, + output); +} + +} // namespace webkit_support + +#endif WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ |