summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 18:59:52 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 18:59:52 +0000
commit19b8be0d34bc2d0693a879f25a52c2f0e1a0cea6 (patch)
tree2ac05b3118078eced4332e356f0790a821ec1ec4 /skia
parenta021b2e246b164ef6a4911d79d38df0fd14fd38b (diff)
downloadchromium_src-19b8be0d34bc2d0693a879f25a52c2f0e1a0cea6.zip
chromium_src-19b8be0d34bc2d0693a879f25a52c2f0e1a0cea6.tar.gz
chromium_src-19b8be0d34bc2d0693a879f25a52c2f0e1a0cea6.tar.bz2
Fix line endings.
Review URL: http://codereview.chromium.org/155702 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/canvas_paint.h34
-rw-r--r--skia/ext/canvas_paint_linux.h202
-rw-r--r--skia/ext/canvas_paint_win.h264
3 files changed, 250 insertions, 250 deletions
diff --git a/skia/ext/canvas_paint.h b/skia/ext/canvas_paint.h
index c65b880..0a8f2d1 100644
--- a/skia/ext/canvas_paint.h
+++ b/skia/ext/canvas_paint.h
@@ -1,17 +1,17 @@
-// Copyright (c) 2009 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_H_
-#define SKIA_EXT_CANVAS_PAINT_H_
-
-// This file provides an easy way to include the appropriate CanvasPaint
-// header file on your platform.
-
-#if defined(WIN32)
-#include "skia/ext/canvas_paint_win.h"
-#elif defined(__linux__)
-#include "skia/ext/canvas_paint_linux.h"
-#endif
-
-#endif // SKIA_EXT_CANVAS_PAINT_H_
+// Copyright (c) 2009 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_H_
+#define SKIA_EXT_CANVAS_PAINT_H_
+
+// This file provides an easy way to include the appropriate CanvasPaint
+// header file on your platform.
+
+#if defined(WIN32)
+#include "skia/ext/canvas_paint_win.h"
+#elif defined(__linux__)
+#include "skia/ext/canvas_paint_linux.h"
+#endif
+
+#endif // SKIA_EXT_CANVAS_PAINT_H_
diff --git a/skia/ext/canvas_paint_linux.h b/skia/ext/canvas_paint_linux.h
index 361254b..b69dd5a 100644
--- a/skia/ext/canvas_paint_linux.h
+++ b/skia/ext/canvas_paint_linux.h
@@ -1,101 +1,101 @@
-
-// Copyright (c) 2009 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_LINUX_H_
-#define SKIA_EXT_CANVAS_PAINT_LINUX_H_
-
-#include "skia/ext/platform_canvas.h"
-
-#include <gdk/gdk.h>
-
-namespace skia {
-
-// A class designed to translate skia painting into a region in a
-// GdkWindow. This class has been adapted from the class with the same name in
-// platform_canvas_win.h. On construction, it will set up a context for
-// painting into, and on destruction, it will commit it to the GdkWindow.
-template <class T>
-class CanvasPaintT : public T {
- public:
- // This constructor assumes the result is opaque.
- explicit CanvasPaintT(GdkEventExpose* event)
- : surface_(NULL),
- window_(event->window),
- rectangle_(event->area),
- composite_alpha_(false) {
- init(true);
- }
-
- CanvasPaintT(GdkEventExpose* event, bool opaque)
- : surface_(NULL),
- window_(event->window),
- rectangle_(event->area),
- composite_alpha_(false) {
- init(opaque);
- }
-
- virtual ~CanvasPaintT() {
- if (!is_empty()) {
- T::restoreToCount(1);
-
- // Blit the dirty rect to the window.
- cairo_t* cr = gdk_cairo_create(window_);
- if (composite_alpha_)
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_source_surface(cr, surface_, rectangle_.x, rectangle_.y);
- cairo_rectangle(cr, rectangle_.x, rectangle_.y,
- rectangle_.width, rectangle_.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 rectangle_.width == 0 || rectangle_.height == 0;
- }
-
- const GdkRectangle& rectangle() const {
- return rectangle_;
- }
-
- private:
- void init(bool opaque) {
- if (!T::initialize(rectangle_.width, rectangle_.height, opaque, NULL)) {
- // Cause a deliberate crash;
- *(char*) 0 = 0;
- }
-
- // Need to translate so that the dirty region appears at the origin of the
- // surface.
- T::translate(-SkIntToScalar(rectangle_.x), -SkIntToScalar(rectangle_.y));
-
- surface_ = T::getTopPlatformDevice().beginPlatformPaint();
- }
-
- cairo_surface_t* surface_;
- GdkWindow* window_;
- GdkRectangle rectangle_;
- // 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_LINUX_H_
+
+// Copyright (c) 2009 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_LINUX_H_
+#define SKIA_EXT_CANVAS_PAINT_LINUX_H_
+
+#include "skia/ext/platform_canvas.h"
+
+#include <gdk/gdk.h>
+
+namespace skia {
+
+// A class designed to translate skia painting into a region in a
+// GdkWindow. This class has been adapted from the class with the same name in
+// platform_canvas_win.h. On construction, it will set up a context for
+// painting into, and on destruction, it will commit it to the GdkWindow.
+template <class T>
+class CanvasPaintT : public T {
+ public:
+ // This constructor assumes the result is opaque.
+ explicit CanvasPaintT(GdkEventExpose* event)
+ : surface_(NULL),
+ window_(event->window),
+ rectangle_(event->area),
+ composite_alpha_(false) {
+ init(true);
+ }
+
+ CanvasPaintT(GdkEventExpose* event, bool opaque)
+ : surface_(NULL),
+ window_(event->window),
+ rectangle_(event->area),
+ composite_alpha_(false) {
+ init(opaque);
+ }
+
+ virtual ~CanvasPaintT() {
+ if (!is_empty()) {
+ T::restoreToCount(1);
+
+ // Blit the dirty rect to the window.
+ cairo_t* cr = gdk_cairo_create(window_);
+ if (composite_alpha_)
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ cairo_set_source_surface(cr, surface_, rectangle_.x, rectangle_.y);
+ cairo_rectangle(cr, rectangle_.x, rectangle_.y,
+ rectangle_.width, rectangle_.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 rectangle_.width == 0 || rectangle_.height == 0;
+ }
+
+ const GdkRectangle& rectangle() const {
+ return rectangle_;
+ }
+
+ private:
+ void init(bool opaque) {
+ if (!T::initialize(rectangle_.width, rectangle_.height, opaque, NULL)) {
+ // Cause a deliberate crash;
+ *(char*) 0 = 0;
+ }
+
+ // Need to translate so that the dirty region appears at the origin of the
+ // surface.
+ T::translate(-SkIntToScalar(rectangle_.x), -SkIntToScalar(rectangle_.y));
+
+ surface_ = T::getTopPlatformDevice().beginPlatformPaint();
+ }
+
+ cairo_surface_t* surface_;
+ GdkWindow* window_;
+ GdkRectangle rectangle_;
+ // 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_LINUX_H_
diff --git a/skia/ext/canvas_paint_win.h b/skia/ext/canvas_paint_win.h
index ebf1ba0..66746fe 100644
--- a/skia/ext/canvas_paint_win.h
+++ b/skia/ext/canvas_paint_win.h
@@ -1,132 +1,132 @@
-// Copyright (c) 2009 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_WIN_H_
-#define SKIA_EXT_CANVAS_PAINT_WIN_H_
-
-#include "skia/ext/platform_canvas.h"
-
-namespace skia {
-
-// A class designed to help with WM_PAINT operations on Windows. It will
-// do BeginPaint/EndPaint on init/destruction, and will create the bitmap and
-// canvas with the correct size and transform for the dirty rect. The bitmap
-// will be automatically painted to the screen on destruction.
-//
-// You MUST call isEmpty before painting to determine if anything needs
-// painting. Sometimes the dirty rect can actually be empty, and this makes
-// the bitmap functions we call unhappy. The caller should not paint in this
-// case.
-//
-// Therefore, all you need to do is:
-// case WM_PAINT: {
-// gfx::PlatformCanvasPaint canvas(hwnd);
-// if (!canvas.isEmpty()) {
-// ... paint to the canvas ...
-// }
-// return 0;
-// }
-template <class T>
-class CanvasPaintT : public T {
- public:
- // This constructor assumes the canvas is opaque.
- explicit CanvasPaintT(HWND hwnd) : hwnd_(hwnd), paint_dc_(NULL),
- for_paint_(true) {
- memset(&ps_, 0, sizeof(ps_));
- initPaint(true);
- }
-
- CanvasPaintT(HWND hwnd, bool opaque) : hwnd_(hwnd), paint_dc_(NULL),
- for_paint_(true) {
- memset(&ps_, 0, sizeof(ps_));
- initPaint(opaque);
- }
-
- // Creates a CanvasPaintT for the specified region that paints to the
- // specified dc. This does NOT do BeginPaint/EndPaint.
- CanvasPaintT(HDC dc, bool opaque, int x, int y, int w, int h)
- : hwnd_(NULL),
- paint_dc_(dc),
- for_paint_(false) {
- memset(&ps_, 0, sizeof(ps_));
- ps_.rcPaint.left = x;
- ps_.rcPaint.right = x + w;
- ps_.rcPaint.top = y;
- ps_.rcPaint.bottom = y + h;
- init(opaque);
- }
-
- virtual ~CanvasPaintT() {
- if (!isEmpty()) {
- restoreToCount(1);
- // Commit the drawing to the screen
- getTopPlatformDevice().drawToHDC(paint_dc_,
- ps_.rcPaint.left, ps_.rcPaint.top,
- NULL);
- }
- if (for_paint_)
- EndPaint(hwnd_, &ps_);
- }
-
- // Returns true if the invalid region is empty. The caller should call this
- // function to determine if anything needs painting.
- bool isEmpty() const {
- return ps_.rcPaint.right - ps_.rcPaint.left == 0 ||
- ps_.rcPaint.bottom - ps_.rcPaint.top == 0;
- }
-
- // Use to access the Windows painting parameters, especially useful for
- // getting the bounding rect for painting: paintstruct().rcPaint
- const PAINTSTRUCT& paintStruct() const {
- return ps_;
- }
-
- // Returns the DC that will be painted to
- HDC paintDC() const {
- return paint_dc_;
- }
-
- protected:
- HWND hwnd_;
- HDC paint_dc_;
- PAINTSTRUCT ps_;
-
- private:
- void initPaint(bool opaque) {
- paint_dc_ = BeginPaint(hwnd_, &ps_);
-
- init(opaque);
- }
-
- void init(bool opaque) {
- // FIXME(brettw) for ClearType, we probably want to expand the bounds of
- // painting by one pixel so that the boundaries will be correct (ClearType
- // text can depend on the adjacent pixel). Then we would paint just the
- // inset pixels to the screen.
- const int width = ps_.rcPaint.right - ps_.rcPaint.left;
- const int height = ps_.rcPaint.bottom - ps_.rcPaint.top;
- if (!initialize(width, height, opaque, NULL)) {
- // Cause a deliberate crash;
- *(char*) 0 = 0;
- }
-
- // This will bring the canvas into the screen coordinate system for the
- // dirty rect
- translate(SkIntToScalar(-ps_.rcPaint.left),
- SkIntToScalar(-ps_.rcPaint.top));
- }
-
- // If true, this canvas was created for a BeginPaint.
- const bool for_paint_;
-
- // Disallow copy and assign.
- CanvasPaintT(const CanvasPaintT&);
- CanvasPaintT& operator=(const CanvasPaintT&);
-};
-
-typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint;
-
-} // namespace skia
-
-#endif // SKIA_EXT_CANVAS_PAINT_WIN_H_
+// Copyright (c) 2009 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_WIN_H_
+#define SKIA_EXT_CANVAS_PAINT_WIN_H_
+
+#include "skia/ext/platform_canvas.h"
+
+namespace skia {
+
+// A class designed to help with WM_PAINT operations on Windows. It will
+// do BeginPaint/EndPaint on init/destruction, and will create the bitmap and
+// canvas with the correct size and transform for the dirty rect. The bitmap
+// will be automatically painted to the screen on destruction.
+//
+// You MUST call isEmpty before painting to determine if anything needs
+// painting. Sometimes the dirty rect can actually be empty, and this makes
+// the bitmap functions we call unhappy. The caller should not paint in this
+// case.
+//
+// Therefore, all you need to do is:
+// case WM_PAINT: {
+// gfx::PlatformCanvasPaint canvas(hwnd);
+// if (!canvas.isEmpty()) {
+// ... paint to the canvas ...
+// }
+// return 0;
+// }
+template <class T>
+class CanvasPaintT : public T {
+ public:
+ // This constructor assumes the canvas is opaque.
+ explicit CanvasPaintT(HWND hwnd) : hwnd_(hwnd), paint_dc_(NULL),
+ for_paint_(true) {
+ memset(&ps_, 0, sizeof(ps_));
+ initPaint(true);
+ }
+
+ CanvasPaintT(HWND hwnd, bool opaque) : hwnd_(hwnd), paint_dc_(NULL),
+ for_paint_(true) {
+ memset(&ps_, 0, sizeof(ps_));
+ initPaint(opaque);
+ }
+
+ // Creates a CanvasPaintT for the specified region that paints to the
+ // specified dc. This does NOT do BeginPaint/EndPaint.
+ CanvasPaintT(HDC dc, bool opaque, int x, int y, int w, int h)
+ : hwnd_(NULL),
+ paint_dc_(dc),
+ for_paint_(false) {
+ memset(&ps_, 0, sizeof(ps_));
+ ps_.rcPaint.left = x;
+ ps_.rcPaint.right = x + w;
+ ps_.rcPaint.top = y;
+ ps_.rcPaint.bottom = y + h;
+ init(opaque);
+ }
+
+ virtual ~CanvasPaintT() {
+ if (!isEmpty()) {
+ restoreToCount(1);
+ // Commit the drawing to the screen
+ getTopPlatformDevice().drawToHDC(paint_dc_,
+ ps_.rcPaint.left, ps_.rcPaint.top,
+ NULL);
+ }
+ if (for_paint_)
+ EndPaint(hwnd_, &ps_);
+ }
+
+ // Returns true if the invalid region is empty. The caller should call this
+ // function to determine if anything needs painting.
+ bool isEmpty() const {
+ return ps_.rcPaint.right - ps_.rcPaint.left == 0 ||
+ ps_.rcPaint.bottom - ps_.rcPaint.top == 0;
+ }
+
+ // Use to access the Windows painting parameters, especially useful for
+ // getting the bounding rect for painting: paintstruct().rcPaint
+ const PAINTSTRUCT& paintStruct() const {
+ return ps_;
+ }
+
+ // Returns the DC that will be painted to
+ HDC paintDC() const {
+ return paint_dc_;
+ }
+
+ protected:
+ HWND hwnd_;
+ HDC paint_dc_;
+ PAINTSTRUCT ps_;
+
+ private:
+ void initPaint(bool opaque) {
+ paint_dc_ = BeginPaint(hwnd_, &ps_);
+
+ init(opaque);
+ }
+
+ void init(bool opaque) {
+ // FIXME(brettw) for ClearType, we probably want to expand the bounds of
+ // painting by one pixel so that the boundaries will be correct (ClearType
+ // text can depend on the adjacent pixel). Then we would paint just the
+ // inset pixels to the screen.
+ const int width = ps_.rcPaint.right - ps_.rcPaint.left;
+ const int height = ps_.rcPaint.bottom - ps_.rcPaint.top;
+ if (!initialize(width, height, opaque, NULL)) {
+ // Cause a deliberate crash;
+ *(char*) 0 = 0;
+ }
+
+ // This will bring the canvas into the screen coordinate system for the
+ // dirty rect
+ translate(SkIntToScalar(-ps_.rcPaint.left),
+ SkIntToScalar(-ps_.rcPaint.top));
+ }
+
+ // If true, this canvas was created for a BeginPaint.
+ const bool for_paint_;
+
+ // Disallow copy and assign.
+ CanvasPaintT(const CanvasPaintT&);
+ CanvasPaintT& operator=(const CanvasPaintT&);
+};
+
+typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint;
+
+} // namespace skia
+
+#endif // SKIA_EXT_CANVAS_PAINT_WIN_H_