Commit efe03ce5 authored by tomhudson's avatar tomhudson Committed by Commit bot

Start hiding deprecated skia/ext/ functions

skia::GetTopDevice() gets removed from our public API.
SK_API also removed from a couple of classes we don't want used.

R=fmalita@chromium.org
BUG=543755

Review-Url: https://codereview.chromium.org/2294813002
Cr-Commit-Position: refs/heads/master@{#415387}
parent 21e88d97
...@@ -19,7 +19,8 @@ class ScopedPlatformPaint; ...@@ -19,7 +19,8 @@ class ScopedPlatformPaint;
// format that Skia supports and can then use this to draw ClearType into, etc. // format that Skia supports and can then use this to draw ClearType into, etc.
// This pixel data is provided to the bitmap that the device contains so that it // This pixel data is provided to the bitmap that the device contains so that it
// can be shared. // can be shared.
class SK_API BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice { class SK_API BitmapPlatformDevice : public SkBitmapDevice,
public PlatformDevice {
public: public:
// Factory function. is_opaque should be set if the caller knows the bitmap // Factory function. is_opaque should be set if the caller knows the bitmap
// will be completely opaque and allows some optimizations. // will be completely opaque and allows some optimizations.
......
...@@ -33,10 +33,6 @@ bool GetBoolMetaData(const SkCanvas& canvas, const char* key) { ...@@ -33,10 +33,6 @@ bool GetBoolMetaData(const SkCanvas& canvas, const char* key) {
namespace skia { namespace skia {
SkBaseDevice* GetTopDevice(const SkCanvas& canvas) {
return canvas.getTopDevice(true);
}
SkBitmap ReadPixels(SkCanvas* canvas) { SkBitmap ReadPixels(SkCanvas* canvas) {
SkBitmap bitmap; SkBitmap bitmap;
bitmap.setInfo(canvas->imageInfo()); bitmap.setInfo(canvas->imageInfo());
...@@ -62,7 +58,7 @@ bool GetWritablePixels(SkCanvas* canvas, SkPixmap* result) { ...@@ -62,7 +58,7 @@ bool GetWritablePixels(SkCanvas* canvas, SkPixmap* result) {
} }
bool SupportsPlatformPaint(const SkCanvas* canvas) { bool SupportsPlatformPaint(const SkCanvas* canvas) {
return GetPlatformDevice(GetTopDevice(*canvas)) != nullptr; return GetPlatformDevice(canvas->getTopDevice(true)) != nullptr;
} }
size_t PlatformCanvasStrideForWidth(unsigned width) { size_t PlatformCanvasStrideForWidth(unsigned width) {
...@@ -95,8 +91,8 @@ bool IsPreviewMetafile(const SkCanvas& canvas) { ...@@ -95,8 +91,8 @@ bool IsPreviewMetafile(const SkCanvas& canvas) {
} }
CGContextRef GetBitmapContext(const SkCanvas& canvas) { CGContextRef GetBitmapContext(const SkCanvas& canvas) {
SkBaseDevice* device = GetTopDevice(canvas); PlatformDevice* platform_device =
PlatformDevice* platform_device = GetPlatformDevice(device); GetPlatformDevice(canvas.getTopDevice(true));
SkIRect clip_bounds; SkIRect clip_bounds;
canvas.getClipDeviceBounds(&clip_bounds); canvas.getClipDeviceBounds(&clip_bounds);
return platform_device ? return platform_device ?
...@@ -111,7 +107,7 @@ ScopedPlatformPaint::ScopedPlatformPaint(SkCanvas* canvas) : ...@@ -111,7 +107,7 @@ ScopedPlatformPaint::ScopedPlatformPaint(SkCanvas* canvas) :
canvas_(canvas), canvas_(canvas),
platform_surface_(nullptr) { platform_surface_(nullptr) {
// TODO(tomhudson) we're assuming non-null canvas? // TODO(tomhudson) we're assuming non-null canvas?
PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true));
if (platform_device) { if (platform_device) {
// Compensate for drawing to a layer rather than the entire canvas // Compensate for drawing to a layer rather than the entire canvas
SkMatrix ctm; SkMatrix ctm;
......
...@@ -112,19 +112,6 @@ static inline SkCanvas* TryCreateBitmapCanvas(int width, ...@@ -112,19 +112,6 @@ static inline SkCanvas* TryCreateBitmapCanvas(int width,
// alignment reasons we may wish to increase that. // alignment reasons we may wish to increase that.
SK_API size_t PlatformCanvasStrideForWidth(unsigned width); SK_API size_t PlatformCanvasStrideForWidth(unsigned width);
// Returns the SkBaseDevice 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.
//
// This may return NULL, so callers need to check.
//
// 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().
SK_API SkBaseDevice* GetTopDevice(const SkCanvas& canvas);
// Copies pixels from the SkCanvas into an SkBitmap, fetching pixels from // Copies pixels from the SkCanvas into an SkBitmap, fetching pixels from
// GPU memory if necessary. // GPU memory if necessary.
// //
......
...@@ -90,7 +90,7 @@ bool VerifyRoundedRect(const SkCanvas& canvas, ...@@ -90,7 +90,7 @@ bool VerifyRoundedRect(const SkCanvas& canvas,
int y, int y,
int w, int w,
int h) { int h) {
SkBaseDevice* device = skia::GetTopDevice(canvas); SkBaseDevice* device = canvas.getTopDevice(true);
const SkBitmap& bitmap = device->accessBitmap(false); const SkBitmap& bitmap = device->accessBitmap(false);
SkAutoLockPixels lock(bitmap); SkAutoLockPixels lock(bitmap);
......
...@@ -29,13 +29,12 @@ class ScopedPlatformPaint; ...@@ -29,13 +29,12 @@ class ScopedPlatformPaint;
// All calls to PlatformDevice::* should be routed through these // All calls to PlatformDevice::* should be routed through these
// helper functions. // helper functions.
// Bind a PlatformDevice instance, |platform_device| to |device|. Subsequent // DEPRECATED
// calls to the functions exported below will forward the request to the // Bind a PlatformDevice instance, |platform_device|, to |device|.
// corresponding method on the bound PlatformDevice instance. If no SK_API void SetPlatformDevice(SkBaseDevice* device, PlatformDevice* platform_device);
// PlatformDevice has been bound to the SkBaseDevice passed, then the
// routines are NOPS. // DEPRECATED
SK_API void SetPlatformDevice(SkBaseDevice* device, // Retrieve the previous argument to SetPlatformDevice().
PlatformDevice* platform_device);
SK_API PlatformDevice* GetPlatformDevice(SkBaseDevice* device); SK_API PlatformDevice* GetPlatformDevice(SkBaseDevice* device);
// A SkBitmapDevice is basically a wrapper around SkBitmap that provides a // A SkBitmapDevice is basically a wrapper around SkBitmap that provides a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment