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

Unified Diff: skia/ext/platform_canvas.h

Issue 6987019: Revert 86625 - This change implements a first pass in the effort to remove the dependency of Plat... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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_win.h ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas.h
===================================================================
--- skia/ext/platform_canvas.h (revision 86628)
+++ skia/ext/platform_canvas.h (working copy)
@@ -63,6 +63,30 @@
// Shared --------------------------------------------------------------------
+ // These calls should surround calls to platform drawing routines, the
+ // surface returned here can be used with the native platform routines
+ //
+ // Call endPlatformPaint when you are done and want to use Skia operations
+ // after calling the platform-specific beginPlatformPaint; this will
+ // synchronize the bitmap to OS if necessary.
+ PlatformDevice::PlatformSurface beginPlatformPaint() const;
+ void endPlatformPaint() const;
+
+ // Returns the platform device pointer of the topmost rect with a non-empty
+ // clip. In practice, this is usually either the top layer or nothing, since
+ // we usually set the clip to new layers when we make them.
+ //
+ // If there is no layer that is not all clipped out, this will return a
+ // dummy device so callers do not have to check. If you are concerned about
+ // performance, check the clip before doing any painting.
+ //
+ // This is different than SkCanvas' getDevice, because that returns the
+ // bottommost device.
+ //
+ // Danger: the resulting device should not be saved. It will be invalidated
+ // by the next call to save() or restore().
+ PlatformDevice& getTopPlatformDevice() const;
+
// Return the stride (length of a line in bytes) for the given width. Because
// we use 32-bits per pixel, this will be roughly 4*width. However, for
// alignment reasons we may wish to increase that.
@@ -85,26 +109,11 @@
// CoreGraphics.
virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap);
- // Disallow copy and assign
+ // Disallow copy and assign.
PlatformCanvas(const PlatformCanvas&);
PlatformCanvas& operator=(const PlatformCanvas&);
};
-// Returns the SkDevice pointer of the topmost rect with a non-empty
-// clip. In practice, this is usually either the top layer or nothing, since
-// we usually set the clip to new layers when we make them.
-//
-// If there is no layer that is not all clipped out, this will return a
-// dummy device so callers do not have to check. If you are concerned about
-// performance, check the clip before doing any painting.
-//
-// This is different than SkCanvas' getDevice, because that returns the
-// bottommost device.
-//
-// Danger: the resulting device should not be saved. It will be invalidated
-// by the next call to save() or restore().
-SkDevice* GetTopDevice(const SkCanvas& canvas);
-
// Creates a canvas with raster bitmap backing.
// Set is_opaque if you are going to erase the bitmap and not use
// transparency: this will enable some optimizations.
@@ -115,45 +124,18 @@
// return NULL PlatformSurface.
SK_API bool SupportsPlatformPaint(const SkCanvas* canvas);
-// Draws into the a native platform surface, |context|. Forwards to
-// DrawToNativeContext on a PlatformDevice instance bound to the top device.
-// If no PlatformDevice instance is bound, is a no-operation.
-SK_API void DrawToNativeContext(SkCanvas* canvas, PlatformSurface context,
- int x, int y, const PlatformRect* src_rect);
-
-// Sets the opacity of each pixel in the specified region to be opaque.
-SK_API void MakeOpaque(SkCanvas* canvas, int x, int y, int width, int height);
-
// These calls should surround calls to platform drawing routines, the
// surface returned here can be used with the native platform routines.
//
// Call EndPlatformPaint when you are done and want to use skia operations
// after calling the platform-specific BeginPlatformPaint; this will
// synchronize the bitmap to OS if necessary.
-SK_API PlatformSurface BeginPlatformPaint(SkCanvas* canvas);
+//
+// Note: These functions will eventually replace
+// PlatformCanvas::beginPlatformPaint and PlatformCanvas::endPlatformPaint.
+SK_API PlatformDevice::PlatformSurface BeginPlatformPaint(SkCanvas* canvas);
SK_API void EndPlatformPaint(SkCanvas* canvas);
-// Helper class for pairing calls to BeginPlatformPaint and EndPlatformPaint.
-// Upon construction invokes BeginPlatformPaint, and upon destruction invokes
-// EndPlatformPaint.
-class ScopedPlatformPaint {
- public:
- explicit ScopedPlatformPaint(SkCanvas* canvas) : canvas_(canvas) {
- platform_surface_ = BeginPlatformPaint(canvas);
- }
- ~ScopedPlatformPaint() { EndPlatformPaint(canvas_); }
-
- // Returns the PlatformSurface to use for native platform drawing calls.
- PlatformSurface GetPlatformSurface() { return platform_surface_; }
- private:
- SkCanvas* canvas_;
- PlatformSurface platform_surface_;
-
- // Disallow copy and assign
- ScopedPlatformPaint(const ScopedPlatformPaint&);
- ScopedPlatformPaint& operator=(const ScopedPlatformPaint&);
-};
-
} // namespace skia
#endif // SKIA_EXT_PLATFORM_CANVAS_H_
« no previous file with comments | « skia/ext/canvas_paint_win.h ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698