Commit ff7e85cb authored by reed's avatar reed Committed by Commit bot

Subclasses of SkDevice that overrode onAccessBitmap can remove that code -- it is not being called.

One caller on platform_skia was calling it (incidentally), but they can call accessPixels() instead for the same result.

BUG=647756

Review-Url: https://codereview.chromium.org/2340813006
Cr-Commit-Position: refs/heads/master@{#419446}
parent a94e0ecd
...@@ -205,10 +205,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal, ...@@ -205,10 +205,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal,
# define SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF # define SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF
#endif #endif
#ifndef SK_SUPPORT_LEGACY_ACCESSBITMAP
# define SK_SUPPORT_LEGACY_ACCESSBITMAP
#endif
// Workaround for poor anisotropic mipmap quality, // Workaround for poor anisotropic mipmap quality,
// pending Skia ripmap support. // pending Skia ripmap support.
// (https://bugs.chromium.org/p/skia/issues/detail?id=4863) // (https://bugs.chromium.org/p/skia/issues/detail?id=4863)
......
...@@ -51,10 +51,10 @@ SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& info, ...@@ -51,10 +51,10 @@ SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& info,
PlatformSurface BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transform, PlatformSurface BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transform,
const SkIRect& clip_bounds) { const SkIRect& clip_bounds) {
// TODO(tomhudson): propagate transform and clip
// TODO(zhenghao): What should we return? The ptr to the address of the // TODO(zhenghao): What should we return? The ptr to the address of the
// pixels? Maybe this won't be called at all. // pixels? Maybe this won't be called at all.
return accessBitmap(true).getPixels(); SkPixmap pixmap;
return accessPixels(&pixmap) ? pixmap.writable_addr() : nullptr;
} }
// PlatformCanvas impl // PlatformCanvas impl
......
...@@ -197,14 +197,6 @@ HDC BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transform, ...@@ -197,14 +197,6 @@ HDC BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transform,
return GetBitmapDC(transform, clip_bounds); return GetBitmapDC(transform, clip_bounds);
} }
const SkBitmap& BitmapPlatformDevice::onAccessBitmap() {
// FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI
// operation has occurred on our DC.
if (IsBitmapDCCreated())
GdiFlush();
return SkBitmapDevice::onAccessBitmap();
}
SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo,
const SkPaint*) { const SkPaint*) {
const SkImageInfo& info = cinfo.fInfo; const SkImageInfo& info = cinfo.fInfo;
......
...@@ -41,11 +41,6 @@ class SK_API BitmapPlatformDevice : public SkBitmapDevice, ...@@ -41,11 +41,6 @@ class SK_API BitmapPlatformDevice : public SkBitmapDevice,
~BitmapPlatformDevice() override; ~BitmapPlatformDevice() override;
protected: protected:
// Flushes the Windows device context so that the pixel data can be accessed
// directly by Skia. Overridden from SkBaseDevice, this is called when Skia
// starts accessing pixel data.
const SkBitmap& onAccessBitmap() override;
SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
private: private:
......
...@@ -102,9 +102,10 @@ bool VerifyRoundedRect(const SkCanvas& canvas, ...@@ -102,9 +102,10 @@ bool VerifyRoundedRect(const SkCanvas& canvas,
int y, int y,
int w, int w,
int h) { int h) {
SkBaseDevice* device = canvas.getTopDevice(true); SkPixmap pixmap;
const SkBitmap& bitmap = device->accessBitmap(false); ASSERT_TRUE(canvas.peekPixels(&pixmap));
SkAutoLockPixels lock(bitmap); SkBitmap bitmap;
bitmap.installPixels(pixmap);
// Check corner points first. They should be of canvas_color. // Check corner points first. They should be of canvas_color.
if (!IsOfColor(bitmap, x, y, canvas_color)) return false; if (!IsOfColor(bitmap, x, y, canvas_color)) return false;
......
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