Skip to content

Commit

Permalink
Always use the skia backing store for touchui.
Browse files Browse the repository at this point in the history
BUG=none
TEST=none

Review URL: http://codereview.chromium.org/7013011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85123 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sadrul@chromium.org committed May 12, 2011
1 parent 3f00419 commit cc12116
Showing 1 changed file with 3 additions and 46 deletions.
49 changes: 3 additions & 46 deletions chrome/browser/renderer_host/render_widget_host_view_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "base/time.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/backing_store_skia.h"
#include "content/browser/renderer_host/backing_store_x.h"
#include "content/browser/renderer_host/render_widget_host.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/result_codes.h"
Expand All @@ -38,7 +37,6 @@
static const int kMaxWindowWidth = 4000;
static const int kMaxWindowHeight = 4000;
static const char kRenderWidgetHostViewKey[] = "__RENDER_WIDGET_HOST_VIEW__";
static const char kBackingStoreSkiaSwitch[] = "use-backing-store-skia";

// Copied from third_party/WebKit/Source/WebCore/page/EventHandler.cpp
//
Expand All @@ -63,18 +61,6 @@ const char RenderWidgetHostViewViews::kViewClassName[] =

namespace {

bool UsingBackingStoreSkia() {
static bool decided = false;
static bool use_skia = false;
if (!decided) {
CommandLine* cmdline = CommandLine::ForCurrentProcess();
use_skia = (cmdline && cmdline->HasSwitch(kBackingStoreSkiaSwitch));
decided = true;
}

return use_skia;
}

int WebInputEventFlagsFromViewsEvent(const views::Event& event) {
int modifiers = 0;

Expand Down Expand Up @@ -398,13 +384,7 @@ BackingStore* RenderWidgetHostViewViews::AllocBackingStore(
if (!nview)
return NULL;

if (UsingBackingStoreSkia()) {
return new BackingStoreSkia(host_, size);
} else {
return new BackingStoreX(host_, size,
ui::GetVisualFromGtkWidget(nview),
gtk_widget_get_visual(nview)->depth);
}
return new BackingStoreSkia(host_, size);
}

void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) {
Expand Down Expand Up @@ -843,31 +823,8 @@ void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) {
origin.y() + paint_rect.y());
paint_rect.SetRect(0, 0, paint_rect.width(), paint_rect.height());
}
if (UsingBackingStoreSkia()) {
static_cast<BackingStoreSkia*>(backing_store)->SkiaShowRect(
gfx::Point(paint_rect.x(), paint_rect.y()), canvas);
} else {
static_cast<BackingStoreX*>(backing_store)->XShowRect(origin,
paint_rect, ui::GetX11WindowFromGdkWindow(window));
}
} else if (!UsingBackingStoreSkia()) {
// If the grey blend is showing, we make two drawing calls. Use double
// buffering to prevent flicker. Use CairoShowRect because XShowRect
// shortcuts GDK's double buffering.
GdkRectangle rect = { paint_rect.x(), paint_rect.y(),
paint_rect.width(), paint_rect.height() };
gdk_window_begin_paint_rect(window, &rect);

static_cast<BackingStoreX*>(backing_store)->CairoShowRect(
paint_rect, GDK_DRAWABLE(window));

cairo_t* cr = gdk_cairo_create(window);
gdk_cairo_rectangle(cr, &rect);
cairo_set_source_rgba(cr, 0, 0, 0, 0.7);
cairo_fill(cr);
cairo_destroy(cr);

gdk_window_end_paint(window);
static_cast<BackingStoreSkia*>(backing_store)->SkiaShowRect(
gfx::Point(paint_rect.x(), paint_rect.y()), canvas);
} else {
// TODO(sad)
NOTIMPLEMENTED();
Expand Down

0 comments on commit cc12116

Please sign in to comment.