0

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}
This commit is contained in:
tomhudson
2016-08-30 12:13:54 -07:00
committed by Commit bot
parent 21e88d977e
commit efe03ce5f0
5 changed files with 13 additions and 30 deletions

@ -19,7 +19,8 @@ class ScopedPlatformPaint;
// 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
// can be shared.
class SK_API BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
class SK_API BitmapPlatformDevice : public SkBitmapDevice,
public PlatformDevice {
public:
// Factory function. is_opaque should be set if the caller knows the bitmap
// will be completely opaque and allows some optimizations.

@ -33,10 +33,6 @@ bool GetBoolMetaData(const SkCanvas& canvas, const char* key) {
namespace skia {
SkBaseDevice* GetTopDevice(const SkCanvas& canvas) {
return canvas.getTopDevice(true);
}
SkBitmap ReadPixels(SkCanvas* canvas) {
SkBitmap bitmap;
bitmap.setInfo(canvas->imageInfo());
@ -62,7 +58,7 @@ bool GetWritablePixels(SkCanvas* canvas, SkPixmap* result) {
}
bool SupportsPlatformPaint(const SkCanvas* canvas) {
return GetPlatformDevice(GetTopDevice(*canvas)) != nullptr;
return GetPlatformDevice(canvas->getTopDevice(true)) != nullptr;
}
size_t PlatformCanvasStrideForWidth(unsigned width) {
@ -95,8 +91,8 @@ bool IsPreviewMetafile(const SkCanvas& canvas) {
}
CGContextRef GetBitmapContext(const SkCanvas& canvas) {
SkBaseDevice* device = GetTopDevice(canvas);
PlatformDevice* platform_device = GetPlatformDevice(device);
PlatformDevice* platform_device =
GetPlatformDevice(canvas.getTopDevice(true));
SkIRect clip_bounds;
canvas.getClipDeviceBounds(&clip_bounds);
return platform_device ?
@ -111,7 +107,7 @@ ScopedPlatformPaint::ScopedPlatformPaint(SkCanvas* canvas) :
canvas_(canvas),
platform_surface_(nullptr) {
// TODO(tomhudson) we're assuming non-null canvas?
PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true));
if (platform_device) {
// Compensate for drawing to a layer rather than the entire canvas
SkMatrix ctm;

@ -112,19 +112,6 @@ static inline SkCanvas* TryCreateBitmapCanvas(int width,
// alignment reasons we may wish to increase that.
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
// GPU memory if necessary.
//

@ -90,7 +90,7 @@ bool VerifyRoundedRect(const SkCanvas& canvas,
int y,
int w,
int h) {
SkBaseDevice* device = skia::GetTopDevice(canvas);
SkBaseDevice* device = canvas.getTopDevice(true);
const SkBitmap& bitmap = device->accessBitmap(false);
SkAutoLockPixels lock(bitmap);

@ -29,13 +29,12 @@ class ScopedPlatformPaint;
// All calls to PlatformDevice::* should be routed through these
// helper functions.
// Bind a PlatformDevice instance, |platform_device| to |device|. Subsequent
// calls to the functions exported below will forward the request to the
// corresponding method on the bound PlatformDevice instance. If no
// PlatformDevice has been bound to the SkBaseDevice passed, then the
// routines are NOPS.
SK_API void SetPlatformDevice(SkBaseDevice* device,
PlatformDevice* platform_device);
// DEPRECATED
// Bind a PlatformDevice instance, |platform_device|, to |device|.
SK_API void SetPlatformDevice(SkBaseDevice* device, PlatformDevice* platform_device);
// DEPRECATED
// Retrieve the previous argument to SetPlatformDevice().
SK_API PlatformDevice* GetPlatformDevice(SkBaseDevice* device);
// A SkBitmapDevice is basically a wrapper around SkBitmap that provides a