diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-07 00:33:04 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-07 00:33:04 +0000 |
commit | 328ce55f74ce4316a4fbb1286be14bf603e841e6 (patch) | |
tree | dda8a6ff77f9828dad816d6b02a21e65605f9f1f /skia/ext | |
parent | 9d7a49d744c7431eded94842d9bab9f7eae7c7b6 (diff) | |
download | chromium_src-328ce55f74ce4316a4fbb1286be14bf603e841e6.zip chromium_src-328ce55f74ce4316a4fbb1286be14bf603e841e6.tar.gz chromium_src-328ce55f74ce4316a4fbb1286be14bf603e841e6.tar.bz2 |
Remove WAYLAND port
Also removed skia/ext/canvas_paint_x.h which is not in use.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10009024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext')
-rw-r--r-- | skia/ext/canvas_paint.h | 8 | ||||
-rw-r--r-- | skia/ext/canvas_paint_wayland.h | 115 | ||||
-rw-r--r-- | skia/ext/canvas_paint_x.h | 118 |
3 files changed, 3 insertions, 238 deletions
diff --git a/skia/ext/canvas_paint.h b/skia/ext/canvas_paint.h index 89923b66..d1925d9 100644 --- a/skia/ext/canvas_paint.h +++ b/skia/ext/canvas_paint.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -14,12 +14,10 @@ #elif defined(__APPLE__) #include "skia/ext/canvas_paint_mac.h" #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun) -#if defined(USE_WAYLAND) -#include "skia/ext/canvas_paint_wayland.h" -#elif defined(TOOLKIT_GTK) +#if defined(TOOLKIT_GTK) #include "skia/ext/canvas_paint_gtk.h" #else -#include "skia/ext/canvas_paint_x.h" +#error "No canvas paint for this platform" #endif #endif diff --git a/skia/ext/canvas_paint_wayland.h b/skia/ext/canvas_paint_wayland.h deleted file mode 100644 index bceb8bb..0000000 --- a/skia/ext/canvas_paint_wayland.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2011 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 SKIA_EXT_CANVAS_PAINT_WAYLAND_H_ -#define SKIA_EXT_CANVAS_PAINT_WAYLAND_H_ -#pragma once - -#include "base/logging.h" -#include "skia/ext/canvas_paint_common.h" -#include "skia/ext/platform_canvas.h" - -namespace skia { - -// A class designed to translate skia painting into a region in a Wayland window -// surface. On construction, it will set up a context for painting into, and on -// destruction, it will commit it to the Wayland window surface. -// Note: The created context is always inialized to (0, 0, 0, 0). -template <class T> -class CanvasPaintT : public T { - public: - // This constructor assumes the result is opaque. - CanvasPaintT(cairo_surface_t* cairo_window_surface, - cairo_rectangle_int_t* region) - : context_(NULL), - cairo_window_surface_(cairo_window_surface), - region_(region), - composite_alpha_(false) { - init(true); - } - - CanvasPaintT(cairo_surface_t* cairo_window_surface, - cairo_rectangle_int_t* region, - bool opaque) - : context_(NULL), - cairo_window_surface_(cairo_window_surface), - region_(region), - composite_alpha_(false) { - init(opaque); - } - - virtual ~CanvasPaintT() { - if (!is_empty()) { - PlatformCanvas* canvas = GetPlatformCanvas(this); - canvas->restoreToCount(1); - - // Blit the dirty rect to the window. - CHECK(cairo_window_surface_); - cairo_t* cr = cairo_create(cairo_window_surface_); - CHECK(cr); - - if (composite_alpha_) - cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); - - cairo_surface_t* source_surface = cairo_get_target(context_); - CHECK(source_surface); - // Flush cairo's cache of the surface. - cairo_surface_mark_dirty(source_surface); - cairo_set_source_surface(cr, source_surface, region_->x, region_->y); - cairo_rectangle(cr, - region_->x, - region_->y, - region_->width, - region_->height); - cairo_fill(cr); - cairo_destroy(cr); - } - } - - // Sets whether the bitmap is composited in such a way that the alpha channel - // is honored. This is only useful if you've enabled an RGBA colormap on the - // widget. The default is false. - void set_composite_alpha(bool composite_alpha) { - composite_alpha_ = composite_alpha; - } - - // Returns true if the invalid region is empty. The caller should call this - // function to determine if anything needs painting. - bool is_empty() const { - return region_->width == 0 && region_->height == 0; - } - - private: - void init(bool opaque) { - PlatformCanvas* canvas = GetPlatformCanvas(this); - if (!canvas->initialize(region_->width, region_->height, opaque, NULL)) { - // Cause a deliberate crash; - CHECK(false); - } - // No need to clear the canvas, because cairo automatically performs the - // clear. - - // Need to translate so that the dirty region appears at the origin of the - // surface. - canvas->translate(-SkIntToScalar(region_->x), -SkIntToScalar(region_->y)); - - context_ = BeginPlatformPaint(canvas); - } - - cairo_t* context_; - cairo_surface_t* cairo_window_surface_; - cairo_rectangle_int_t* region_; - // See description above setter. - bool composite_alpha_; - - // Disallow copy and assign. - CanvasPaintT(const CanvasPaintT&); - CanvasPaintT& operator=(const CanvasPaintT&); -}; - -typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; - -} // namespace skia - -#endif // SKIA_EXT_CANVAS_PAINT_WAYLAND_H_ diff --git a/skia/ext/canvas_paint_x.h b/skia/ext/canvas_paint_x.h deleted file mode 100644 index a714a2e..0000000 --- a/skia/ext/canvas_paint_x.h +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2011 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 SKIA_EXT_CANVAS_PAINT_WAYLAND_H_ -#define SKIA_EXT_CANVAS_PAINT_WAYLAND_H_ -#pragma once - -#include "base/logging.h" -#include "skia/ext/canvas_paint_common.h" -#include "skia/ext/platform_canvas.h" - -#include <cairo/cairo.h> - -namespace skia { - -// A class designed to translate skia painting into a region in a Wayland window -// surface. On construction, it will set up a context for painting into, and on -// destruction, it will commit it to the Wayland window surface. -// Note: The created context is always inialized to (0, 0, 0, 0). -template <class T> -class CanvasPaintT : public T { - public: - // This constructor assumes the result is opaque. - CanvasPaintT(cairo_surface_t* cairo_window_surface, - cairo_rectangle_t* region) - : context_(NULL), - cairo_window_surface_(cairo_window_surface), - region_(region), - composite_alpha_(false) { - init(true); - } - - CanvasPaintT(cairo_surface_t* cairo_window_surface, - cairo_rectangle_t* region, - bool opaque) - : context_(NULL), - cairo_window_surface_(cairo_window_surface), - region_(region), - composite_alpha_(false) { - init(opaque); - } - - virtual ~CanvasPaintT() { - if (!is_empty()) { - PlatformCanvas* canvas = GetPlatformCanvas(this); - canvas->restoreToCount(1); - - // Blit the dirty rect to the window. - CHECK(cairo_window_surface_); - cairo_t* cr = cairo_create(cairo_window_surface_); - CHECK(cr); - - if (composite_alpha_) - cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); - - cairo_surface_t* source_surface = cairo_get_target(context_); - CHECK(source_surface); - // Flush cairo's cache of the surface. - cairo_surface_mark_dirty(source_surface); - cairo_set_source_surface(cr, source_surface, region_->x, region_->y); - cairo_rectangle(cr, - region_->x, - region_->y, - region_->width, - region_->height); - cairo_fill(cr); - cairo_destroy(cr); - } - } - - // Sets whether the bitmap is composited in such a way that the alpha channel - // is honored. This is only useful if you've enabled an RGBA colormap on the - // widget. The default is false. - void set_composite_alpha(bool composite_alpha) { - composite_alpha_ = composite_alpha; - } - - // Returns true if the invalid region is empty. The caller should call this - // function to determine if anything needs painting. - bool is_empty() const { - return region_->width == 0 && region_->height == 0; - } - - private: - void init(bool opaque) { - PlatformCanvas* canvas = GetPlatformCanvas(this); - if (!canvas->initialize(region_->width, region_->height, opaque, NULL)) { - // Cause a deliberate crash; - CHECK(false); - } - // No need to clear the canvas, because cairo automatically performs the - // clear. - - // Need to translate so that the dirty region appears at the origin of the - // surface. - canvas->translate(-SkDoubleToScalar(region_->x), - -SkDoubleToScalar(region_->y)); - - context_ = BeginPlatformPaint(canvas); - } - - cairo_t* context_; - cairo_surface_t* cairo_window_surface_; - cairo_rectangle_t* region_; - // See description above setter. - bool composite_alpha_; - - // Disallow copy and assign. - CanvasPaintT(const CanvasPaintT&); - CanvasPaintT& operator=(const CanvasPaintT&); -}; - -typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; - -} // namespace skia - -#endif // SKIA_EXT_CANVAS_PAINT_WAYLAND_H_ |