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

Unified Diff: skia/ext/canvas_paint_wayland.h

Issue 10009024: Remove WAYLAND port (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/canvas_paint.h ('k') | skia/ext/canvas_paint_x.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/canvas_paint_wayland.h
diff --git a/skia/ext/canvas_paint_wayland.h b/skia/ext/canvas_paint_wayland.h
deleted file mode 100644
index bceb8bb50011089e69c6cd62fd6e8651bdcd4712..0000000000000000000000000000000000000000
--- 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_
« no previous file with comments | « skia/ext/canvas_paint.h ('k') | skia/ext/canvas_paint_x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698